Flexiable 'libvirt.xml.template' to support various VM images?

Asked by Huang Zhiteng

Hi OpenStack gurus,

Recently I created a RHEL 6 VM with default partition method, by which the installer partitioned the image with LVM volumes. Then I did bundling KERNAL/RAMDISK/OS and uploaded them to Nova objectstore. But the problem is 'euca-run-instance' created instance with the image cannot boot.

I managed to track down the problem being libvirtd on compute node cannot mout root "/" partition. The 'libvirt.xml.template' being used contains lines like:
           <kernel>${kernel}</kernel>
           <cmdline>root=/dev/vda console=ttyS0 selinux=0</cmdline>
           <initrd>${ramdisk}</initrd>

Clearly the root partition of my VM image is not located understand /dev/vda. Since it was parttion to LVM volumes, the correct location should be something like "root=/dev/mapper/vg_rhel6-lv_root".

In IRC channel, vishy mentioned the in order to boot VM with LVM partition, whole disk should be used instead of external kernel & ramdisk. To me, booting instance with external kernel/ramdisk are much more flexible and hance fits my need (so that I can do things like disable selinux).

But per my understand of Nova, currently 'libvirt.xml.template' serves for all VM images uploaded to image service. That implies all images should be installed the same way: same location of root partition, utilizing either partition or LVM but not both. Is my understanding correct? If so, it doesn't make much sense to me. Image service should support all kinds of images, no matter the disk are partitioned or LVMed.

So I'm thinking if it's possible to add some attribute/metadata to VM image to provide necessary information (e.g. location of root partition) to create and boot instance from differnt VM images. Meantime, Nova should be able to utilize these kind of information to create the right XML configuration for the instance. Sound reasonable?

Question information

Language:
English Edit question
Status:
Answered
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Christian Baumann (baumann-b1-systems) said :
#1

I feel the same way here ....

Revision history for this message
Gaurav Gupta (gagupta) said :
#2

I agree. I've had issues booting a CentOS image which did not have virtio driver. I had to use scsi/ide to boot and the only way to do so is to change the libvirt.xml.template, which disables virtio for all instances. I think its a must to allow the user to select the configuration per instance.

Can you help with this problem?

Provide an answer of your own, or ask Huang Zhiteng for more information if necessary.

To post a message you must log in.