Thursday, April 7, 2011

Xen: Duplicate MAC addresses/UUID's

I have not quite gotten to the point of using the migrate feature with virt-manager to try and get an image file from one server to another, but rather I have done an scp of the domU image and its config file.

However, if you have done this once already you will run into several problems with having a duplicate MAC address and a duplicate uuid. To solve these two issues you can do the following:

new random MAC address:
import random
mac = [ 0x00, 0x16, 0x3e,
 random.randint(0x00, 0x7f),
 random.randint(0x00, 0xff),
 random.randint(0x00, 0xff) ]
print ':'.join(map(lambda x: "%02x" % x, mac))

new uuid:
in centos you can run 'uuidgen' to get a new uuid.

Take these two pieces of information and edit the domU configuration file. Of course you will also need to make sure that you change the name of the domU as well.

Steps:
scp -p domU.img username(root?)@ip:/location(e.g. /var/lib/xen/images/domU.img)
scp -p domU username(root?)@ip:/location(e.g. /etc/xen/domU)

vim domU[config]
name = "[domU Name]"
uuid = "[new uuid]" (e.g. E793FDB1-7180-4AE8-92EC-742D48335058)
...
vif = "[ mac=[new MAC address],...]" (e.g. 00:16:3e:17:dd:0c)

save and quit, and your new domU should be ready to start.

No comments:

Post a Comment