Clone existing image between two different datastores

Hi all I’m trying to clone an existing image to a new datastore but I’m getting this error

[one.image.clone] Clone only supported to same DS_MAD Datastores

could someone tell me if there is a workaround to solve this problem?


**Steps to reproduce:Goto Images -> select an image-> click on Clone

**Current results: [one.image.clone] Clone only supported to same DS_MAD Datastores

**Expected results: Image cloned in the selected Datastore

Hi @Bart_11

I already opened a case (via our support) to OpenNebula.
An issue on GitHub already exists: https://github.com/OpenNebula/one/issues/3243

However there is no target date for that.

You can +1 this feature too :).

Hi @jpfoures, thanks for your reply. I will put a +1 to that feature and let’s see if something will happen.

Hi @Bart_11

thanks!

As a workaround, if you use KVM as virtualization system, you can “play” with “qemu-img” to copy an image from a datastore to another one.
Here is a pseudo protocol:

  1. Perform a disk saveas of the image you want to “clone”
  2. If you can browse in the datastore directly, you can use qemu-img convert to copy the “saved as” image to another place (the other datastore or another place)
  3. If you cannot browse in the datastore, you can mount on a “powered off” VM the “saved as” image and then you can use qemu-img convert on the host hosting the VM
  4. Then you can create a new image on the targeted datastore providing the “path” the image on the datastore or by uploading it (if possible)

Hope this help

Hi @jpfoures,
thanks for the suggestion. Is it possible to follow your steps only using the CLI? because using the GUI when I select the image I would like to clone I can’t see any “save as” option. I’m using ON5.4.6

Hi,

I am not really sure, “disk saveas” came with 5.6. I use 5.8.3 cluster and the workaround I gave details is based on that release.

With CLI you cannot perform qemu-img commands, these commands are only possible on KVM nodes.
If you can power off the VM, you do not need to clone or saveas the disk. You can use directly qemu-img command.
If you can’t stop the VM, you can try too, but because the disk is used you might have an issue on the new image.

Regards