Libvirt/qemu/kvm
Qemu container live migrate with persistency:
virsh migrate \-\-verbose \-\-live \-\-undefinesource \-\-persistent <domain name> qemu+ssh://<hypervisor ip>/system
verbose - show progress
live - make that a live migration
undefinesource - remove domain’s xml file on source
persistent - DO create domain’s xml definition on target
Provison a new qemu container and run an OS installer inside
A command to spawn a new qemu container using virt-install (examples utilise version 1.3.2) tool and run an OS installer right away:
virt-install \-\-connect qemu:///system \-\-name <domain name> \-\-machine q35 \-\-memory 1024 \-\-vcpus 1 \-\-cpu host-model-only \-\-os-variant auto \-\-network bridge=<bridge name>,model=virtio,mac=RANDOM \-\-disk /var/lib/libvirt/images/<domain name>.img,size=1 \-\-location=http://us.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/ \-\-noautoconsole \-\-autostart
<domain name> - a name for the container
\-\-machine q35 - spawn a pc-q35 type container (1)
<bridge name> - a name of the bridge in host OS to attach container iface to
\-\-location - an url to the OS install tree (see virt-install manual for examples)
\-\-noautoconsole - don’t attach to console
\-\-autostart - autostart the domain on host boot up
A few other useful options:
\-\-dry-run - test run, does not make any actual changes
\-\-print-xml - Print the generated XML of the guest, instead of defining it. This will do storage allocation nevertheless.
Run a qemu container from livecd image
virt-install \-\-connect qemu:///system \-\-name <domain name> \-\-machine q35 \-\-memory 1024 \-\-vcpus 1 \-\-cpu host-model-only \-\-os-variant auto \-\-network bridge=<bridge name>,model=virtio,mac=RANDOM \-\-disk none \-\-noautoconsole \-\-cdrom /path/to/livecd.img
\-\-cdrom - path to livecd image to boot
\-\-disk none - run a diskless container
Refs.: (1) https://wiki.qemu.org/Features/Q35













