Jump to: navigation, search

LibvirtCustomKernelArgs

Revision as of 14:58, 2 September 2020 by Cbf123 (talk | contribs) (Kernel Args in Glance)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 has been extended to look for a well named metadata property and use that when booting the guest. Currently we only support completely replacing the default args.

To completely override the default args, use the "os_command_line" image property:


 # glance image-update \
     --property os_command_line="root=/dev/vda console=hvc0" \
     f16-x86_64-openstack-sda

This key is valid only for Amazon kernel, ramdisk, or machine images (aki, ari, or ami).

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.