Openstack - Cinder Transfer to Different Project

## What's this?

Project 間の Cinder volume の引き渡し
1. ボリュームドナー (または元の所有者) は、転送要求を作成してから、作成した「転送 ID」と「認証キー」をボリュームの転送先に送信
2. ボリュームの転送先 (または新しい所有者) は、「転送 ID」と「認証キー」を使用して転送を確定

* Donor Project : Cinder volume sender
* Recipient Project : Cinder volume reciever


## Initial state in donor project

#### Env

    # env | egrep "OS_TENANT_NAME|OS_USERNAME"
    OS_USERNAME=admin
    OS_TENANT_NAME=tenant01

#### Cinder list

    # cinder list
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    |                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 | available | admin_vol02  |  1   |     None    |  false   |             |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

    # cinder show 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64
    +--------------------------------+--------------------------------------+
    |            Property            |                Value                 |
    +--------------------------------+--------------------------------------+
    |          attachments           |                  []                  |
    |       availability_zone        |                 nova                 |
    |            bootable            |                false                 |
    |           created_at           |      2015-03-19T09:22:41.000000      |
    |      display_description       |                                      |
    |          display_name          |             admin_vol02              |
    |           encrypted            |                False                 |
    |               id               | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 |
    |            metadata            |                  {}                  |
    |     os-vol-host-attr:host      |               node-17                |
    | os-vol-mig-status-attr:migstat |                 None                 |
    | os-vol-mig-status-attr:name_id |                 None                 |
    |  os-vol-tenant-attr:tenant_id  |   a8085d1871f847bdb906ef4a28d1bd48   |
    |              size              |                  1                   |
    |          snapshot_id           |                 None                 |
    |          source_volid          |                 None                 |
    |             status             |              available               |
    |          volume_type           |                 None                 |
    +--------------------------------+--------------------------------------+


## Create transfer in doner project

#### Create transfer

    # cinder transfer-create --display-name transfer-test 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64
    +------------+--------------------------------------+
    |  Property  |                Value                 |
    +------------+--------------------------------------+
    |  auth_key  |           8f2a25a2cdefb455           |
    | created_at |      2015-03-19T09:25:53.220066      |
    |     id     | c67679a4-89c3-4723-af7d-2ab4985de47d |
    |    name    |            transfer-test             |
    | volume_id  | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 |
    +------------+--------------------------------------+

#### Cinder transfer list

    # cinder transfer-list
    +--------------------------------------+--------------------------------------+---------------+
    |                  ID                  |              Volume ID               |      Name     |
    +--------------------------------------+--------------------------------------+---------------+
    | c67679a4-89c3-4723-af7d-2ab4985de47d | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 | transfer-test |
    +--------------------------------------+--------------------------------------+---------------+

    # cinder transfer-show c67679a4-89c3-4723-af7d-2ab4985de47d
    +------------+--------------------------------------+
    |  Property  |                Value                 |
    +------------+--------------------------------------+
    | created_at |      2015-03-19T09:25:53.000000      |
    |     id     | c67679a4-89c3-4723-af7d-2ab4985de47d |
    |    name    |            transfer-test             |
    | volume_id  | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 |
    +------------+--------------------------------------+

#### Cinder list

    # cinder list
    +--------------------------------------+-------------------+--------------+------+-------------+----------+-------------+
    |                  ID                  |       Status      | Display Name | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-------------------+--------------+------+-------------+----------+-------------+
    | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 | awaiting-transfer | admin_vol02  |  1   |     None    |  false   |             |
    +--------------------------------------+-------------------+--------------+------+-------------+----------+-------------+

## Send this transfer information to other person by email or something like that.

    auth_key : 8f2a25a2cdefb455
          id : c67679a4-89c3-4723-af7d-2ab4985de47d


## Accept the transfer in recipient project

#### Env

    # env | egrep "OS_TENANT_NAME|OS_USERNAME"
    OS_USERNAME=admin
    OS_TENANT_NAME=tenant02

#### Cinder list

    # cinder list
    +----+--------+--------------+------+-------------+----------+-------------+
    | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
    +----+--------+--------------+------+-------------+----------+-------------+
    +----+--------+--------------+------+-------------+----------+-------------+

#### Cinder transfer list

    # cinder transfer-list
    +----+-----------+------+
    | ID | Volume ID | Name |
    +----+-----------+------+
    +----+-----------+------+

Accept the Cinder transfer

    # cinder transfer-accept c67679a4-89c3-4723-af7d-2ab4985de47d 8f2a25a2cdefb455
    +-----------+--------------------------------------+
    |  Property |                Value                 |
    +-----------+--------------------------------------+
    |     id    | c67679a4-89c3-4723-af7d-2ab4985de47d |
    |    name   |            transfer-test             |
    | volume_id | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 |
    +-----------+--------------------------------------+

#### Cinder list

    # cinder list
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    |                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 | available | admin_vol02  |  1   |     None    |  false   |             |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

    # cinder show 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64
    +--------------------------------+--------------------------------------+
    |            Property            |                Value                 |
    +--------------------------------+--------------------------------------+
    |          attachments           |                  []                  |
    |       availability_zone        |                 nova                 |
    |            bootable            |                false                 |
    |           created_at           |      2015-03-19T09:22:41.000000      |
    |      display_description       |                                      |
    |          display_name          |             admin_vol02              |
    |           encrypted            |                False                 |
    |               id               | 6216b8bd-fd26-4a3c-9d8e-e69e39fb2c64 |
    |            metadata            |                  {}                  |
    |     os-vol-host-attr:host      |                node-17               |
    | os-vol-mig-status-attr:migstat |                 None                 |
    | os-vol-mig-status-attr:name_id |                 None                 |
    |  os-vol-tenant-attr:tenant_id  |   f5ca0532045c45018e9d4ebff6eebb0f   |
    |              size              |                  1                   |
    |          snapshot_id           |                 None                 |
    |          source_volid          |                 None                 |
    |             status             |              available               |
    |          volume_type           |                 None                 |
    +--------------------------------+--------------------------------------+


## Check again after complete the transfer in donor project

#### Cinder list

    # cinder list
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    |                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

#### Cinder transfer list

    # cinder transfer-list
    +----+-----------+------+
    | ID | Volume ID | Name |
    +----+-----------+------+
    +----+-----------+------+

## Reference

[https://wiki.openstack.org/wiki/VolumeTransfer][link-01]


## Environment

* Openstack : Juno
* Ceph : Firefly

[link-01]:https://wiki.openstack.org/wiki/VolumeTransfer