Migrating Instances and Volumes between environments
Posted by Matt Czajka, Last modified by Matt Czajka on 20 October 2017 10:39 AM

How to migrate instances from the old to the new environment.


You will first need CLI access to proceed with the migration, specifically to download your snapshot image, so you may upload It once again in the new environment.  You can setup CLI and pull your Openstack RC by following along this tutorial:  Make sure you have your openstack RC files for both the old and new environments.


  1. You must first create a snapshot of your instance. Login to your control panel, and shut down the instance.  Once shut down, create a snapshot of the instance.  This is a full image backup of your entire server.


  1. Now, go to images and click on your snapshot name. This page shows the snapshot details, the most important one is the ID.  Note this.


  1. From CLI, source as your old environment tenant, and type the following:


openstack image save --file image.qcow2 <image ID>


Now you have your image snapshot downloaded, which we can upload to the new environment.


  1. It is recommended to convert your image from qcow2 to raw format on the new environment. The HA backend for storage is better suited for raw formatted images. 


qemu-img convert -f qcow2 -O raw image.qcow2 image.raw


  1. Now, source as your new openstack tenant on the new environment. Please note you should use the new CLI on the new environment. Use the following to upload the image:


openstack image create --disk-format raw --container-format bare --private --file image.raw instance-snap


  1. Now your image is on the new environment. Simply login to the new environment dashboard, go to instances, choose boot from snapshot, and select your newly uploaded image. Once complete your instance will be on the new environment.


How to migrate volumes from the old to the new environment.


To migrate a cinder volume, we will be creating a snapshot from a volume, then migrating that snapshot like you would an instance.


  1. First, the volume must be detached from any instances, to ensure data consistency. Then run the following:


volume snapshot create --volume <volume-id> volume-snapshot.img


You should now have a snaphot image of your volume.  Note the snapshot ID


  1. Now, download the image like we did with the instance:


openstack image save --file volume_image.img <image ID>


  1. Now source your new tenant and upload it. Note the new image ID after uploading to the new environment:


openstack image create --disk-format raw --container-format bare --private --file volume.img volume-image


  1. Now that its listed on your new tenant, create a volume from the image:


openstack volume create --image <new image ID> migrated_volume_name


  1. The volume will now be available to attach to an instance.
(0 vote(s))
Not helpful

Comments (0)