[[!comment format=mdwn
 username="spwhitton"
 avatar="http://cdn.libravatar.org/avatar/9c3f08f80e67733fd506c353239569eb"
 subject="creating the libvirt VM"
 date="2018-11-04T01:03:06Z"
 content="""
I've now an adhoc, proof-of-concept libvirt VM provisioned by my config.hs, just using a raw disk image.  It turns out that propellor should not be writing the XML configuration file in /etc, but having libvirt generate it.  This is because the config is not meant to be directly edited.  So, propellor should call virt-install(1) to setup and boot the VM.

My code uses virt-install's --import option, also passing it the location of the disk image generated by propellor.  The main problem is that the invocation of virt-install won't return until after the VM first shuts down; the idea is that you are running the OS installer and then you reboot.  Possibly using --boot instead of --import will help here; not sure.

We will need the user to specify how much RAM and how many vCPUs to assign to the VM.  All the other parameters to virt-install can be determined by looking at the properties of the VM `Host`.

Otherwise, the user will need to set an IP property on the VM so that it can be conducted.  I think we will need to leave the user to do this, as there are so many possible network configurations for libvirt VMs.  But we could probably provide helper properties.  In particular, the standard setup will be to use `Network.static`, though I'm not sure about how to do that with indeterministic interface names.
"""]]
