Hi,
I'm not a big fan of all the bash scripts which are being called on KVM
system for deploying the System VM's.
They try to mount the guest, inject data (like SSH keys) and then
continue the boot process of the guest.
It's something I don't like and I think libguestfs [0] can help here.
With guestfish [1] you can access the VM and modify its filesystem:
guestfish <<_EOF_
add disk.img
run
mount /dev/vda1 /
write-append /root/.ssh/authorized_keys "ssh-rsa XXXXXX...."
_EOF_
Imho this would be a much cleaner way to modify the System VM's without
having to set up loop devices, mount them, etc, etc.
The nice thing with libguestfs is that you can access the VM's while
they are running (use with caution!), so that gives you much more
flexibility!
There is a native C API, but there also seem to be Java bindings [2], so
that could make it much cleaner to integrate into CloudStack.
libguestfs also seems to be present in Fedora [3] and in RHEL 6, so that
shouldn't be a problem.
Searching the web showed me some reports of libguestfs and CloudStack,
but browsing the code I found no reference to this.
Something worth looking at I think?
Wido
[0]: http://libguestfs.org/
[1]: http://libguestfs.org/guestfish.1.html
[2]: http://libguestfs.org/guestfs-java.3.html
[3]: https://fedoraproject.org/wiki/Features/libguestfs