[xen-tools-discuss] comments on xen-create-image
Brenda J. Butler
bjb at linuxbutler.ca
Sat Mar 12 00:19:32 CET 2011
I want to automate a vm restore as much as possible, given a tarfile backup.
I made a new "install" method called restore and added it to xen-create-image
and all it does is look for the disk.img and mount it.
I will need to restore the database from the database dump and put in
new networking parameters.
I can get the database dump out of the backup, no problem. I can get the
hostname and other parameters out of the tarfile using a wrapper script
around xen-create-image, so far that works ok.
However, since I'm not doing an "install", the new IP address(es) is not
passed to the xt-create-xen-config script. Here's the code extract (true
for both xen-tools 3.2 and 4.2):
exportEnvironment ();
if ( $CONFIG { 'install' } ) {
installSystem ();
...
if ( $CONFIG { 'hooks' } ) {
runCustomisationHooks ();
}
}
runRoleScripts ( $CONFIG { 'role' } );
runXenConfigCreation ();
Unfortunately, the ip addresses are only exported to the environment (correctly)
in the runCustomisationHooks () routine.
Would it be possible to move the export of the ip env variables into
the exportEnvironment routine?
Also, it might be interesting to allow the customisation hooks to run even
if an install hasn't happened, so that (for instance) a "distro" called
"restore.d" can be placed in /usr/lib/xen-tools alongside "debian.d",
"gentoo.d" etc. Although I suppose I could use role scripts instead.
Why are some items "role" scripts and some are "customisation" scripts?
Two more points: If --password is set in the conf file, there is no way to
turn it off, it would be nice if it could be turned off on the command line.
And it would be nice to be able to set disk_device on the xen-create-image
command line. I'm creating a vm that needs a disk device named xvda but the
xen-tools I'm using makes sda by default. xt-create-xen-config will use
a disk_device environment variable, but xen-create-image cannot be
configured to pass it (not the one I'm using anyway - the 3.2 one).
(Ooh, it's in the xen-tools config file but its not a command-line option.)
Thanks for your comments on the above! If I run into any more interesting
items while I implement this I'll pass them on.
bjb
More information about the xen-tools-discuss
mailing list