CentOS 7
Sponsored Link

OpenStack Pike : Configure Cinder Backup
2017/09/06
 
Configure Cinder Backup Service for Cinder block storages.
This example shows to configure NFS backend for backup storage.
For other backends, It's possible to confugire GlusterFS, Ceph, Object Storage(Swift), and others.
------------+---------------------------+---------------------------+-------------------------+------------
            |                           |                           |                         |
        eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51            eth0|10.0.0.35
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+  +----------+-----------+
|    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |  |   [  NFS Server  ]   |
|                       |   |                       |   |                       |  |                      |
|  MariaDB    RabbitMQ  |   |      Open vSwitch     |   |        Libvirt        |  +----------------------+
|  Memcached  httpd     |   |        L2 Agent       |   |     Nova Compute      |
|  Keystone   Glance    |   |        L3 Agent       |   |      Open vSwitch     |
|  Nova API             |   |     Metadata Agent    |   |        L2 Agent       |
|  Neutron Server       |   |     Cinder-Volume     |   |                       |
|  Metadata Agent       |   |     Cinder-Backup     |   |                       |
|  Cinder API           |   |                       |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

[1]
NFS server is required to be running on your LAN, refer to here.
On this example, configure [/var/lib/cinder-backup] directory on [nfs.srv.world] as a backup directory.
[2] Configure Storage Node.
[[email protected] ~]#
vi /etc/cinder/cinder.conf
# add follows into [DEFAULT] section

backup_driver = cinder.backup.drivers.nfs
backup_mount_point_base = $state_path/backup_nfs
backup_share = nfs.srv.world:/var/lib/cinder-backup
[[email protected] ~]#
systemctl start openstack-cinder-backup

[[email protected] ~]#
systemctl enable openstack-cinder-backup

[[email protected] ~]#
chown -R cinder. /var/lib/cinder/backup_nfs

[3] Get Backup for Cinder Volumes. It's OK to work on any node. (This example is on Control Node)
[[email protected] ~(keystone)]#
openstack volume list

+--------------------------------------+--------+-----------+------+-------------+
| ID                                   | Name   | Status    | Size | Attached to |
+--------------------------------------+--------+-----------+------+-------------+
| 19ca6fa7-202a-4a66-8fb7-05cb42305595 | disk01 | available |   10 |             |
+--------------------------------------+--------+-----------+------+-------------+

# create a backup for [disk01] as the new name [backup-disk01]

[[email protected] ~(keystone)]#
openstack volume backup create --name backup-disk01 disk01

+-------+--------------------------------------+
| Field | Value                                |
+-------+--------------------------------------+
| id    | 5f7abc45-1e72-43d4-8615-9ec642ccf8bc |
| name  | backup-disk01                        |
+-------+--------------------------------------+

# during cretation, [Status] is [creating]

[[email protected] ~(keystone)]#
openstack volume backup list

+--------------------------------------+---------------+-------------+----------+------+
| ID                                   | Name          | Description | Status   | Size |
+--------------------------------------+---------------+-------------+----------+------+
| 5f7abc45-1e72-43d4-8615-9ec642ccf8bc | backup-disk01 | None        | creating |   10 |
+--------------------------------------+---------------+-------------+----------+------+

# after finishing creation, [Status] tunrs to [available]

[[email protected] ~(keystone)]#
openstack volume backup list

+--------------------------------------+---------------+-------------+-----------+------+
| ID                                   | Name          | Description | Status    | Size |
+--------------------------------------+---------------+-------------+-----------+------+
| 5f7abc45-1e72-43d4-8615-9ec642ccf8bc | backup-disk01 | None        | available |   10 |
+--------------------------------------+---------------+-------------+-----------+------+
[4] If there is a backup file of target storage you'd like to get backup, it's possible to get incremental backup.
Furthermore, if target storage you'd like to get backup is now attaching on an Instance, specify [--force] option to get backup forcely.
[[email protected] ~(keystone)]#
openstack volume backup list

+--------------------------------------+---------------+-------------+-----------+------+
| ID                                   | Name          | Description | Status    | Size |
+--------------------------------------+---------------+-------------+-----------+------+
| 5f7abc45-1e72-43d4-8615-9ec642ccf8bc | backup-disk01 | None        | available |   10 |
+--------------------------------------+---------------+-------------+-----------+------+

[[email protected] ~(keystone)]#
openstack volume list

+--------------------------------------+--------+--------+------+-----------------------------------+
| ID                                   | Name   | Status | Size | Attached to                       |
+--------------------------------------+--------+--------+------+-----------------------------------+
| 19ca6fa7-202a-4a66-8fb7-05cb42305595 | disk01 | in-use |   10 | Attached to CentOS_7 on /dev/vdb  |
+--------------------------------------+--------+--------+------+-----------------------------------+

[[email protected] ~(keystone)]#
openstack volume backup create --name backup-disk01-01 --incremental --force disk01

+-------+--------------------------------------+
| Field | Value                                |
+-------+--------------------------------------+
| id    | 92a629ef-c637-48cf-8b9c-8f58790927d9 |
| name  | backup-disk01-01                     |
+-------+--------------------------------------+

[[email protected] ~(keystone)]#
openstack volume backup list

+--------------------------------------+------------------+-------------+-----------+------+
| ID                                   | Name             | Description | Status    | Size |
+--------------------------------------+------------------+-------------+-----------+------+
| 92a629ef-c637-48cf-8b9c-8f58790927d9 | backup-disk01-01 | None        | available |   10 |
| 5f7abc45-1e72-43d4-8615-9ec642ccf8bc | backup-disk01    | None        | available |   10 |
+--------------------------------------+------------------+-------------+-----------+------+
[5] For restoring from Backups, run commands like follows.
For restoring, target volume must be detached from any instances.
[[email protected] ~(keystone)]#
openstack volume backup list

+--------------------------------------+------------------+-------------+-----------+------+
| ID                                   | Name             | Description | Status    | Size |
+--------------------------------------+------------------+-------------+-----------+------+
| 92a629ef-c637-48cf-8b9c-8f58790927d9 | backup-disk01-01 | None        | available |   10 |
| 5f7abc45-1e72-43d4-8615-9ec642ccf8bc | backup-disk01    | None        | available |   10 |
+--------------------------------------+------------------+-------------+-----------+------+

[[email protected] ~(keystone)]#
openstack volume list

+--------------------------------------+--------+-----------+------+-------------+
| ID                                   | Name   | Status    | Size | Attached to |
+--------------------------------------+--------+-----------+------+-------------+
| 19ca6fa7-202a-4a66-8fb7-05cb42305595 | disk01 | available |   10 |             |
+--------------------------------------+--------+-----------+------+-------------+

# run restore

[[email protected] ~(keystone)]#
openstack volume backup restore backup-disk01-01 disk01

'VolumeBackupsRestore' object is not iterable
# during restore, status is [restoring-backup]

[[email protected] ~(keystone)]#
openstack volume list

+--------------------------------------+--------+------------------+------+-------------+
| ID                                   | Name   | Status           | Size | Attached to |
+--------------------------------------+--------+------------------+------+-------------+
| 19ca6fa7-202a-4a66-8fb7-05cb42305595 | disk01 | restoring-backup |   10 |             |
+--------------------------------------+--------+------------------+------+-------------+

# after finishing restore, status turns to [available]

[[email protected] ~(keystone)]#
openstack volume list

+--------------------------------------+--------+-----------+------+-------------+
| ID                                   | Name   | Status    | Size | Attached to |
+--------------------------------------+--------+-----------+------+-------------+
| 19ca6fa7-202a-4a66-8fb7-05cb42305595 | disk01 | available |   10 |             |
+--------------------------------------+--------+-----------+------+-------------+