[Users] Linux sysprep

René Koch (ovido) r.koch at ovido.at
Mon Aug 19 14:17:52 UTC 2013


Hi,

Has anyone an idea what's the easiest way to sysprep Linux (CentOS 6 and
RHEL 6) machines?

The use case is the following: I want to create a lot of virtual
machines (e.g. 100) by cloning from one template.
So I create a master vm, create a template and a pool with 100 vms
assigned to it and set all 100 vms to prestarted.

The problem is now, that when I run "sys-unconfig" before creating the
template, which does a "touch /.unconfigured" I have to go through the
sysconfig-tui and set a new root password for all 100 hosts.

So what I'm looking for is a script like the sysprep tool for windows
which sets parameters for me automatically.
I only need to change:
* Hostname + set DHCP_HOSTNAME in ifcfg-eth0 (Hostname == Pool-VM-Name)
for some dhcp/ddns magic :)
* Clear udev network-rules
* remove SSH-Keys
* Remove RHN ID and join Satellite/Spacewalk-server
* root-password,... should stay the same

My first question is: does oVirt provide such a functionality for Linux
guest out-of-the-box? I couldn't find one.


I think I could solve this with virt-sysprep and virt-file, but I'm
unsure if I can use it with oVirt (or only with plain libvirt):
http://libguestfs.org/virt-sysprep.1.html
http://libguestfs.org/virt-edit.1.html

For this tools it's required that the vm is not running, as it changes
files on the disk. If I'm using a before-vm-start hook, it should be
save to access the disk and change content with virt-sysprep/virt-file,
right?
But do I have access to the disk in a before-vm-start hook?
If using NFS storage I should be able to access all disks on the
NFS-share, but for iSCSI/FC-LUNS - are they available on the hypervisor
in this stage?


Another option would be to write a custom script which is started during
boot and disables itself after successful run (in the same way as
firstboot - I already have such a script for RHN Satellite/Spacewalk
joins). The problem here is: How do I get the (oVirt) name of this vm
(would need something like virt-whoami :) )? Is the (internal oVirt) ID
of this vm stored somewhere in the filesystem of this vm? I don't think
so....


Thanks a lot for suggestions,
René






More information about the Users mailing list