[SOLVED] Bug in 'vma create'?

Edi

New Member
Apr 17, 2015
11
0
1
Hello,

(tl;dr: vma create creates unusable vma files)

I run a VMWare ESXi- and an proxmox cluster. For exchanging virtual machines between these systems I tried the proxmox tool vma.

Extracting raw disks from proxmox backups and converting them with qemu-img to vmdk files works, the raw disks boot in ESXi when used in a newly created vm.

For transfering ESXi vms to proxmox I converted the vmdk with qemu-img zu a raw image and tried to create a vma file from this and a qemu-server.conf file. I always ended with an error when I tried to use qmrestore to create a new vm from this file.

To reproduce:


Freshly taken backup:
Code:
root@pve02# vma list vzdump-qemu-108-2015_04_15-09_59_54.vma
CFG: size: 319 name: qemu-server.conf
DEV: dev_id=1 size: 34359738368 devname: drive-virtio0
CTIME: Wed Apr 15 09:59:56 2015


root@pve02# vma extract vzdump-qemu-108-2015_04_15-09_59_54.vma vm108


root@pve02# ls -l vm108/
total 30237016
-rw-r--r-- 1 root root 34359738368 2015-04-16 15:13 disk-drive-virtio0.raw
-rw-r--r-- 1 root root         319 2015-04-16 15:01 qemu-server.conf

Now you have an extracted vma file, recreate it:
Code:
root@pve02:vm108/# vma create vm108.vma -c qemu-server.conf disk-drive-virtio0.raw

Now, list the new vma file
Code:
root@pve02:vm108/# vma list vm108.vma
CFG: size: 319 name: qemu-server.conf
DEV: dev_id=1 size: 34359738368 devname: disk0
CTIME: Fri Apr 17 18:39:38 2015

What has changed? Look at 'devname'... A restore fails now:
Code:
root@pve02:vm108/# qmrestore vm108.vma 112
restore vma archive: vma extract -v -r /var/tmp/vzdumptmp104866.fifo /mnt/pve/Backup01/vm108.vma /var/tmp/vzdumptmp104866
CFG: size: 319 name: qemu-server.conf
DEV: dev_id=1 size: 34359738368 devname: disk0
CTIME: Fri Apr 17 18:39:38 2015
command 'vma extract -v -r /var/tmp/vzdumptmp104866.fifo /mnt/pve/Backup01/vm108.vma /var/tmp/vzdumptmp104866' failed: archive does not contain data for drive 'virtio0'

Do I do something wrong, or is the tool buggy?

Regards,
Edi
 
Last edited:
Re: Bug in 'vma create'

I guess it complains about the missing vm.conf file in the backup file.

Err, no, it complains that it does not find the disk , because vma stores the disk as disk0 instead drive-virtio0.

The tool is not able to create a file from an export it did minutes ago. Or I am missing something...

Edi
 
Re: Bug in 'vma create'

In the confile the following will be written making restore possible:

bootdisk: <emulation>x
<emulation>x: <storage>:[<y>/]vm-<y>-disk-<z>.<format>,format=<format>,size=<sizeof disk>
 
Re: Bug in 'vma create'

Where can I find this file in a normal backup? I can't see one on my backup drives or in the vma file created by the backup.

A restore of the of the original vma file works properly, even without a vm.conf file anywhere.

regards, Edi
 
Re: Bug in 'vma create'

I know this from studying the source code for vma;)
If I remember correctly the vma stores the backup in a linked list of struct where the conf file is part of the struct.
 
Re: Bug in 'vma create'

Maybe I do not get your point, or I am missing something, but I still do not know what I shall do in my special case.

Where do I put that ominous file, and how should it look like, to get vma to create a file, that qmrestore can use?
 
Re: Bug in 'vma create'

vma list vzdump-qemu-102-2015_04_17-05_15_01.vma
CFG: size: 372 name: qemu-server.conf
DEV: dev_id=1 size: 17179869184 devname: drive-virtio0
CTIME: Fri Apr 17 05:15:02 2015

vma --help
usage: vma command [command options]


vma list <filename>
vma config <filename> [-c config]
vma create <filename> [-c config] pathname ...
vma extract <filename> [-r <fifo>] <targetdir>
vma verify <filename> [-v]



There is, again if I remember correct, a wiki explaining vma.
 
Re: Bug in 'vma create'

I know all this, and I read the wiki. The vma file I created contains the original conf file from the extract, as you can see in the original posting, please read again.
Can you please try my example from the original post, and if you can make qmrestore use the vma you created, then tell me what I did wrong. Use vma extract on your vma file, and then create a new vma file from the extracted files.

regards, Edi
 
Re: Bug in 'vma create'

The tool is not made to restore a manually prepared vma file like you do - this is simple not implemented.

Spoke too early, there is a way to to what you want. try:

# vma create vm108.vma -c qemu-server.conf virtio0=disk-drive-virtio0.raw
 
Re: Bug in 'vma create'

Spoke too early, there is a way to to what you want. try:

# vma create vm108.vma -c qemu-server.conf virtio0=disk-drive-virtio0.raw

Perfect, thank you, that was the missing hint. It would be helpful if you document this somewhere ;-)

Now:
Code:
root@pve02:/mnt/pve/Backup01/vm108# vma create vm108.vma -c qemu-server.conf drive-virtio0=disk-drive-virtio0.raw
The created vma looks good:
Code:
root@pve02:/mnt/pve/Backup01/vm108# vma list vm108.vma                          
CFG: size: 319 name: qemu-server.conf
DEV: dev_id=1 size: 34359738368 devname: drive-virtio0
CTIME: Sat Apr 18 10:55:14 2015

And it loads perfectly:
Code:
root@pve02:/mnt/pve/Backup01/vm108# qmrestore vm108.vma 112                     
restore vma archive: vma extract -v -r /var/tmp/vzdumptmp502421.fifo /mnt/pve/Backup01/vm108/vm108.vma /var/tmp/vzdumptmp502421
CFG: size: 319 name: qemu-server.conf
DEV: dev_id=1 size: 34359738368 devname: drive-virtio0
CTIME: Sat Apr 18 10:55:14 2015
new volume ID is 'Ceph01:vm-112-disk-1'
map 'drive-virtio0' to 'rbd:rbd/vm-112-disk1:mon_host=[ceph details omitted]' (write zeros = 0)
progress 1% (read 343605248 bytes, duration 2 sec)
[...]
progress 100% (read 34359738368 bytes, duration 814 sec)
total bytes read 34359738368, sparse bytes 3397332992 (9.89%)
space reduction due to 4K zero bocks 0.405%

Now I can do some scripting to move vms from VMWare ESXi to proxmox (and vice versa, see above).

Thanks,
Edi
 
I run a VMWare ESXi- and an proxmox cluster. For exchanging virtual machines between these systems I tried the proxmox tool vma.

Extracting raw disks from proxmox backups and converting them with qemu-img to vmdk files works, the raw disks boot in ESXi when used in a newly created vm.

For transfering ESXi vms to proxmox I converted the vmdk with qemu-img zu a raw image and tried to create a vma file from this and a qemu-server.conf file. I always ended with an error when I tried to use qmrestore to create a new vm from this file.

Sorry I missed why you need the vma at all. You could do just the reverse disk conversion from vmdk to raw or qcow2 or even just use the vmdk in proxmox, since it's supported. And when the vmdk is running in proxmox, you can convert it online (live) with the move disk feature, eve from the gui... I did so converting vmdk from an old vmware server. I transferred vmdk to proxmox, created similar vm conf through gui, booted... just worked... ? why the special need for vma only in the esxi -> proxmox direction?

Marco
 
Hi,

sounds interesting! How can I load vmdk in proxmox? The wiki says I have to convert it to raw and dd it into a disk file of an existing vm. I haven't found a way to attach an existing disk image when creating a vm. Have I missed something?

What I want to achieve is a simple way to load a vm from VMware to proxmox for disaster recovery when my VMware dies. I want to create backups from VMware vms and script them so they can be loaded into proxmox with one click like proxmox backups do. And vice versa.

regards, Edi
 
Well, if you try to create a new vm in proxmox, you should see that when you have to choose an hard disk option, you have three choices: qcow2, raw, vmdk.
Simply put, you could just run your vmdk in proxmox, you just need to tell your config to use it.

It is not the preferred choice for most users, since
- raw is the fastest
- qcow2 supports live snapshots

but as I said before, once you are running your vmdk, you can convert it (and also change storage) live, with the great move disk feature, from the vm gui (look at the vm hardware tab)
if all goes well, then your vm config will be automatically updated to use the new disk. the old disk may be deleted or kept, unused, it's your choice.

under the hood, proxmox uses the qemu-img conversion tool which can convert from and to many formats...

btw, also the display vm config offers a "vmware compatible" setting, this could help you also.

So, if your vmware server has the vmdk on a drive shareable with proxmox (not at the same time, for safety), you could prepare to "disaster" creating a vm in proxmox which could just use the same vmdk from that drive (networked and redundant, perhaps). Or, you could think of another setup.

If you need to transfer (or copy) the vmdk to a proxmox storage, there is no gui way to do this, you have to go cli (ssh) and use cp, scp, rsync, whatever.
when you create a new vm, proxmox assigns automatically to your VM a virtual disk named lik the VMID itself... you coudl replace it with your vmware disk or edit your .conf to use your whatever named virtual drive

I hope it is clearer, now.

Marco
 
Last edited:
Thank You for the explanation! I overlooked the vmdk-Support completely. I use ceph as storage backend which only supports raw images...

So, if your vmware server has the vmdk on a drive shareable with proxmox (not at the same time, for safety), you could prepare to "disaster" creating a vm in proxmox which could just use the same vmdk from that drive (networked and redundant, perhaps). Or, you could think of another setup.

I still haven't found how I can add an _existing_ disk file (in any format) to a proxmox vm.

I've added a NFS storage shared by VMWare and proxmox to my setup and created a VMWare-vm on it. But I cannot select the existing vmdk disk file in proxmox gui, neither when creating a vm, nor when adding a new disk to a vm. What a I missing now?

Thanks for your help,
Edi
 
Thank You for the explanation! I overlooked the vmdk-Support completely. I use ceph as storage backend which only supports raw images...
I still haven't found how I can add an _existing_ disk file (in any format) to a proxmox vm.
I've added a NFS storage shared by VMWare and proxmox to my setup and created a VMWare-vm on it. But I cannot select the existing vmdk disk file in proxmox gui, neither when creating a vm, nor when adding a new disk to a vm. What a I missing now?
Thanks for your help,
Edi

I suggest you to start simple: create a test proxmox vm and choose the smallest vmdk disk (say, 1GB), choose the "shared storage" as storage.
look at where it is and how it's named.

say 123 is your VM VMID.
your new 1gb empty vmdk disk should be <storagename>:/123/vm-123-disk-1.vmdk

keep the vm halted. replace that disk with yours, keeping the same name.

so vm-123-disk-1.vmdk is now your real vmdk previously used in vmware. just make sure it is a real, flat vmdk disk type, all snapshots applied.

this name (and storage/path) is kept in proxmox in
/etc/pve/qemu-server/123.conf

(if the storage is "local" (referred to the node), the folder is /var/lib/vz/images/<VMID>/)

acting manually on the .conf, you could add any disk on any locally mounted folder or storage. keeping that name syntax just helps when you have many VM.
the gui helps making choices and speeds up a abit, but really does just the same thing: edit your 123.conf.

If you wish to use ceph, you could start the vm with vmdk and then "move disk", live, to raw on that ceph storage. It should work also on ceph, AFAIK, it works with any storage and disk type.
If you get errors, just retry, or maybe try to change bus to IDE, I heard sometmes other may fail, atm. A few times it happened to me, I just retried and it worked.

...I feel we're just going a little OT on this thread...

Marco
 
Last edited:
I'm aware this is a really old thread but I just wanted to say the explanation about vma syntax should be included in the wiki. It's poorly documented here and someone might come into the issue(like I just did) this is great btw I was able to "create" my own backup and restore it to a zfs-over-iscsi storage. Btw zfs-ove-iscsi is another thing that could be better documented, things like manually importing a VM disk into a zfs-over-iscsi storage would be a world useful, I'd be willing to help update the wikis if need be.
 

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 yours easily in our online shop.

Buy now!