Migrate VM from Xen to Proxmox

leolage

New Member
May 14, 2021
9
0
1
42
wget --no-check-certificate --http-user=root --http-password=PASWORD xttps://192.168.1.4/export?uuid=$1 -O - | tar --to-command=./xva-conv.sh -xf -
Hi,

When I run this command to write virtual disk, return a lot of erros and never finish... the disk is full before command is completed. Size of disk in XCP is 100GB but when disk of proxmox is full the Ref file generated has 1TB of size, do you already see this errors on script?


xpr: non-integer argument
/tmp/xen-to-pve/xva-conv.sh: line 33: [: -eq: unary operator expected
expr: non-integer argument
- [ <=> ] 1.29G 23.0KB/s cat:
/tmp/xen-to-pve/xva-conv.sh: line 33: [: 00004815.xxhash: integer expression expected
expr: non-integer argument
expr: non-integer argument
/tmp/xen-to-pve/xva-conv.sh: line 33: [: -eq: unary operator expected
expr: non-integer argument
/tmp/xen-to-pve/xva-conv.sh: line 33: [: 00004816.xxhash: integer expression expected
expr: non-integer argument
 

Alessandro 123

Active Member
May 22, 2016
647
23
38
38
I did a (much) better version if you would like to try. It doesn't have to extract nothing, it dumps the full VM to the ZFS pool on PVE.
 

Alessandro 123

Active Member
May 22, 2016
647
23
38
38
Try the v2 branch: https://github.com/guestisp/xen-to-pve

Tested for about 4 VM transfers on my local server, all perfect. But I did some changes when publishing on github (just to remove hardcoded user/pass and so on) so please try it on a sandbox.

Keep in mind that this will WRITE directly to the storage, if something is wrong you could loose data.
 

Alessandro 123

Active Member
May 22, 2016
647
23
38
38
Next step (atm I don't have time): add named arguments like `--uuid` `--host` and so on and not rely on arguments position
 

leolage

New Member
May 14, 2021
9
0
1
42
Alessandro, your script is awesome!

I have one stranger error, and not found the reason...

about the arguments --uuid --host your script dont need it, but need receive data in correct order...

When I used your script I do one change:


qm set ${VM_ID} -virtio${CNT} local-zfs:${SIZE_GB},cache=writeback
changing local-zfs to my zfs partition name in pve

The process is very fast (3-5 seconds), probably the data to new disk is not copied, and I received this return:

Starting migration of XenServer "03db476f-3577-68d0-9d52-2efb81ce7612" to ProxMox #150
xvda:527f4b5f-c0e7-4905-b574-bb695ed8e2bb:42949672960
Exporting device xvda with UUID 527f4b5f-c0e7-4905-b574-bb695ed8e2bb. Size=40. Disk #0
update VM 150: -virtio0 zfs-sas:40,cache=writeback
Disk not found: /dev/zvol/rpool/data/vm-150-disk-0

I my server I dont found this "block device" folder /dev/zvol/rpool/data/, I need to change it to another folder?


BLOCK_DEVICE="/dev/zvol/rpool/data/${DISK_NAME}"
 

leolage

New Member
May 14, 2021
9
0
1
42
Alessandro, your script is awesome!

I have one stranger error, and not found the reason...

about the arguments --uuid --host your script dont need it, but need receive data in correct order...

When I used your script I do one change:


qm set ${VM_ID} -virtio${CNT} local-zfs:${SIZE_GB},cache=writeback
changing local-zfs to my zfs partition name in pve

The process is very fast (3-5 seconds), probably the data to new disk is not copied, and I received this return:

Starting migration of XenServer "03db476f-3577-68d0-9d52-2efb81ce7612" to ProxMox #150
xvda:527f4b5f-c0e7-4905-b574-bb695ed8e2bb:42949672960
Exporting device xvda with UUID 527f4b5f-c0e7-4905-b574-bb695ed8e2bb. Size=40. Disk #0
update VM 150: -virtio0 zfs-sas:40,cache=writeback
Disk not found: /dev/zvol/rpool/data/vm-150-disk-0

I my server I dont found this "block device" folder /dev/zvol/rpool/data/, I need to change it to another folder?


BLOCK_DEVICE="/dev/zvol/rpool/data/${DISK_NAME}"
update:
I found 2 paths of the disk file, I will try to change the BLOCK_DEVICE path for these:


root@pve-bh:/# find -name vm-150-disk-0
./dev/zvol/zfs-sas/vm-150-disk-0
./dev/zfs-sas/vm-150-disk-0

I will send news soon...
 

leolage

New Member
May 14, 2021
9
0
1
42
Works fine here! Thanks Alessandro.

I only need to change 2 lines in your script:

local-zfs on line 49 to my zfs storage name
path of my zfs folder in line 57, in my case now is: BLOCK_DEVICE="/dev/zvol/zfs-sas/${DISK_NAME}"

Thanks for help!
 

Alessandro 123

Active Member
May 22, 2016
647
23
38
38
Works fine here! Thanks Alessandro.

I only need to change 2 lines in your script:

local-zfs on line 49 to my zfs storage name
path of my zfs folder in line 57, in my case now is: BLOCK_DEVICE="/dev/zvol/zfs-sas/${DISK_NAME}"

Thanks for help!

yes, that's expected, as I wrote the script for my environment.
Would be nice to automate the change, how can I know the storage path in use ? Should I read the value somewhere ?
 

leolage

New Member
May 14, 2021
9
0
1
42
can you please share the content of "/etc/pve/storage.cfg" ?
dir: local
path /var/lib/vz
content backup,vztmpl,iso

lvmthin: local-lvm
thinpool data
vgname pve
content images,rootdir

dir: nvme
path /nvme
content images
prune-backups keep-all=1
shared 0

zfspool: zfs-sas
pool zfs-sas
content images,rootdir
mountpoint /zfs-sas
sparse 0
 

leolage

New Member
May 14, 2021
9
0
1
42
I suggest 2 changes,

1- name of storage in parameters of your script

2- In block storage, probably /dev/ + namestorage + diskname is fine.. I'm novice in proxmox, in my case work: /dev/zfs-sas/vm-101-disk-0
zfs-sas is name of my storage and vm-101-disk-0 is name of disk (your script already get this)

I can help to edit script if you need.
 

Alessandro 123

Active Member
May 22, 2016
647
23
38
38
Pull requests are welcome :)

Atm, i think the most useful change would be to remove the XS tool requirement but i wasnt able to call the xenserver api...
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!