ossobv / proxmove

Migrate virtual machines between different Proxmox VE clusters with minimal downtime
270 stars 31 forks source link

**NotImplementedError: format conversion from 'raw' not implemented** #43

Closed brosky closed 2 years ago

brosky commented 2 years ago

Hi,

Just trying your script, configured.. and trying to migrate a simple VM from one cluster to another:

root@pve7:~/proxmove# ./proxmove XXX pvedell pvedell1 nvme build-trafficserver  --no-verify-ssl
2022-05-10 11:07:07,634: WARNING: VM 'build-trafficserver--CLONING' exists on source already
2022-05-10 11:07:07,644: WARNING: VM 'build-trafficserver--CREATING' exists on destination already
2022-05-10 11:08:21,552: INFO: Attempt moving XXX<9f411e79> => pvedell<c743d6c1> (node 'pvedell1'): build-trafficserver--CLONING
2022-05-10 11:08:21,552: INFO: - source VM build-trafficserver--CLONING@pve<qemu/107/stopped>
2022-05-10 11:08:21,552: INFO: - storage 'ide0': local:107/vm-107-disk-0.raw,size=50G (host=50.0GiB, guest=50.0GiB)
2022-05-10 11:08:21,592: INFO: Begin copy of 'ide0' (local:107/vm-107-disk-0.raw,size=50G) to nvme (vm-145-disk-0)
2022-05-10 11:08:21,592: WARNING: FIXME: Non-zfs resume not implemented yet
2022-05-10 11:08:21,864: INFO: rsync(1) copy from '/var/lib/vz/images/107/vm-107-disk-0.raw' (on local) to 'root@pvedell1..local:/nvme/temp-proxmove/vm-145-disk-0'
vm-107-disk-0.raw
 53,687,091,200 100%  107.73MB/s    0:07:55 (xfr#1, to-chk=0/1)
Connection to pve.local closed.
2022-05-10 11:16:27,152: INFO: Temp data '/nvme/temp-proxmove/vm-145-disk-0' on nvme
Traceback (most recent call last):
  File "./proxmove", line 2308, in <module>
    main()
  File "./proxmove", line 2304, in main
    vmmover.run(options.dry_run)
  File "./proxmove", line 1940, in run
    self.move_vm(vm, translator, dry_run)
  File "./proxmove", line 1981, in move_vm
    self._move_vm_volumes(src_vm, dst_vm, move_mode=self.MOVE_FINAL)
  File "./proxmove", line 2073, in _move_vm_volumes
    requires_snapshot_support=(move_mode == self.MOVE_INITIAL))
  File "./proxmove", line 1439, in create_volume
    new_volume_name=new_volume_name)
  File "./proxmove", line 1668, in clone
    new_storage, new_vmid, new_volume_name)
  File "./proxmove", line 684, in copy
    disk_size, dst_temp, src_format, dst_id, dst_name)
  File "./proxmove", line 1052, in copy_from_temp
    src_format))
**NotImplementedError: format conversion from 'raw' not implemented**

Can some checks be implemented before doing any work ? - this transfer left me with a orphaned vm on destination and a stopped and renamed VM on source.

Thank you

wdoekes commented 2 years ago

Lots of checks are implemented, but apparently not the one that you're running into..

I agree that it's annoying to find out that it isn't implemented when at 90% of the work. That shouldn't happen.

What filesystem are you converting to?

wdoekes commented 2 years ago

I suspect this might fix your troubles:

diff --git a/proxmove b/proxmove
index 6051e4f..1208beb 100755
--- a/proxmove
+++ b/proxmove
@@ -1046,11 +1046,11 @@ class ProxmoxStoragePlain(ProxmoxStorage):

     def copy_from_temp(self, disk_size, src_temp, src_format, dst_id,
                        dst_name):
-        if src_format != 'qcow2':
+        if src_format not in ('qcow2', 'raw'):
             raise NotImplementedError(
-                'format conversion from {!r} not implemented'.format(
+                'format conversion from {!r} to plain not implemented'.format(
                     src_format))
-        dst_format = 'qcow2'
+        dst_format = src_format

         rel_path = os.path.join(
             str(dst_id), '{}.{}'.format(dst_name, dst_format))

But I haven't tested this. We've only used ZFS target filesystems for a while now.

wdoekes commented 2 years ago

@brosky : if you could test this and confirm whether it works for you, that'd be nice.