Jump to: navigation, search


Revision as of 23:30, 17 February 2013 by Ryan Lane (talk | contribs) (Text replace - "__NOTOC__" to "")

Libvirt Custom Kernel Args

As well as being used to store disk images, glance can also be used to store kernel and initrd files. The Nova libvirt driver is able to specify that a VM boot from the kernel/initrd file, instead of from a disk. When doing so, the libvirt driver will set the kernel command line to specify the root disk and console device. There is no way to pass any extra, user defined, boot arguments to the kernel though. This can be very useful if the kernel+initrd correspond to an OS installer image. For example, the boot arg can be used to specify the install tree location URL.

Kernel Args in Glance

Since glance allows custom metadata to be associated with any image, it is possible to use this to store the desired kernel command line string. Nova can be extended to look for a well named metadata property and use that when booting the guest. There exists two possible needs - either completely replace the default args, or simply extend them. For this reason, two properties will be defined

To completely override the default args

 # glance image-update \
     --property kernel_args="root=/dev/vda console=hvc0" \

Or to just append some extra args

 # glance image-update \
     --property kernel_extra_args="selinux=0" \

Kernel Args per VM

Although setting kernel command line args against the glance image is useful, it is not necessarily sufficient. For greatest flexibility it is desirable to be able to provide different kernel arguments for each instance that it booted. For this, there needs to be a way to provide arbitrary metadata arguments to the 'nova boot' command. There is no such facility at this time, so a metadata dictionary parameter will need to be added to the command & REST/RPC APIs. This is potentially useful beyond simply kernel command line args. For example, a user may wish to customize what timezone a VM starts up in, or override the default disk/nic model associated with an image. Without this per-VM boot ability they would have to upload the same image to glance multiple times & specify different parameters per image stored.