Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running a Ubuntu Server with Xen 4.1 installed. All VMs are running on that server with one or more virtual disks stored in qcow2 format. These VMs are managed by 'xl' toolstack. One VM is Windows in HVM modes and others are PV VMs. The qcow2 file just contains the root filesystem and has no partition structures.

Now I installed a new server with XCP 1.6. Is there anyway for me to migrate these VMs to XCP? Thanks in advanced.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Just to close the loop on this: an answer to Lingfeng's question was provided in a thread on the xen-api mailing list. Here is James Bulpin's answer:

One way would be to, for each VM:

  1. Convert each qcow2 file to a raw file using qcow2raw ' put these files somewhere (e.g. a NFS export) where you can temporarily reach them from XCP's domain0

  2. Using XCP 'install' a VM using the most suitable template but not actually starting the VM or going through the install. Make sure to choose virtual disk sizes at least as big as the virtual size of the original qcow2 ones. Set virtual NIC MAC addresses to match your xl VM. 'For PV you'll need to trick XCP into thinking you've completed the install by

    a. changing PV-bootloader to pygrub (xe vm-param-set uuid= PV-bootloader=pygrub)

    b. making the first VBD bootable (xe vbd-param-set uuid=$(xe vbd-list vm-uuid= userdevice=0 --minimal) bootable=true)

    c. making the virtual CD drive (if present) not bootable: (xe vbd-param-set uuid=$(xe vbd-list vm-uuid= type=CD --minimal) bootable=false)

  3. One by one attach the VM's virtual disks to dom0 ' my preferred way is to:

    a. Find the VDI's UUID by using 'xe vm-disk-list uuid=' ' look for e.g. 'Disk 0 VDI'

    b. Run '/opt/xensource/debug/with-vdi ' ' this attaches the VDI to dom0 as /dev/$DEVICE and drops you into a shell ' exiting this shell will detach the VDI

  4. Use /opt/xensource/libexec/sparse_dd to dd the contents of the raw file (from step 1) to the VDI.

    a. E.g. /opt/xensource/libexec/sparse_dd -src /mnt/MyVM.img -dest /dev/$DEVICE -size 8589934592 -prezeroed

  5. Exit the 'with-vdi' shell

I've tried this for a xl PV VM I have and it worked (I started from raw image rather than qcow2 so skipped step 1). My test also differs in that root is on xvda1 however your case should be fine ' IIRC pygrub is OK with root on the raw device.

share|improve this answer
    
I forgot to close this question :-) BTW: I believe my own reply to James' answer is better LOL –  Lingfeng Xiong Jan 31 '13 at 17:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.