Ask Your Question

Import kvm vm to openstack + ceph

asked 2015-02-06 11:13:52 -0600

schegi gravatar image

updated 2015-02-06 12:40:58 -0600


my problem, i got a couple of KVM/Qemu virtual machines running on some old server backed in local lvm storage. In paralell, i got a newly deployed openstack private cloud with cinder/ceph as storage backend. Now i somehow like to migrate these VMs from the old infrastructure to the new. I general it is very easy to just run the VMs on the openstack server, just:

dd if=the_lvm_volume | pv | ssh storage_node 'rbd -p my_volume_pool import - new_volume'

And then start a VM from this volume, e.g. using virsh. But this way, the volume is not recognized by cinder and the vm not by nova. Therefore i could not manage it with openstack. It worked to import the volume as glance image and then start a machine from this image. But i like to have it as volume not image, especially because some of the VMs i like to migrate have multiple volumes attached to the VM. And doing all via glance is a whole bunch of extra work. I also tried to just create a volume in cinder, same size as the original volume and import to that volume but unfortunately rbd does not allow to import to an existing volume.

  • Would it make sense to create a volume in cinder, delete it with rbd and import to a new volume with the same name?

UPDATE: Ok tested this option and it seemed to work. Created a volume (Size of the volume to import) in cinder, get the uuid of the volume then delete the corresponding volume in ceph manually using rbd. Then i did the rbd import with destination of the delete volume and made it bootable. Afterwards i was able to use this volume to start an instance using nova. A litte dirty workaround but it seems to do the job.

  • Is there any other 'recommended' way to import whole VMs to a openstack environment?

Thx Stefan

edit retag flag offensive close merge delete


When loading instance via glance image you have option (in Juno) :-
Launch via image creating volume and it works ( at least for Gluster backend, not sure about "rbd" backend for cinder)

dbaxps gravatar imagedbaxps ( 2015-02-06 11:44:54 -0600 )edit
dbaxps gravatar imagedbaxps ( 2015-02-06 11:50:52 -0600 )edit

Yes you are right but this way i have to upload every machine/volume as image to glance. Then launch a machine/create new volume. In this case i have the image and the newly created volume in my storage which is somehow redundant. I was wondering if an import directly to a volume is possible.

schegi gravatar imageschegi ( 2015-02-06 12:02:17 -0600 )edit

Another thing is that writing the volume via ssh to a volume in ceph could be done remotely from my old hardware, uploading to glance etc. would be some more work to do and not so easily automatable.

schegi gravatar imageschegi ( 2015-02-06 12:03:21 -0600 )edit

Here command line for Launch via image creating volume:

$ nova boot --flavor 2 --key_name osxkey --block-device
shutdown=preserve,bootindex=0 NewVM-Name

dbaxps gravatar imagedbaxps ( 2015-02-06 12:09:16 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-16 17:35:08 -0600

schegi gravatar image

updated 2015-02-16 17:36:53 -0600

This process did the job for me

  1. Get the size of the of the volume you like to transfer.
  2. Create a volume of that size, using cinder API or dashboard. Remember the UUID oft that Volumen.
  3. Delete the corresponding Volumen in ceph using rbd. With default cinder naming scheme, the corresponding CH Volumen is called volume-<uuid>.
  4. Import the data from the original volume using dd and rbd import into a volume oft the same name as the deleted.
  5. Make the volume bootable.
edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-02-06 11:13:52 -0600

Seen: 2,528 times

Last updated: Feb 16 '15