[pve-devel] rfc : qemu fw_cfg as alternative to cloudinit

Alexandre DERUMIER aderumier at odiso.com
Wed Oct 4 08:14:40 CEST 2017


Hi,

I just discover a new qemu feature : qemu fw_cfg

http://www.contrib.andrew.cmu.edu/~somlo/QEMU_fw_cfg/


It's allow to add a custom firmware, from a host file

like "-fw_cfg name=opt/GuestInfo,file=/etc/pve/qemu-server/100.conf"  , for example


Then it's possible to read this file in guest in 

"/sys/firmware/qemu_fw_cfg/by_name/opt/GuestInfo/raw"

This need a new module include in guest kernel 4.6 (CONFIG_FW_CFG_SYSFS), 
but the module is also available out of kernel tree here:
http://www.contrib.andrew.cmu.edu/~somlo/QEMU_fw_cfg/qemu_fw_cfg_kmod.tgz

(really small, it's simply extend standard firmware , so it's work with old kernel too)

for windows, seem that they are working on it (https://bugzilla.redhat.com/show_bug.cgi?id=1375444)



Advantage vs cloudinit: 

- no need to pass cdrom, no extra pci device.(it's simply a firmware)
- you can use it in initramfs. (format disk, do mount point,...)


disavantage vs cloudinit:

- read only (you can change it after boot, but it's really for vm init)
- no daemon or standard to parse the config, you need to do it yourself.
  But coreos for example, have a projet "ignition", 
  https://coreos.com/ignition/docs/latest/
  which can use it (it's working in initramfs)



I think it should be possible to provide qemu linux distro template like lxc, format the disk in initramfs, do the mount point, deploy source for example.
Maybe also provide initramfs to qemu with -initrd, with an integrated custom config parser,to format the disk, do the mountpoint, deploy the template,set ssh keys, ....

What do you think about it ?


(
I'm currently working on a terraform proxmox provider, to deploy vm, as we are looking to deploy Rancher next year (a kubernetes clusters managers),
and I need to be able to create vm from outside proxmox, with ip configuration,hostname,...)




More information about the pve-devel mailing list