Skip to content

Copying Standalone Volumes

Egle Sigler edited this page Oct 13, 2017 · 4 revisions

Copying standalone (unattached) Cinder volumes can be done without running any of the other commands. Any volume that is attached to a VM will not be copied. The following commands must be executed in order to copy volumes from environment A to environment B, in the order listed:

  -v, --singlevolumeimagecreate
                        Create images of unattached volumes for each UUID
                        provided in the ./id_volume_file
  -V, --singlevolumeimagedownload
                        Download images of unattached volumes as specified in
                        volume ID fileto a specified path, for example,
                        ./downloads/ ./id_volume_file
  -y, --singlevolumeimageupload
                        Upload images of unattached volumes from a specified
                        path as specified in volume ID file, for example,
                        ./downloads/ ./id_volume_file
  -Y, --singlevolumecreate
                        Create un-attached volumes from images as specified in
                        volume ID file, for example, ./id_volume_file

Start by creating images of volumes. This step will create a glance image and name it

You will need a file with volume IDs. You can get them by running copystack.py -r and getting the IDs for "from" volumes. You can name your file whatever you like. For our example, we are going to use "id_volume_file".

cat id_volume_file 

With the following content:

145a6b48-2f3d-4d66-af70-d80125f0683e foo available 1
cc6ff51b-faaf-443f-8835-a985611db39a bar available 1

Note that anything after the volume ID will be ignored. Each line must start with the volume ID.

Start with:

python copystack.py -v ./id_volume_file 

You should see something similar to the following output:

From: https://198.61.196.137  Username: admin  Tenant: admin
To:   https://198.61.196.185  Username: admin  Tenant: admin
Creating image from volume, volume id: 145a6b48-2f3d-4d66-af70-d80125f0683e
Creating image from volume, volume id: cc6ff51b-faaf-443f-8835-a985611db39a

The command above will create images from volumes with names in the format of <single_migration_volume_image_><UUID>. If you re-run the report, in the "from" images you will see newly created images ready for copying:

python copystack.py -r

"From" images will have new images now:

--------------- From Images: ------------------------
Image UUID / Image Status / Image Name
51ef8378-1b8e-4bdb-bc48-bd8a705cf7a1   active   cirros
635e0cc5-dabb-4e1f-b1f5-518794dcdf57   active   cirros_alt
97a11745-3c20-4d3a-99cb-43830ee1f11a   saving   single_migration_volume_image_145a6b48-2f3d-4d66-af70-d80125f0683e
6e3297d1-39c5-457e-8b8c-f076390c21bc   saving   single_migration_volume_image_cc6ff51b-faaf-443f-8835-a985611db39a

Wait for the new images to be in active status.

Next, run this command:

python copystack.py -V ./downloads/ ./id_volume_file 
From: https://198.61.196.137  Username: admin  Tenant: admin
To:   https://198.61.196.185  Username: admin  Tenant: admin
Downloading image name: single_migration_volume_image_145a6b48-2f3d-4d66-af70-d80125f0683e
Downloading to ./downloads/single_migration_volume_image_145a6b48-2f3d-4d66-af70-d80125f0683e
this might take a while...
Downloading image name: single_migration_volume_image_cc6ff51b-faaf-443f-8835-a985611db39a
Downloading to ./downloads/single_migration_volume_image_cc6ff51b-faaf-443f-8835-a985611db39a
this might take a while...

Next, upload the images to the new environment:

python copystack.py -y ./downloads/ id_volume_file 
From: https://198.61.196.137  Username: admin  Tenant: admin
To:   https://198.61.196.185  Username: admin  Tenant: admin
Uploading image name: single_migration_volume_image_145a6b48-2f3d-4d66-af70-d80125f0683e
this might take a while...
./downloads/single_migration_volume_image_145a6b48-2f3d-4d66-af70-d80125f0683e
Uploading image name: single_migration_volume_image_cc6ff51b-faaf-443f-8835-a985611db39a
this might take a while...
./downloads/single_migration_volume_image_cc6ff51b-faaf-443f-8835-a985611db39a

Final step, create volumes from images:

python copystack.py -Y id_volume_file 
From: https://198.61.196.137  Username: admin  Tenant: admin
To:   https://198.61.196.185  Username: admin  Tenant: admin
Volume foo created
Volume bar created
Clone this wiki locally