[SOLVED] Question about import VM's from Xen

thehc

Member
Feb 5, 2020
2
0
21
31
Hello everyone!

I am new on this forum, now i plan migration all my servers/vm from xen to Proxmox.

I have question about import Xen VM's into Proxmox, now i use this command:

Code:
 qm create 105 --name some_vm --acpi 1 --agent 1 --bios seabios --boot cdn --bootdisk virtio0 --onboot yes --cores 4 --memory 4096 --net0 virtio=32:a3:ca:cd:67:36,bridge=vmbr0 && cd /tmp/xen-to-pve && wget --http-user=root --http-password=xxx http://xenserver3.local/export?uuid=bd518f29-10bd-21da-65a1-1f1dd46f1c48 -O - | tar --to-command=./xva-conv.sh -xf - && mv Ref* 105.raw && qm importdisk 105 105.raw local_ssd && rm 105.raw -f && qm set 105 --virtio0 local_ssd:vm-105-disk-0

And it's working OK but if i have Xen VM with 2 or more virtual disk attached this command ends with this error:

Code:
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘STDOUT’

-                                                        [                   <=>                                                                                                ]   5.34G  3.83MB/s    in 6m 41s

2020-02-05 09:20:16 (13.6 MB/s) - written to stdout [5735767552]

mv: target '105.raw' is not a directory

In Proxmox imported VM has not have attached any disk and not started.
How I can properly import Xen VM's with more than 1 virtual disk attached?

PVE version: 6.1-3
 
Last edited:
First of all, there is an article about migration on our Wiki, but take it with a grain of salt. Parts of it are quite old.

The problem seems to be that you want to "mv" multiple files into one. If you could export an .OVF from Xen, you can directly import it into Proxmox VE using "qm importovf". This is similar to the VMware V2V section in the article.
 
Hi Dominic thanks for your reply.

You're right

I solved this problem and i will write my method for all users who migrate xen vm's to proxmox, I solved this problem in this way:

Basic export/import command look's like:
Code:
qm create 105 --name some_vm --acpi 1 --agent 1 --bios seabios --boot cdn --bootdisk virtio0 --onboot yes --cores 4 --memory 4096 --net0 virtio=32:a3:ca:cd:67:36,bridge=vmbr0 && cd /tmp/xen-to-pve && wget --http-user=root --http-password=xxx http://xenserver3.local/export?uuid=bd518f29-10bd-21da-65a1-1f1dd46f1c48 -O - | tar --to-command=./xva-conv.sh -xf - && mv Ref* 105.raw && qm importdisk 105 105.raw local_ssd && rm 105.raw -f && qm set 105 --virtio0 local_ssd:vm-105-disk-0

In background it creates 2 Ref * files which are 2 disk files, it then tries to put on one disk (in Proxmox) and it ends with error like below
Code:
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘STDOUT’

-                                                        [                   <=>                                                                                                ]   5.34G  3.83MB/s    in 6m 41s

2020-02-05 09:20:16 (13.6 MB/s) - written to stdout [5735767552]

mv: target '105.raw' is not a directory

The solution is split this command into two commands:

1st command to create VM in Proxmox, export VM from Xen and unpack .xva file:

Code:
qm create 105 --name some_vm --acpi 1 --agent 1 --bios seabios --boot cdn --bootdisk virtio0 --onboot yes --cores 4 --memory 4096 --net0 virtio=32:a3:ca:cd:67:36,bridge=vmbr0 && cd /tmp/xen-to-pve && wget --http-user=root --http-password=xxx http://xenserver3.local/export?uuid=bd518f29-10bd-21da-65a1-1f1dd46f1c48 -O - | tar --to-command=./xva-conv.sh -xf -

after finish we import first Ref* file which is bootable disk:
Code:
mv Ref\:6676.raw 105.raw && qm importdisk 105 105.raw local_ssd && rm 105.raw -f && qm set 105 --virtio0 local_ssd:vm-105-disk-0

and second Ref* file which is additional disk:
Code:
mv Ref\:6672.raw 105.raw && qm importdisk 105 105.raw local_ssd && rm 105.raw -f && qm set 105 --virtio1 local_ssd:vm-105-disk-1

Now we can run VM on Proxmox, but after first startup we must use bootable iso with linux distro and rebuild initramfs.
After that we can normally boot from vm-disk and it should properly startup.

Best Regards!