Upon cloning a base image, I need to reconfigure basic settings. Regenerating the ssh host key, changing static IP assignments, setting the host name, etc.
Because of the network setup, DHCP is not an option. That more or less rules out SSHing in with a predefined key or running a startup script since I can't provide the IP externally.
I'd most like to mount the filesystem of the new machine on Dom0, but the lvm volumes are exported and it appears to be Bad Form to import them so the Dom0 machine can see them.
What's your best suggestion for altering files in a cloned VM before boot? Must be non-interactive, and I'm going to guess out the gate that scripting access via xe console
is not going to work well.
You should do what some deployment systems (Open Nebula for instance) do - create a tiny second drive consisting of the personalization data.
Configure your image to expect this second drive to be there (perhaps with a known UUID or filesystem name) and if it is there, read out the personalization data and apply it to the OS during boot.
The other cool option that Open Nebula does is actually embed the IP address into the MAC address. Decode that inside your domU and you're set!
Or, just use IPv6 autoconfig. :)
What about using a static IP as a "build IP", boot the image on this known IP with a known key and kick off a script that logs in, reconfigures, and reboots?
Configure the base image to
Also has the ability to get really creative if you want; auto-generate the tarball on download request, possibly based on database information, and generally based on a configuration skeleton.
Apparently, vgexport/vgimport is not necessary to move drives from one system to another. It is an administrative policy tool to prevent access to volumes in the time it takes to move them.
vgchange -a y
marked all volumes as usable, but that didn't help me because they're not direct partitions. They're virtual disk images that have partition tables inside them.Then I came across the script below at http://www.mceith.com/blog/?p=112. Direct attachment of disks to the VM... adjust as needed, the re-call to unmount.