Migrate Xen 4 Dom U to Xen 6

The engineering maxim “If it’s not broken, don’t fix it” gave me guidance to leave my Xen 4 systems alone, and now, years later, I’m in the situation where most of my production servers are ‘left behind’ on Xen v4, and need to be migrated to the newest version of Xen 6.x

There are many reasons to update the systems, or at least migrate them forward:

  • I bought a new, faster server that uses less power.
  • The XenCenter app from Citrix does not connect to Xen 4 dom0.
  • I would like to move to a ‘uniform revision level’ across my 4 dom0 systems
  • Centos 7 is not supported in earlier Xen versions
  • Speed and other updates to the Xenserver hypervisor
  • Many of my servers need to be updated, to take advantage of newer versions of PHP, and MySql

If you haven’t noticed recently, Google search results have a lot of noise in them… links to sites promoting various commercial offerings which do not answer the question I am researching.

Try searching for instructions on how to do this migration… lots of noise and not many any answers.

I did find one link on how to convert a Xen 4 domU to a Xen 6.x domU:

https://xen-orchestra.com/blog/migrate-from-xen-to-xenserver/

I’ll walk you through the details on my experience:

I started out with one of my internal servers that does not get a lot of use or traffic… my wiki server – wiki-2. It’s on a Xen 4 dom0, and is running Centos 5, and I’d like to update and migrate to a new server  running Xen 6.5 on updated hardware.

Here is what I did to accomplish that:

  1. On the Xen 4 dom0, stop my wiki server.

  2. Download the conversion and migration script
    from here: http://www-archive.xenproject.org/files/xva/  . The script is actually at this link: http://www-archive.xenproject.org/files/xva/xva.py  and the explanation of how to use the script, with a couple of examples is on this page: http://www-archive.xenproject.org/files/xva/README  2016-03-05: Download the xva.py script here: xva.py

  3. I ran into a couple of problems, and here’s how I solved them:

After running the command:
'./xva.py -c /etc/xen/wiki-2 -n wiki-2 -s 192.168.0.78 --username=root --password="xxxxyyy!#%&"
 kernel /var/lib/xen/boot_kernel.2FDB_I does not exist
 usage: xva.py [options]
 xva.py: error: Error with kernel'

I decided to look into the config file for the wiki-2 domU, and saw this:

cat /etc/xen/wiki-2
name = "wiki-2"
uuid = "ffeb4e6c-2757-0d9a-9274-8bd4d55a96a8"
maxmem = 1536
memory = 512
vcpus = 1
bootloader = "/usr/bin/pygrub"
kernel = "/var/lib/xen/boot_kernel.2FDB_I"
ramdisk = "/var/lib/xen/boot_ramdisk.4G1LOW"
extra = "ro root=/dev/VolGroup00/LogVol00 rhgb quiet"
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
vfb = [ "type=vnc,vncunused=1,keymap=en-us" ]
disk = [ "tap:aio:/mnt/claudia-1/wiki-2.img,xvda,w" ]
vif = [ "mac=00:16:36:1d:b0:f7,bridge=brLan0,script=vif-bridge,vifname=WikiLan" ]

Somehow, over the years, the ‘kernel’ and ‘ramdisk’ line were added into the config file, and the conversion script did not like them.

I decided to make a backup copy of the config file, and then remove those two lines. In order to test to see if those lines were mandatory, I restarted the wiki-2 machine using the edited file, all went well. I stopped the wiki-2 machine again, and retried the conversion script.

./xva.py -c /etc/xen/wiki-2 -n wiki-2 -s 192.168.0.78 --username=root --password="xxxxyyy!#%&"
VM Details:
Name: wiki-2
Type: Paravirtualised
VCPUS: 1
Memory(bytes): 536870912
ACPI: true
APIC: true
PAE: true
NX: false
Viridian: true
Disk xvda(Bootable): /mnt/claudia-1/wiki-2.img
Connecting to target 192.168.0.78

Processing disk /mnt/claudia-1/wiki-2.img(14680064000 bytes)
Unauthorised response from server. Exiting

This time I got the ‘Unauthorised response from server. Exiting’ error.

It looked like the script got further, and there was an issue of logging into the Xen 6.X server…

It turns out that the password had some characters in it that did not work with the script, specifically one of the following: ! # % & …

I changed the root password for the target server (Xen 6.X) to something like this… ‘password1’ and retried the script:

./xva.py -c /etc/xen/wiki-2 -n wiki-2 -s 192.168.0.78 --username=root --password="password1"
VM Details:
Name: wiki-2
Type: Paravirtualised
VCPUS: 1
Memory(bytes): 536870912
ACPI: true
APIC: true
PAE: true
NX: false
Viridian: true
Disk xvda(Bootable): /mnt/claudia-1/wiki-2.img
Connecting to target 192.168.0.78

Processing disk /mnt/claudia-1/wiki-2.img(14680064000 bytes)
[ ########################################################################### ] 100% 

VM Successfully streamed

It took about 20 minutes to migrate and transfer the wiki-2 machine to the new Xenserver 6.X server.

Then, using Xen Orchestra web based control panel, or the XenCenter windows application from Citrix, (it’s bundled with the Xenserver download), or using the xsconsole from the command line of Xenserver 6.x server, start up the wiki-2 machine in Xenserver 6.X

I noticed that the network connections had been changed to DHCP in the  conversion process. After changing the IP address back to the original, fixed IP address of the pre-migrated wiki-2 machine, I had to connect the post-migrated wiki-2 machine network settings to bridge to the proper network connection on the Xenserver 6.X dom0, and reconfigure some fixed routes.

When done, install ‘xentools’ from the xencenter application.

All is migrated, and working as desired.

 

 

 

5 thoughts on “Migrate Xen 4 Dom U to Xen 6

  1. Thanks for the details. One small note if you get the “Internal Error. Possible problem: Please make sure you have enough space on your default SR” you can try to add –filename=xxx.xva option to the command line.

  2. I have the same problem but in my case I want to migrate a VM under debian 6 squeeze to Citrix XenServer 7.0

    Server A: Xen 4.0
    Server B: Citrix XenCenter 7.0

    I’ve tried using the method you indicate but I have not been successful

    ————————–
    Xen 4.0

    script: xva.py v1.2.1

    command: ./xva.py -c /var/xen/ldap01.cfg -n ldap -s 172.16.15.76 –username=root –password=1234567890

    VM Details:
    Name: ldap01
    Type: Paravirtualised
    VCPUS: 1
    Memory(bytes): 1048576000
    ACPI: true
    APIC: true
    PAE: true
    NX: false
    Viridian: true
    Disk xvda(Bootable): /var/xen/domains/ldap01/swap.img
    Disk xvdb: /var/xen/domains/ldap01/disk.img
    Connecting to target 172.16.15.76

    Processing disk /var/xen/domains/ldap01/swap.img(268435456 bytes)
    [ ########################################################################### ] 100%
    Processing disk /var/xen/domains/ldap01/disk.img(5368709120 bytes)
    [ ########################################################################### ] 100%

    VM Successfully streamed

    ————————–
    Citrix XenServer 7.0

    When I start VM ldap01 throws the following error:: Alert! /dev/xvda2 does not exist. Droping to a shell!

    VM config file
    kernel = ‘/boot/vmlinuz-2.6.32-5-xen-amd64’
    ramdisk = ‘/boot/initrd.img-2.6.32-5-xen-amd64’
    vcpus = ‘1’
    memory = ‘1024’
    root = ‘/dev/xvda2 ro’
    disk = [
    ‘file:/var/xen/domains/ldap01/disk.img,xvda2,w’,
    ‘file:/var/xen/domains/ldap01/swap.img,xvda1,w’,
    ]
    name = ‘ldap01’
    vif = [ ‘ip=172.16.15.157,mac=00:16:3E:2F:9E:A2,bridge=xenbr0’ ]
    on_poweroff = ‘destroy’
    on_reboot = ‘restart’
    on_crash = ‘restart’

    ¡Help!

    • It looks like xen7 can’t find the /dev/xvda2… can you verify that it exists, and has the size you would be expecting?
      Also, can you try opening in xen6? and then save and open in xen7?