When trying to hot migrate a virtual server on a CloudBoot compute resource, the migration fails with an "error: internal error Attempt to migrate guest to the same host" message.
CloudBoot KVM compute resources
Before a migration starts, virsh check the UUID of the system by executing
virsh sysinfo. Additionally, it executes the same command on the host the virtual server will be migrated to. This is to avoid migrating to the same server in case of a cluster of compute resources.
virsh sysinforeturns for your compute resources:
[email@example.com ~]# dmidecode -s system-uuid 4C4C4544-0053-4C10-8038-B2C04F334831 [firstname.lastname@example.org ~]# dmidecode -s system-uuid 4C4C4544-0053-4C10-8038-B2C04F334831 [email@example.com ~]# dmidecode -s system-uuid 4C4C4544-0053-4C10-8038-B2C04F334831 [firstname.lastname@example.org ~]# dmidecode -s system-uuid 4C4C4544-0053-4C10-8038-B2C04F334831CODE
- As we can see, they all have the same UUID. In this case, it was Dell all in one 4x servers in one enclosure.
In a non-СloudBoot environment, we can simply specify the UUID in
/etc/libvirt/libvirtd.conf and restart
libvirtd. Another option is to apply the wrapper only (see how to download the wrapper in step 8).
virsh searches for
/usr in our CloudBoot images is a cramfs file system and mounts read-only.
The solution is to recreate
initrd with the wrapper and specify the UUID in
Go to the images directory:
cp initrd.img initrd.img.backupCODE
Create the directory where the original
initrdwill be unpacked:
mkdir -v /tftpboot/images/centos6/ramdisk-kvm/initrd.unpacked && cd /tftpboot/images/centos6/ramdisk- kvm/initrd.unpackedCODE
zcat ../initrd.img | cpio -idCODE
usrdirectory (it will be read-only):
mount -o loop usr.cramfs usrCODE
Copy the information of
usrto another location to be able edit and apply the changes (it is recommended to use the
rsync -av usr/ /tmp/cramfs-usr/CODE
Copy the real binary
cp usr/sbin/dmidecode sbin/dmidecode.origCODE
Download the wrapper, copy it to the temporary directory and give permissions to execute:
wget http://downloads.repo.onapp.com/dmidecode cp demidecode (This should be the wrapper) /tmp/cramfs-usr/sbin/dmidecode chmod +x /tmp/cramfs-usr/sbin/dmidecodeCODE
Again, from within the
/tftpboot/images/centos6/ramdisk-kvm/initrd.unpackeddirectory, umount the
usr.cramfsimage and delete it:
umount usr.cramfs rm -rf usr.cramfsCODE
usr.cramfswith the wrapper applied. It will create a
mkfs.cramfs /tmp/cramfs-usr/ usr.cramfsCODE
initrdand clean the
find . | cpio -H newc --quiet -o | gzip -9 > ../initrd.img.new && cd .. && mv -fv initrd.img.new initrd.imgCODE
Clean the files:
rm -rf /tmp/cramfs-usr/CODE
Add the following custom config to all compute resources. Create a UUID with uuidgen so that the UUIDs are different:
##uuid for libvirtd.conf## echo 'host_uuid = "BA7CC229-D375-410F-88E9-0A918DAA7120" ' >> /etc/libvirt/libvirtd.conf service libvirtd restart #####CODE
- Reboot the compute resources in order to load the new
initrdand custom config.
- Check that the new UUID is being used by
As you can see, the UUID in
libvirtd.conf is the same as the one we get when executing
[email@example.com ~]# tail /etc/libvirt/libvirtd.conf # sending any keepalive messages. # #keepalive_interval = 5 #keepalive_count = 5 # # If set to 1, libvirtd will refuse to talk to clients that do not # support keepalive protocol. Defaults to 0. # #keepalive_required = 1 host_uuid = "BA7CC229-D375-410F-88E9-0A918DAA7120" [firstname.lastname@example.org ~]# virsh sysinfo | grep uuid <entry name='uuid'>BA7CC229-D375-410F-88E9-0A918DAA7120</entry>
The same UUIDS on the compute resources. Before the migration starts, virsh checks the UUID of the system by executing
virsh sysinfo. Additionally, it executes the same command on the host that the VS will be migrated to. This is to avoid migrating to the same server in case of a cluster of compute resources.