A few questions came up through Twitter about how to migrate storage configurations from one data store to another. I figure the best place to follow up and share this information is here in the Developers’ Forum.
This functionality is currently available for KVM hypervisors. For vCenter support, it will be included in the upcoming v.5.8 “Edge” release.
Here are the details for KVM:
Hope this is helpful!
I just got this question:
“I just want to move the “harddisk” of the vm from say datastore id 1 (local) to datastore id 106 (some ceph cluster) .”
Answer: You can keep it in the same host (same hostid) and just specify a new datastore ([datastoreid]).
thanks for noticing that there are many people who don’t yet know how to use this.
I think a complete example would be better, unfortunately I also don’t got the time to do it.
maybe it helps if I at least indicate what I mean…
Things that would make up a complete example:
- onevm show of the vm, indicating the original image
- oneimage show of the image
- onevm migrate … with the actual parameters and the output
- what it looks like if it fails (i.e. if i run it against some unsupported datastore/image type)
- hints about where errors are logged if it goes wrong
- onevm show output, indicating the exact spot and output it would show if it worked
- oneimage show output, indicating the exact spot and output it would show if it worked
- details about conditions that can cause it to fail, and conditions where it could be safely retried
(Why all those steps: The onevm man page is good reference documentation - helpful, but not something that you can verify your own results against.
As is every user still has to do the guesswork and bears the risk of making errors without knowing they do so)
Sorry for hijack but is there anyway to migrate images from one datastore to another?
Currently we need to migrate not only VMs but also images to new datastore, we can clone images to new datastore however migrated VMs still point to the images in old datastore and we can not remove the old datastore.
There is no option to migrate an image.
You can clone the image to the new datastore and the update the VM template, so the new VMs will be able to use that cloned images.
If you migrate the VM in RUNNING state, you can’t move the images from system DS. You have to POWEROFF the VM and the migrate the VM. But, note, that if the DS has SELF clone or the image is persistent and the DS is shared, the VM will use the image from the image DS.
Is there any way I can change (manual) database so that migrated VMs will point to new cloned image?
If any image in old datastore still in using state, we can not remove this datastore.
You can use the
onedb update-body vm --id <VM_ID> command. It will prompt an editor with all the VM information, so you have to change the IMAGE_ID and the SOURCE in the DISK section.
I got this error when migrating from local (ssh) to qcow2 datastore:
[one.vm.migrate] Cannot migrate to a system datastore with a different TM driver
The same problem with local (ssh) to ceph.
I even try to manual copy disk file to new datastore but dont know how to use
update-body vm --id <VM_ID>
to change disk to new datastore.
Any idea how to migrate b/w datastores? Manual migration is ok for us.
I try to do manual datastore migration from ssh to ceph with following steps:
- Shutdown instances.
- Convert instances’ disk images from qcow2 to raw.
- update-body vm --id <VM_ID> point to newly created template which images are in ceph datastore.
- Import raw disks to ceph with exact format such as: one-[image-id]-[vm-id]-[disk-id]
Update instances’ deployment xml with new ceph disk configuration.
- Restart instances.
However , I can not find anywhere that I can update disk configuration in step 5. Any idea?