[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] Anyway to migrate my VM from Xen xl to XCP?



Hi James, Torsten and Denis,
Thanks all of you for your kindly reply!
I just use some little tricks to easily migrated my VMs. Before I describe my solution, here's my old xl VMs' configurations:

1. All Linux VM's are PV VM (not pygrub). They are running under old-fashion kernel/initramfs/rootfs configuration
2. One Windows VM is a HVM guest with GNU PV drivers installed.
3. New XCP SR is created as NFS VHD.

And the solutions is:
1. Convert qcow2 image to VHD files with
qemu-img convert xxxxx.qcow2 -O vpc xxxxx.vhd
2. Create a VM with same or similar OS templates in XenCenter or directly in XCP. Don't boot it.
3. Query the corresponding VDI for the VM you just created
4. In NFS SR, replace the {VDI-UUID}.vhd with the xxxxx.vhd you just converted 5. For HVM guest, just boot it from XenCenter/XCP. For PV guests, ssh into Dom0 and configure correct PV-kernel and PV-ramdisk.
5. Boot the VM in XenCenter/XCP.

I just use this method to migrate all my VMs to my new XCP server :-)

But it comes some interesting problems...
1. All PV VM's consoles are inaccessible. I can ssh into those VMs, but in XenCenter's console page, it just frozen when it booted. The last lines I can see are:

> Loading, please wait...
> [    0.380179] udevd[85]: starting version 175
> Begin: Loading essential drivers ... done.
> Begin: Running /scripts/init-premount ... done.
> Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
> Begin: Running /scripts/local-premount ... done.
> [ 5.538216] EXT4-fs (xvda): mounted filesystem with ordered data mode. Opts: (null)
> Begin: Running /scripts/local-bottom ... done.
> done.
> Begin: Running /scripts/init-bottom ... done.
> mountall: Disconnected from Plymouth

I can neither see the login prompt nor type in anything into console.

2. The HVM Windows Server 2012 guest show BSOD during booting. I cannot enter the system completely... :-(

Hope you guys can give me some clues..
Thanks in advanced.

On 1/25/2013 1:32 AM, James Bulpin wrote:
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=<vmuuid> 
PV-bootloader=pygrub)

b.      making the first VBD bootable (xe vbd-param-set uuid=$(xe vbd-list 
vm-uuid=<vmuuid> 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=<vmuuid> 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=<vmuuid>â â look for e.g. 
âDisk 0 VDIâ

b.      Run â/opt/xensource/debug/with-vdi <vdiuuid>â â 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.

Cheers,
James

From: xen-api-bounces@xxxxxxxxxxxxx [mailto:xen-api-bounces@xxxxxxxxxxxxx] On 
Behalf Of Lingfeng Xiong
Sent: 24 January 2013 05:25
To: Xen-api@xxxxxxxxxxxxx
Subject: [Xen-API] Anyway to migrate my VM from Xen xl to XCP?

Hi all,

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.  I have to migrate all VMs from old 
server to XCP with all data.

Is there anyway to do this?

Thanks in advanced!


_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.