Linux – XenServer: Editing clone configuration before boot

linuxxenxenserver

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.

Best Answer

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. :)