cloud-init does not mount ephemeral0 on /mnt in nova

Bug #827590 reported by Scott Moser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Unassigned
cloud-init
Invalid
Undecided
Unassigned
cloud-init (Ubuntu)
Invalid
Medium
Unassigned
Oneiric
Invalid
Medium
Unassigned
nova (Ubuntu)
Fix Released
High
Unassigned
Oneiric
Fix Released
High
Unassigned

Bug Description

related bug:
  bug 828357: request to add a label to the filesystem for ephemeral devices
  bug 827598: ephemeral device does not have a filesystem

$ python -c 'import boto.utils; print boto.utils.get_instance_metadata()["block-device-mapping"]'
{'ami': 'sda1', 'root': '/dev/sda1', 'ephemeral0': 'sda2', 'swap': 'sda3'}

$ cat /proc/partitions
$ cat /proc/partitions
major minor #blocks name

 253 0 10485760 vda
 253 16 83886080 vdb

So there is an issue here, at very least the MD should say "/dev/sda" and "/dev/sdb" would be a better guess. Additionally, there is no third disk (as reported in 'swap') present at all.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: cloud-init 0.6.1-0ubuntu14
ProcVersionSignature: User Name 3.0.0-8.11-virtual 3.0.1
Uname: Linux 3.0.0-8-virtual i686
Architecture: i386
Date: Tue Aug 16 19:17:00 2011
Ec2AMI: ami-00000011
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: <nova.db.sqlalchemy.models.InstanceTypes object at 0x4f32090>
Ec2Kernel: aki-00000010
Ec2Ramdisk: unavailable
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

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

So far nova lied. It is fixed by nova revision of 1400 in the repository.
Here is the example
ubuntu@ubuntu:~$ cat /proc/partitions
major minor #blocks name

 252 0 10485760 vda
 252 16 20971520 vdb
 252 32 1048576 vdc

ubuntu@ubuntu:~$ python -c 'import boto.utils; print boto.utils.get_instance_metadata()["block-device-mapping"]'
{'ami': 'vda', 'root': '/dev/vda', 'ephemeral0': '/dev/vdd'}

Revision history for this message
Thierry Carrez (ttx) wrote :

@Scott, could you confirm the fix ?

Changed in nova:
status: New → Incomplete
Dave Walker (davewalker)
Changed in cloud-init (Ubuntu):
importance: Undecided → High
Revision history for this message
Scott Moser (smoser) wrote :

Just from reading comment 2, the issue is clearly not fixed correctly.

/proc/partitions shows vda, vdb, and vdc, but the block-device-mapping shows ephemeral0 mapped to vdd.

Changed in nova:
status: Incomplete → Confirmed
Changed in cloud-init (Ubuntu):
importance: High → Medium
status: New → Triaged
Revision history for this message
Isaku Yamahata (yamahata) wrote : Re: [Bug 827590] Re: cloud-init does not mount ephemeral0 on /mnt in nova
Download full text (4.3 KiB)

On Mon, Aug 22, 2011 at 01:42:08PM -0000, Scott Moser wrote:
> Just from reading comment 2, the issue is clearly not fixed correctly.
>
> /proc/partitions shows vda, vdb, and vdc, but the block-device-mapping
> shows ephemeral0 mapped to vdd.

Yes, you're right.
The create kvm command line that libvirt created and the created xml for
the guest is as follows. You can see that those target device is specified
correctly in the xml, but the mapping information is lost in the command line.
libvirt doesn't have any way to force the guest to use the setting in
qemu-kvm case because qemu-kvm creates pci devices for each virtio-disk
and the guests understands it sequentially from 'a'. In order to fix it,
we need to pass those mapping information to guest from nova somehow and
teach OS initialization sequence (cloud-init?/udev?) the mapping.

The command line to launch kvm guest.

/usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -name instance-000000e4 -uuid 8882f5d5-d448-29e3-e124-6739e6fd22d6 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-000000e4.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=utc -boot c -kernel /var/lib/nova/instances/instance-000000e4/kernel -append root=/dev/vda console=ttyS0 -drive file=/var/lib/nova/instances/instance-000000e4/disk,if=none,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 -drive file=/var/lib/nova/instances/instance-000000e4/disk.eph0,if=none,id=drive-virtio-disk3, format=qcow2 -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk3, id=virtio-disk3 -drive file=/dev/mapper/nova--volumes-volume--00000040,if=none,id=drive-virtio-disk2,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk2,id=virtio-disk2 -netdev tap,fd=18,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=02:16:3e:1e:ff:c0,bus=pci.0,addr=0x3 -chardev file, id=charserial0,path=/var/lib/nova/instances/instance-000000e4/console.log -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 -usb -vnc 0.0.0.0:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7

the create xml for the guest
<domain type='kvm'>
    <name>instance-000000e4</name>
    <memory>524288</memory>
    <os>
            <type>hvm</type>
            <kernel>/var/lib/nova/instances/instance-000000e4/kernel</kernel>
                <cmdline>root=/dev/vda console=ttyS0</cmdline>
    </os>
    <features>
        <acpi/>
    </features>
    <vcpu>1</vcpu>
    <devices>
        <disk type='file'>
            <driver type='qcow2'/>
            <source file='/var/lib/nova/instances/instance-000000e4/disk'/>
            <target dev='vda' bus='virtio'/>
        </disk>
             <disk type='block'>
                <driver type='qcow2'/>
                <source dev='/var/lib/nova/instances/instance-000000e4/disk.eph0
'/>
                <target dev='vdd' bus='virtio'/>
             </disk>
            <disk type='block'>
                <driver type='raw'/>
                <...

Read more...

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

I understand that actually mapping a device name from hypervisor to guest is actually impossible, but hopefully we can come up with a better guess.

Its unfortunate that libvirt doesn't even seem to be using the "dev=" as a suggestion of device ordering along the virtio bus. Instead, I'm guessing it is using order present in xml. I was hoping at very least that suggesting 'vda', 'vdb', 'vdc' would render in kvm command line to addr=0x4, addr=0x5, addr=0x6 respectively.

Since libvirt seems to be relying on order in the xml, is it possible to specify the "correct" order and also sane "dev=" attributes?

Ie, what would happen if you had xml like:

| <disk type='file'>
| <driver type='qcow2'/>
| <source file='/var/lib/nova/instances/instance-000000e4/disk'/>
| <target dev='vda' bus='virtio'/>
| </disk>
| <disk type='block'>
| <driver type='qcow2'/>
| <source dev='/var/lib/nova/instances/instance-000000e4/disk.eph0 '/>
| <target dev='vdb' bus='virtio'/>
| </disk>
| <disk type='block'>
| <driver type='raw'/>
| <source dev='/dev/mapper/nova--volumes-volume--00000040'/>
| <target dev='vdc' bus='virtio'/>
| </disk>

And then specified block device mapping like:
{
 'ami': 'vda',
 'root': '/dev/vda',
 'ephemeral0': '/dev/vdb'
 'vol0': '/dev/vdc'
}

Again, I understand, you can't force the guest to name devices in any way, but hopefully we can at least map "vda" to "first device on virtio bus", and "vdb" to "second disk on virtio bus".

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
Scott Moser (smoser)
description: updated
Changed in nova (Ubuntu Oneiric):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Scott Moser (smoser) wrote :

With Isaku's branch this is fixed with no cloud-init changes, so I've marked those tasks as invalid.

Changed in cloud-init:
status: New → Invalid
Changed in cloud-init (Ubuntu Oneiric):
status: Triaged → Invalid
Scott Moser (smoser)
description: updated
Changed in nova (Ubuntu Oneiric):
importance: Medium → High
tags: added: server-o-rs
Thierry Carrez (ttx)
Changed in nova:
status: Confirmed → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote :

let's do a backport for diablo

Changed in nova:
milestone: none → 2011.3
status: Fix Committed → In Progress
tags: added: rls-mgr-o-tracking
Thierry Carrez (ttx)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Dave Walker (davewalker)
Changed in nova (Ubuntu):
milestone: none → ubuntu-11.10
Dave Walker (davewalker)
Changed in nova (Ubuntu Oneiric):
status: Triaged → Fix Released
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.