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: https://helpdesk.auro.io/index.php?/Knowledgebase/Article/View/10/0/installing-the-cli-client-tools. Make sure you have your openstack RC files for both the old and new environments.
- 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.
- 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.
- 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.
- 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
- 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
- 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.
- 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
- Now, download the image like we did with the instance:
openstack image save --file volume_image.img <image ID>
- 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
- Now that its listed on your new tenant, create a volume from the image:
openstack volume create --image <new image ID> migrated_volume_name
- The volume will now be available to attach to an instance.