Data store migration - steps and resources

(Michael Abdou) #1

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!

0 Likes

(Michael Abdou) #2

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]).

0 Likes

(Florian Heigl) #3

Hi Michael,

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)

0 Likes

(Hoang Hien Nguyen) #4

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.

0 Likes

(Alejandro Huertas) #5

Hi @Hoang_Hien_Nguyen

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.

0 Likes

(Hoang Hien Nguyen) #6

Thank you.
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.

0 Likes

(Alejandro Huertas) #7

Hi @Hoang_Hien_Nguyen,

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.

0 Likes