Comment 5 for bug 827590

Revision history for this message
Isaku Yamahata (yamahata) wrote : Re: [Bug 827590] Re: cloud-init does not mount ephemeral0 on /mnt in nova

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'/>
                <source dev='/dev/mapper/nova--volumes-volume--00000040'/>
                <target dev='vdc' bus='virtio'/>
            </disk>

        <interface type='bridge'>
            <source bridge='br100'/>
            <mac address='02:16:3e:1e:ff:c0'/>
            <!-- <model type='virtio'/> CANT RUN virtio network right now -->
            <filterref filter="nova-instance-instance-000000e4-02163e1effc0">
                <parameter name="IP" value="172.17.220.4" />
                <parameter name="DHCPSERVER" value="172.17.220.1" />
            </filterref>
        </interface>

        <!-- The order is significant here. File must be defined first -->
        <serial type="file">
            <source path='/var/lib/nova/instances/instance-000000e4/console.log'
/>
            <target port='1'/>
        </serial>

        <console type='pty' tty='/dev/pts/2'>
            <source path='/dev/pts/2'/>
            <target port='0'/>
        </console>

        <serial type='pty'>
            <source path='/dev/pts/2'/>
            <target port='0'/>
        </serial>

        <graphics type='vnc' port='-1' autoport='yes' keymap='en-us' listen='0.0
.0.0'/>
    </devices>
</domain>