lost and found ( for me ? )

Openstack cinder : add a volume(block storage) to an instance

Here are logs when adding a block storage to an instance.

Two instances are running.
There are not volumes.
[root@controller ~]# source keystonerc_user01
[root@controller ~(keystone_user01)]# openstack server list
+--------------------------------------+-------------------+--------+----------------------------------------+
| ID                                   | Name              | Status | Networks                               |
+--------------------------------------+-------------------+--------+----------------------------------------+
| c98521fc-cf0a-4dc1-ac89-4f88bb5d80c8 | second-instance   | ACTIVE | internal=192.168.37.4, 192.168.131.133 |
| 76dbd219-4e69-461e-9404-26270e9b4cd8 | my-first-instance | ACTIVE | internal=192.168.37.3, 192.168.131.132 |
+--------------------------------------+-------------------+--------+----------------------------------------+
[root@controller ~(keystone_user01)]#
[root@controller ~(keystone_user01)]# openstack volume list

[root@controller ~(keystone_user01)]#

create a volume.
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2016-09-23T08:01:18.004295           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | b984d9a4-6d28-42ec-9ccc-84e6a868838d |
| multiattach         | False                                |
| name                | data_vol1                            |
| properties          |                                      |
| replication_status  | disabled                             |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | None                                 |
| updated_at          | None                                 |
| user_id             | 1951635b07c24d3eb7de05fb8f2697cf     |
+---------------------+--------------------------------------+
[root@controller ~(keystone_user01)]#

[root@controller ~(keystone_user01)]# openstack volume list
+--------------------------------------+--------------+-----------+------+-------------+
| ID                                   | Display Name | Status    | Size | Attached to |
+--------------------------------------+--------------+-----------+------+-------------+
| b984d9a4-6d28-42ec-9ccc-84e6a868838d | data_vol1    | available |    1 |             |
+--------------------------------------+--------------+-----------+------+-------------+
[root@controller ~(keystone_user01)]#

Attach this volume to the instance.

(openstack) server list
+--------------------------------------+-------------------+--------+----------------------------------------+
| ID                                   | Name              | Status | Networks                               |
+--------------------------------------+-------------------+--------+----------------------------------------+
| c98521fc-cf0a-4dc1-ac89-4f88bb5d80c8 | second-instance   | ACTIVE | internal=192.168.37.4, 192.168.131.133 |
| 76dbd219-4e69-461e-9404-26270e9b4cd8 | my-first-instance | ACTIVE | internal=192.168.37.3, 192.168.131.132 |
+--------------------------------------+-------------------+--------+----------------------------------------+
(openstack) volume list
+--------------------------------------+--------------+-----------+------+-------------+
| ID                                   | Display Name | Status    | Size | Attached to |
+--------------------------------------+--------------+-----------+------+-------------+
| b984d9a4-6d28-42ec-9ccc-84e6a868838d | data_vol1    | available |    1 |             |
+--------------------------------------+--------------+-----------+------+-------------+
(openstack) server add volume 76dbd219-4e69-461e-9404-26270e9b4cd8 b984d9a4-6d28-42ec-9ccc-84e6a868838d
(openstack)

(openstack) server show 76dbd219-4e69-461e-9404-26270e9b4cd8
+--------------------------------------+----------------------------------------------------------+
| Field                                | Value                                                    |
+--------------------------------------+----------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                   |
| OS-EXT-AZ:availability_zone          | nova                                                     |
| OS-EXT-STS:power_state               | 1                                                        |
| OS-EXT-STS:task_state                | None                                                     |
| OS-EXT-STS:vm_state                  | active                                                   |
| OS-SRV-USG:launched_at               | 2016-09-14T06:36:40.000000                               |
| OS-SRV-USG:terminated_at             | None                                                     |
| accessIPv4                           |                                                          |
| accessIPv6                           |                                                          |
| addresses                            | internal=192.168.37.3, 192.168.131.132                   |
| config_drive                         |                                                          |
| created                              | 2016-09-14T06:36:31Z                                     |
| flavor                               | m1.tiny (1)                                              |
| hostId                               | d34eb8dc4d730fcc217d98d3685b0f9b8aeafc0deaa8bf8261d37cae |
| id                                   | 76dbd219-4e69-461e-9404-26270e9b4cd8                     |
| image                                | cirros (0787f9f4-4ab1-4b3b-b186-de167642051f)            |
| key_name                             | user01_keypair                                           |
| name                                 | my-first-instance                                        |
| os-extended-volumes:volumes_attached | [{u'id': u'b984d9a4-6d28-42ec-9ccc-84e6a868838d'}]       |
| progress                             | 0                                                        |
| project_id                           | 605f675c6d1a40cd9563adf3a75d4492                         |
| properties                           |                                                          |
| security_groups                      | [{u'name': u'default'}]                                  |
| status                               | ACTIVE                                                   |
| updated                              | 2016-09-14T06:36:41Z                                     |
| user_id                              | 1951635b07c24d3eb7de05fb8f2697cf                         |
+--------------------------------------+----------------------------------------------------------+
(openstack)

(openstack) volume list
+--------------------------------------+--------------+--------+------+--------------------------------------------+
| ID                                   | Display Name | Status | Size | Attached to                                |
+--------------------------------------+--------------+--------+------+--------------------------------------------+
| b984d9a4-6d28-42ec-9ccc-84e6a868838d | data_vol1    | in-use |    1 | Attached to my-first-instance on /dev/vdb  |
+--------------------------------------+--------------+--------+------+--------------------------------------------+
(openstack)

access to the instance
vdb was added
$ ls /dev/vd*
/dev/vda   /dev/vda1  /dev/vdb
$

remove a volume
(openstack) server remove volume 76dbd219-4e69-461e-9404-26270e9b4cd8 b984d9a4-6d28-42ec-9ccc-84e6a868838d
(openstack)

on the instance.
$ ls /dev/vd*
/dev/vda   /dev/vda1
$

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.