cinder-backupのNFSドライバーお試し

#はじめに

Openstack kiloからcinder-backupのバックアップ先としてNFSが追加になりましたので最新バージョンのLibertyで試してみます。
環境は、DevstackとFASストレージとClustered Data ONTAP8.2.3P3で試しています。

#手順

1.DevstackでOpenStackを構築します。localrcでcinder-backupサービスを有効にして./stack.shします。

```
##Enable Cinder-Backup
enable_service c-bak
```

2.Cinderの設定

cinder.confにバックエンドの定義とcinder-backup定義を追加します。

```
vi /etc/cinder.conf
[DEFAULT]
default_volume_type = myNfsBackend
enabled_backends = myNfsBackend

backup_driver=cinder.backup.drivers.nfs
backup_share=10.0.0.10:/vol_bkup

[myNfsBackend]
volume_backend_name=myNfsBackend
volume_driver=cinder.volume.drivers.netapp.common.NetAppDriver
netapp_server_hostname=10.0.0.5
netapp_server_port=80
netapp_storage_protocol=nfs
netapp_storage_family=ontap_cluster
netapp_login=admin
netapp_password=password
netapp_vserver=vs_nfs_
nfs_shares_config=/etc/cinder/share.config
```

cinder volume用のNFSシェアを定義します。

```
vi /etc/cinder/share.config
10.0.0.10:/vol_migrt
```

3.cinderサービスの再起動してcinder-backupサービスの起動確認します。

```
miyamoto@controller:~$ cinder service-list
+------------------+-------------------------+------+---------+-------+----------------------------+-----------------+
|      Binary      |           Host          | Zone |  Status | State |         Updated_at         | Disabled Reason |
+------------------+-------------------------+------+---------+-------+----------------------------+-----------------+
|  cinder-backup   |        controller       | nova | enabled |   up  | 2016-01-09T09:15:54.000000 |        -        |
| cinder-scheduler |        controller       | nova | enabled |   up  | 2016-01-09T09:15:56.000000 |        -        |
|  cinder-volume   |  controller@lvmdriver-1 | nova | enabled |  down | 2016-01-09T04:47:41.000000 |        -        |
|  cinder-volume   | controller@myNfsBackend | nova | enabled |   up  | 2016-01-09T09:15:52.000000 |        -        |
+------------------+-------------------------+------+---------+-------+----------------------------+-----------------+
```

4.Cinder volume用とバックアップ用のNFSシェアがmountされます。

```
miyamoto@controller:~$ df
Filesystem                      1K-blocks    Used Available Use% Mounted on
udev                              6141356       8   6141348   1% /dev
tmpfs                             1230500     772   1229728   1% /run
/dev/mapper/controller--vg-root  14048320 4359940   8951716  33% /
none                                    4       0         4   0% /sys/fs/cgroup
none                                 5120       0      5120   0% /run/lock
none                              6152492       0   6152492   0% /run/shm
none                               102400       0    102400   0% /run/user
/dev/sda1                          240972   78772    149759  35% /boot
10.0.0.10:/vol_migrt        99614720 1853888  97760832   2% /opt/stack/data/nova/mnt/dad41f80193f06452a0755c86e49547b
10.0.0.10:/vol_bkup         99614720  352192  99262528   1% /opt/stack/data/cinder/backup_mount/85b4cd8aa432cf85bdf0412cadc284fb
```

5.cinder vol作成してバックアップ取得

```
miyamoto@controller:~$ cinder backup-create 6e475d60-ddbd-434c-8b5b-b30abf40f67d
+-----------+--------------------------------------+
|  Property |                Value                 |
+-----------+--------------------------------------+
|     id    | a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 |
|    name   |                 None                 |
| volume_id | 6e475d60-ddbd-434c-8b5b-b30abf40f67d |
+-----------+--------------------------------------+

miyamoto@controller:~$ cinder backup-list
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
|                  ID                  |              Volume ID               |   Status  | Name | Size | Object Count |                 Container                  |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
| a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 | 6e475d60-ddbd-434c-8b5b-b30abf40f67d | available |  -   |  1   |      2       | a7/c7/a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
```

バックアップ用のNFSシェアにバックアップファイルが作成されます。

```
miyamoto@controller:~$ ll /opt/stack/data/cinder/backup_mount/85b4cd8aa432cf85bdf0412cadc284fb/a7/c7/a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98/
total 3388
drwxrwx--- 2 miyamoto miyamoto    4096 Jan  9 18:23 ./
drwxrwxr-x 3 miyamoto miyamoto    4096 Jan  9 18:22 ../
-rw-rw---- 1 miyamoto miyamoto 1043644 Jan  9 18:23 backup-00001
-rw-rw---- 1 miyamoto miyamoto    1733 Jan  9 18:23 backup_metadata
-rw-rw---- 1 miyamoto miyamoto 2392344 Jan  9 18:23 backup_sha256file
```
7.リストア実行

リストアは、直接Cinder volumeにリストアする方法と新たにcinder-volumeを作成する方法があります。

```
cinder help backup-restore
usage: cinder backup-restore [--volume <volume>] <backup>

Restores a backup.

Positional arguments:
  <backup>           ID of backup to restore.

Optional arguments:
  --volume <volume>  Name or ID of volume to which to restore. Default=None.
```

別のcinder-volumeを作る方法で試します。

```
miyamoto@controller:~$ cinder backup-restore a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98
+-------------+-----------------------------------------------------+
|   Property  |                        Value                        |
+-------------+-----------------------------------------------------+
|  backup_id  |         a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98        |
|  volume_id  |         83f6c5f5-193c-477c-ac1c-6af496b74000        |
| volume_name | restore_backup_a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 |
+-------------+-----------------------------------------------------+
```

statusがrestoringからavailableになったら完了です。

```
miyamoto@controller:~$ cinder backup-list
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
|                  ID                  |              Volume ID               |   Status  | Name | Size | Object Count |                 Container                  |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
| a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 | 6e475d60-ddbd-434c-8b5b-b30abf40f67d | restoring |  -   |  1   |      2       | a7/c7/a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+

miyamoto@controller:~$ cinder backup-list
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
|                  ID                  |              Volume ID               |   Status  | Name | Size | Object Count |                 Container                  |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
| a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 | 6e475d60-ddbd-434c-8b5b-b30abf40f67d | available |  -   |  1   |      2       | a7/c7/a7c7708d-8a89-4fdd-9eb2-17b2e9e99e98 |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+--------------------------------------------+
```