libvirt manual migration

Following scenario:

You have 2 servers. No shared storage.
You would like to move VMs from Server A to Server B.

If you want a clean filesystem there will be downtime.
Downtime will take as long as it needs to copy the image from one server to the other.

Step 1:

Shutdown the instance running on the source server.
e.g.

Step 2:

Copy the image, usually located in /var/lib/libvirt/images/ , from source to destination.
e.g.

Step 3:

Dumo the configuration xml of your vm and copy it to the destination server
e.g.

This will copy domain.name.xml to the home directory of the destination server, in this case /root/ (implied by the : after the server name)

Step 4:

Import the copied xml domain configuration on the destination server.
The MAC address probably changed, depending on your data center’s setup you’d need to edit the xml file accordingly.
The domain import command is

Step 5:
Finish it up.
Change network configuration from inside the guest.
You will need to login via spice console.
It’s best to use the great tool “Virtual Machine Manager” for this job.
Remember to keep your VM’s root password ready.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.