diff --git a/modules/sysadmin_guide/pages/guest_migrate.adoc b/modules/sysadmin_guide/pages/guest_migrate.adoc new file mode 100644 index 0000000..4e4861f --- /dev/null +++ b/modules/sysadmin_guide/pages/guest_migrate.adoc @@ -0,0 +1,73 @@ += Guest migration between hosts. + +Move guests from one host to another. + +== Contact Information + +Owner:: + Fedora Infrastructure Team +Contact:: + #fedora-admin, sysadmin-main +Location:: + IAD2, Tummy, ibiblio, Telia, OSUOSL +Servers:: + All xen servers, kvm/libvirt servers. +Purpose:: + Migrate guests + +== How to do it + +[arabic] +. Schedule outage time if any. This will need to be long enough to copy +the data from one host to another, so will depend on guest disk size. +. Turn off monitoring in nagios +. On new host create disk space for server: ++ +.... +lvcreate -n app03 -L 32G vg_guests +.... +. prepare old guest for migration: +[loweralpha] +.. if system is xen, install a regular kernel +.. look for entries for xenblk and hvc0 in /etc files +. Shutdown the guest. +. {blank} ++ +.... +virsh dumpxml guestname > guest.xml +.... +. Copy guest.xml to the new machine. You will need to make various edits +depending on if the system was originally xen or such. I normally need +to compare an existing xml on the target system and the one we dumped +out to make up the differences. +. Define the guest on the new machine: 'virsh define guest.xml'. +Depending on the changes in the xml this may not work and you will need +to make many manual changes plus copy the guest.xml to +`/etc/libvirtd/qemu` and do a `/sbin/service libvirtd restart` +. Insert iptables rule for nc transfer: ++ +.... +iptables -I INPUT -s -m tcp -p tcp --dport 11111 -j ACCEPT +.... +. On the destination host: ++ +____ +nc -l 11111 | dd of=/dev/mapper/ +____ +. On the source host: ++ +.... +dd if=/dev/mapper/guest-partition | nc 11111 +.... ++ +Wait for the copy to finish. You can do the following to track how far +something has gone by finding the dd pid and then sending a 'kill -USR1' +to it. +. start the guest on the new host: ++ +.... +``virsh start guest`` +.... +. On the source host, rename storage and undefine guest so it's not +started. +. In ansible change the host_vars to reflect the new host