post-cloning updates
der.hans
PLUGd at LuftHans.com
Wed Nov 23 15:29:51 MST 2011
moin moin,
need to do some house cleaning after cloning a QEMU/KVM VM. For instance,
the hostname needs to be changed. I also often need to install some new
packages.
How are you doing this?
Thus far for clones I've just logged in and run a few commands by hand.
Automation would be better.
Can virt-clone kick off some scripts inside the VM?
Can vmbuilder ( nee ubuntu-vm-builder and python-vm-builder ) clone in
addition to building from scratch?
I could:
. create a run_once type of script that would do the house cleaning when
the VM gets booted. This requires booting into an incorrect setup at least
once. It also requires keeping the script current on the golden image.
. create a run_once type of script that's housed on the VM host. This
still requires booting into an incorrect setup at least once. It also
requires networking to come up correctly on the client.
. create a script on the host that logs into the client make the changes.
This requires booting into the incorrect environment once and networking
to work.
. create a script on the host that mounts the cloned filesystem and
adjusts things. Makes installying packages a bit tricky, but doable. Would
allow changes to VMen without booting them. I imagine it would also be an
issue for encrypted filesystems. While I'm not planning on using
encryption on my VM filesystems it doesn't mean others wouldn't and
doesn't mean I might not change my mind.
. create a kickstart/apt mechanism that gets queried by the client to
initiate package reconfigures with the new settings. Requires booting into
the incorrectly configured system once and getting to know the packaging
systems more intimately than should be required. Also limits to making
changes via the package management system.
. find a way to wrap virt-clone to make the changes when cloning the
system or wrap virsh or vmbuilder to make clones and then get local
changes.
. cut-and-paste into a shell after connecting to the console. This
requires interaction or not requiring authentication on the console. The
latter should be safe as there shouldn't be access to get to the console,
but it just seems so wrong :).
I'd prefer to use virsh to clone and make changes to the client, but
getting vmbuilder to make clones is more likely.
Mouting the drive image is probably the most likely thing, but I'm open to
better ideas.
ciao,
der.hans
--
# http://www.LuftHans.com/ http://www.LuftHans.com/Classes/
# Fairy Tale, n.: A horror story to prepare children for the newspapers.
More information about the PLUG-discuss
mailing list