Centos – kvm/qemu via libvirt on CentOS – pass string or key/value or file to guest

centoskvm-virtualizationlibvirtqemu

I have a sizeable deployment of qemu/KVM VMs already, managed through libvirt. They're all CentOS 5 or 6 hosts and guests (the kernel lacks the 9p filesystem flags, so the "mount" shared filesystem won't work).

I'd like to pass an arbitrary string (or one or more key/value pairs, or a file, if that's easiest) from the host to the guest.

Requirements:
1) don't alter the networking setup (i.e. no host/guest local network and NFS on the host)
2) don't require new/custom kernels on the guests
3) Ideally, something we can do through libvirt. But that doesn't look possible, so this isn't required

Any ideas? I haven't been able to find much on this out there that doesn't fit into one of:
1) the "mount" filesystem stuff in the libvirt XML (as I said, CentOS lacks the 9p kernel flags, so this is a no-go)
2) NFS export on the host (which won't help at all unless I add a private network, which I can't)
3) The ugly hack to set the smbios serial number to… whatever arbitrary string.

Best Answer

the common practice it to start VMs with an attached VFD or iso that contains a configuration file.

...or to stop fooling around and install puppet/chef/spacewalk/saltstack etc.

...oooor to take up coding and write a custom VM agent that would interact with the host through the hypercall device. Afaik there have been some plans to allow such communication via qemu-ga, but I don't think it has been realised.