/etc/fstab contains incorrect device for swap partition when no ephemeral disk present.

Bug #912066 reported by Kiall Mac Innes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Vish Ishaya
cloud-init
Invalid
Undecided
Unassigned
cloud-init (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

On OpenStack using a flavor with no ephemeral storage, but with swap space, cloud-init creates an invalid /etc/fstab

Given this favor (Note: "Storage: 0GB" and "Swap: 2048MB"):

> p1.small: Memory: 3072MB, VCPUS: 4, Storage: 0GB, FlavorID: 15, Swap: 2048MB, RXTX Quota: 0GB, RXTX Cap: 0MB

The fstab is generated as:

> # /etc/fstab: static file system information.
> # <file system> <mount point> <type> <options> <dump> <pass>
> proc /proc proc nodev,noexec,nosuid 0 0
> LABEL=cloudimg-rootfs / ext4 defaults 0 0
> /dev/vdc none swap sw,comment=cloudconfig 0 0

While the devices are (/dev/vdb is the swap):

> # ls /dev/vd*
> /dev/vda /dev/vda1 /dev/vdb

Revision history for this message
Kiall Mac Innes (kiall) wrote :

Also, This is on the Oneiric cloud-image.

Revision history for this message
Scott Moser (smoser) wrote :

Kiall, could you collect the ec2 metadata from inside such an instance?

python -c 'import boto.utils, pprint; pprint.pprint(boto.utils.get_instance_metadata())'

Basically, i suspect that the metadata is stating that swap is at /dev/vdc, so cloud-init is trusting it.

if that is the case, we either have to :
 a.) go searching for swap
 b.) fix nova metadata service

and 'b' seems like the right fix, as the MD is clearly wrong.

Dave Walker (davewalker)
Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Kiall Mac Innes (kiall) wrote :

Libvirt XML: http://paste.ubuntu.com/807484/
Instance metadata: http://paste.ubuntu.com/807485/

> $ ls /dev/vd*
> /dev/vda /dev/vda1 /dev/vdb

> $ cat /etc/fstab
> # /etc/fstab: static file system information.
> # <file system> <mount point> <type> <options> <dump> <pass>
> proc /proc proc nodev,noexec,nosuid 0 0
> LABEL=cloudimg-rootfs / ext4 defaults 0 0
> /dev/vdc none swap sw,comment=cloudconfig 0 0

Revision history for this message
Kiall Mac Innes (kiall) wrote :

> $ sudo blkid /dev/vdb
> /dev/vdb: UUID="3447f2ad-9c81-4b95-ab3d-d5ff7aacbfa6" TYPE="swap"

Revision history for this message
Brian Waldon (bcwaldon) wrote :

So...I'm going to depend on you two to help me with this. Did you determine whether this is a bug we need to fix in Nova, or is it elsewhere?

Changed in nova:
status: New → Incomplete
Revision history for this message
Kiall Mac Innes (kiall) wrote :

This is a nova bug all right, supplies the incorrect device name in the ec2 metadata.

Nova supplies the following:

> 'block-device-mapping': {'ami': 'vda',
> 'root': '/dev/vda',
> 'swap': '/dev/vdc'},

When it should supply this:

> 'block-device-mapping': {'ami': 'vda',
> 'root': '/dev/vda',
> 'swap': '/dev/vdb'},

It seems to nova asks libvirt to attach the swap device at /dev/vdc, but since libvirt+kvm simply uses the supplied device name as an ordering hint, the device is actually attached at /dev/vdb

Changed in nova:
status: Incomplete → New
Revision history for this message
Kiall Mac Innes (kiall) wrote :

I should mention, I believe the fix is for nova to ask for the device to be attached at /dev/vdb when there is no ephemeral disk.

Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
status: New → Invalid
Changed in cloud-init:
status: New → Invalid
Changed in nova:
assignee: nobody → Vish Ishaya (vishvananda)
status: New → In Progress
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/3726

Brian Waldon (bcwaldon)
Changed in nova:
milestone: none → essex-4
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/3726
Committed: http://github.com/openstack/nova/commit/8f7bc2ee6c14fe6dc16d27353869a7a35f4931f0
Submitter: Jenkins
Branch: master

commit 8f7bc2ee6c14fe6dc16d27353869a7a35f4931f0
Author: Vishvananda Ishaya <email address hidden>
Date: Thu Feb 2 16:35:49 2012 -0800

    Make swap default to vdb if there is no ephemeral

     * Fixes bug 912066

    Change-Id: Ie463a8953fd0ac07a9def0dd86379d06d9259bc5

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-4 → 2012.1
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.