Moving A Virtual Machine

From Nuclear Physics Group Documentation Pages
Revision as of 22:20, 1 April 2015 by Maurik (talk | contribs) (Created page with "Moving a virtual machine is not so difficult, BUT, you must be careful. == Simple Move == The recipe for a simple move. Assume a move from Taro to Gourd. In this case the Go...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Moving a virtual machine is not so difficult, BUT, you must be careful.

Simple Move

The recipe for a simple move. Assume a move from Taro to Gourd. In this case the Gourd data drive is accessible as /net/data/gourd. One could also have exported and then mounted /kvm on gourd.

On Taro:

virsh dumpxml machine.name  > /net/data/gourd/kvm/machine_clone.xml
virt-clone -o roentgen.unh.edu -n roentgen2.unh.edu -f /net/data/gourd/kvm/roentgen2.unh.edu.qcow2

On Gourd:

# Move the xml file to correct location:
mv /data/kvm/machine_clone.xml /etc/libvirsh/qemu
# Edit the file to point to the new storage location.
emacs -nw /etc/libvirsh/qemu/machine_clone.xml
# Start machine
virsh define /etc/libvirsh/qemu/machine_clone.xml
virsh start machine.name

Yes, you end up with a small inconsistency in that the machine and virsh think correctly that the name is machine.name while to files are all machine_clone. This can be changed with a rename of the files. You can also keep it to remind you the machine was moved.