Taking Snapshots of Block Storage Volumes

This solution at a glance: 

Booting instances from volume snapshots can be useful for purposes such as comparison. For example, you can use an instance booted from a snapshot of a newly created volume with no data on it as a baseline to compare against future snapshots of the instance. This allows you to note how the performance of the instance changes as it accumulates stored data.

This article provides Dashboard and command-line interface (CLI) steps for taking block storage volume snapshots. It also illustrates a Dashboard workflow that does not work and explains why. 

Avoiding a "Silent Fail" in the Dashboard

Metacloud integrates a number of services that control different categories of operation in your cloud. The Compute service (nova) controls the management of instances that are booted from sources other than volumes, such as operating system (OS) images. It also controls non-volume storage options, such as "ephemeral" storage on local OS disk images.

The Block Storage service (cinder) controls the management of block storage volumes, including those based on a Ceph or iSCSI backend. The service also controls the management of instances booted from volumes. Because of this, the Compute service is not "aware" of instances booted from block storage volumes.

If you launch an instance from the Instances page, using the boot from volume option and then snapshot the instance, the snapshot process looks for disk image on the hypervisor, but "silently" fails. This means that the Dashboard displays no errors, but the snapshot is not usable. As a result, you will observe two things:

First, the snapshot appears in the Images table as having zero bytes.

Second, your snapshot is not available if you try to launch an new instance from the snapshot on the Images page.

The segregation of services is not always apparent in the Dashboard, so it is important to use a specific workflow.

Taking Volume Snapshots in the Dashboard

Create a block storage volume.

  1. In the Dashboard, choose Volumes in the Project drop-down list.
  2. Click CREATE VOLUME.
  3. Use an image as the volume source and choose a block volume type. When finished specifying settings, click CREATE VOLUME.

    vol_create_from_image.png

Create a snapshot of the volume.

  1. In the Dashboard, choose Volumes in the Project drop-down list.
  2. From the Volumes table, locate the volume you created and choose Create Snapshot from the ACTIONS drop-down list.

    vol_create_snap.png

  3. Enter a name for the snapshot and click CREATE VOLUME SNAPSHOT.

Launch an instance from the snapshot.

  1. In the Volume Snapshots tab, locate the snapshot you created and choose Launch as Instance.



  2. In the Launch Instance dialog, specify settings for the new instance and click LAUNCH.

Taking Volume Snapshots in the CLI

Create a block storage volume.

Make sure to set the --bootable option. Note the volume ID in the command output, which you need it to create the snapshot. Also, note the image on which you base the volume. You need it to when you boot an instance from the snapshot of the volume.

$ openstack volume create ceph_example2 --size 3 --image ubuntu_1404_server_cloudimg_amd64 --type ceph --bootable --availability-zone xmpl
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | xmpl                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2017-02-24T13:21:21.558081           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | <VOLUME_UUID>                        |
| migration_status    | None                                 |
| multiattach         | False                                |
| name                | ceph_example2                        |
| properties          |                                      |
| replication_status  | disabled                             |
| size                | 3                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | ceph                                 |
| user_id             | <USER_UUID>                          |
+---------------------+--------------------------------------+

The command output may show the bootable property to be false. If you run openstack volume show, you will see that the value changes to true

$ openstack volume show 07f252a1-99f9-4552-af6c-b7f9b5329d01
+---------------------------------------+------------------------------------------------------------------------------------------------------------------+
| Field                                 | Value                                                                                                            |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------+
| attachments                           | []                                                                                                               |
| availability_zone                     | xmpl                                                                                                             |
| bootable                              | true                                                                                                             |
| consistencygroup_id                   | None                                                                                                             |
| created_at                            | 2017-02-24T13:21:21.000000                                                                                       |
| description                           | None                                                                                                             |
| encrypted                             | False                                                                                                            |
| id                                    | <VOLUME_UUID>                                                                                                    |
| migration_status                      | None                                                                                                             |
| multiattach                           | False                                                                                                            |
| name                                  | ceph_example2                                                                                                    |
| os-vol-host-attr:host                 | <HOST_NAME>                                                                                                      |
| os-vol-mig-status-attr:migstat        | None                                                                                                             |
| os-vol-mig-status-attr:name_id        | None                                                                                                             |
| os-vol-tenant-attr:tenant_id          | <PROJECT_UUID>                                                                                                   |
| os-volume-replication:driver_data     | None                                                                                                             |
| os-volume-replication:extended_status | None                                                                                                             |
| properties                            |                                                                                                                  |
| replication_status                    | disabled                                                                                                         |
| size                                  | 3                                                                                                                |
| snapshot_id                           | None                                                                                                             |
| source_volid                          | None                                                                                                             |
| status                                | available                                                                                                        |
| type                                  | ceph                                                                                                             |
| user_id                               | <USER_UUID>                                                                                                      |
| volume_image_metadata                 | {u'container_format': u'bare', u'min_ram': u'0', u'disk_format': u'raw', u'image_name':                          |
|                                       | u'ubuntu_1404_server_cloudimg_amd64', u'image_id': u'<IMAGE_UUID>', u'checksum':                                 |
|                                       | u'<UUID>', u'min_disk': u'0', u'size': u'2361393152'}                                                            |
+---------------------------------------+------------------------------------------------------------------------------------------------------------------+

Create a snapshot of the volume. Note the snapshot ID, which you will need when you boot an instance from it.

$ openstack volume snapshot create ceph-example2-snap --volume ceph_example2
+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| created_at  | 2017-02-24T13:37:08.155704           |
| description | None                                 |
| id          | <SNAPSHOT_UUID>                      |
| name        | ceph-example-snap2                   |
| properties  |                                      |
| size        | 3                                    |
| status      | creating                             |
| volume_id   | <VOLUME_UUID>                        |
+-------------+--------------------------------------+

View a list of available flavors so that you can select a flavor size sufficient to support the size of the volume you created. The disk size (displayed in gigabytes) must be equal to, or greater than, that of the volume. View the Disk size.

$ openstack flavor list
+--------------------------------------+-------------------------------------+-------+------+-----------+-------+-----------+
| ID                                   | Name                                |   RAM | Disk | Ephemeral | VCPUs | Is Public |
+--------------------------------------+-------------------------------------+-------+------+-----------+-------+-----------+
| 1                                    | m1.tiny                             |   512 |    1 |         0 |     1 | True      |
| 2                                    | m1.small                            |  2048 |   20 |         0 |     1 | True      |
| 3                                    | m1.medium                           |  4096 |   40 |         0 |     2 | True      |
| 4                                    | m1.large                            |  8192 |   80 |         0 |     4 | True      |
| 5                                    | m1.xlarge                           | 16384 |  160 |         0 |     8 | True      |
+--------------------------------------+-------------------------------------+-------+------+-----------+-------+-----------+

Boot an instance from the volume snapshot. Use the image that you created the volume with.

Note: The block device option maps the new instance to the volume you created. It is not available in the OpenStack client as of Metacloud 4.1 (Liberty). For more information, see Using Snapshots to Migrate Instances.

nova boot ceph_vol_snap_inst1 --flavor m1.medium --security-groups default --nic net-id=71e8421b-2bb7-419b-804c-c6971378139e --block-device source=snapshot,id=dc9123b3-47f3-4a87-897b-ec2627dc571b,dest=volume,size=20,shutdown=preserve,bootindex=0
+--------------------------------------+----------------------------------------------------------+
| Property                             | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | xmpl2                                                     |
| OS-EXT-SRV-ATTR:host                 | <HOST_NAME>                                              |
| OS-EXT-SRV-ATTR:hostname             | ceph-vol-snap-inst1                                      |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | <HOST_NAME>                                              |
| OS-EXT-SRV-ATTR:instance_name        | instance-0000328e                                        |
| OS-EXT-SRV-ATTR:kernel_id            |                                                          |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                        |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                          |
| OS-EXT-SRV-ATTR:reservation_id       | r-20y7rp1f                                               |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                 |
| OS-EXT-SRV-ATTR:user_data            | -                                                        |
| OS-EXT-STS:power_state               | 0                                                        |
| OS-EXT-STS:task_state                | block_device_mapping                                     |
| OS-EXT-STS:vm_state                  | building                                                 |
| OS-SRV-USG:launched_at               | -                                                        |
| OS-SRV-USG:terminated_at             | -                                                        |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| adminPass                            | F3JC4nJYRJtK                                             |
| config_drive                         |                                                          |
| created                              | 2017-02-24T13:12:22Z                                     |
| flavor                               | m1.medium (3)                                            |
| hostId                               | <HOST_UUID>                                              |
| id                                   | <INSTANCE_UUID>                                          |
| image                                | Attempt to boot from volume - no image supplied          |
| key_name                             | -                                                        |
| locked                               | False                                                    |
| metadata                             | {}                                                       |
| name                                 | ceph_vol_snap_inst1                                      |
| os-extended-volumes:volumes_attached | []                                                       |
| progress                             | 0                                                        |
| security_groups                      | default                                                  |
| status                               | BUILD                                                    |
| tenant_id                            | <PROJECT_UUID>                                           |
| updated                              | 2017-02-24T13:12:22Z                                     |
| user_id                              | <USER_UUID>                                              |
+--------------------------------------+----------------------------------------------------------+

Verify that the new instance has an ACTIVE status.

$ openstack server list
+--------------------------------------+---------------------+--------+--------------------+------------+
| ID                                   | Name                | Status | Networks           | Image Name |
+--------------------------------------+---------------------+--------+--------------------+------------+
| <INTANCE_UUID>                       | ceph_vol_snap_inst1 | ACTIVE | silver=<IP>        |            |
+--------------------------------------+---------------------+--------+--------------------+------------+

If you run openstack volume list, you see a new volume that is attached to the instance you created. The original volume still has a status of AVAILABLE because it is not attached to an instance.

$ openstack volume list
+--------------------------------------+--------------+-----------+------+---------------------------------------------------------------+
| ID                                   | Display Name | Status    | Size | Attached to                                                   |
+--------------------------------------+--------------+-----------+------+---------------------------------------------------------------+
| <VOLUME_UUID>                        |              | in-use    |   20 | Attached to ceph_vol_snap_inst1 on /dev/vda                   |
| <VOLUME_UUID>                        | ceph_vol     | available |   20 |                                                               |
+--------------------------------------+--------------+-----------+------+---------------------------------------------------------------+
Have more questions? Submit a request
Powered by Zendesk