Ubuntu

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

Reported by Kiall Mac Innes on 2012-01-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Low
Vish Ishaya
cloud-init
Undecided
Unassigned
cloud-init (Ubuntu)
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

Kiall Mac Innes (kiall) wrote :

Also, This is on the Oneiric cloud-image.

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) on 2012-01-17
Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
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

Kiall Mac Innes (kiall) wrote :

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

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
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
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) on 2012-01-31
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
Brian Waldon (bcwaldon) on 2012-02-07
Changed in nova:
milestone: none → essex-4

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) on 2012-02-29
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers