On Mon, Apr 11, 2016 at 12:01:08PM +0300, Michael Ravits wrote:
> Hi,
>
> My use case involves creating duplicates of saved virtual machines.
While I realize you want to trivially clone VMs with some state at
random point in time, you might want to look into `virt-builder` about
cloning VMs. It has some sensible advice:
http://libguestfs.org/virt-builder.1.html#clones
Using `virt-builder` to clone images, will 'sysprep' the images, which
will ensure that (a) each VM copy gets a fresh pair of SSH host keys;
(b) a new random seed; (c) all security/sensitive information is
removed; (d) log files are cleaned (in the below URL, look up the string
"logfiles *" to see what all it removes), and much more. Take a look
here for what all it does:
http://libguestfs.org/virt-sysprep.1.html#operations
http://libguestfs.org/virt-sysprep.1.html#security
> Tried with virt-manager and with virsh but so far it seems like this
> case is not supported by these tools. Does anyone know how I could
> achieve the above?
With 'virsh', you _can_ save the live disk and memory state:
$ virsh snapshot-create-as \
--domain myvm snap1 \
--diskspec vda,file=./disk-snap.qcow2,snapshot=external \
--memspec file=./mem-snap.qcow2,snapshot=external \
--atomic
--
/kashyap