# Listing our test servers
nova --os-auth-url=http://192.168.0.5:5000/v2.0 list
+--------------------------------------+--------------+--------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------+--------+------------+-------------+------------------+
| 9991ead8-8a88-45c3-83d0-a2ac5e7fb232 | test_server1 | ACTIVE | - | Running | private=10.0.0.2 |
| 44d13e4b-a218-46b8-a714-c96e9cff2066 | test_server2 | ACTIVE | - | Running | private=10.0.0.3 |
+--------------------------------------+--------------+--------+------------+-------------+------------------+
# Listing our test volume
pcrews@erlking-dev:~/git/rannsaka$ cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a | available | test_volume1 | 1 | lvmdriver-1 | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
# Attaching volume to test_server1 on /dev/vdc
pcrews@erlking-dev:~/git/rannsaka$ nova --os-auth-url=http://192.168.0.5:5000/v2.0 volume-attach 9991ead8-8a88-45c3-83d0-a2ac5e7fb232 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a /dev/vdc
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/vdc |
| id | 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a |
| serverId | 9991ead8-8a88-45c3-83d0-a2ac5e7fb232 |
| volumeId | 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a |
+----------+--------------------------------------+
# Attaching same volume to test_server2 on /dev/vdb
pcrews@erlking-dev:~/git/rannsaka$ nova --os-auth-url=http://192.168.0.5:5000/v2.0 volume-attach 44d13e4b-a218-46b8-a714-c96e9cff2066 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a /dev/vdb
ERROR (BadRequest): Invalid volume: status must be 'available' (HTTP 400) (Request-ID: req-0eed3b96-e920-425d-9c7a-e1b6b78b3eea)
# Second request repeating the previous one - NOTE the device path is now in-use:
pcrews@erlking-dev:~/git/rannsaka$ nova --os-auth-url=http://192.168.0.5:5000/v2.0 volume-attach 44d13e4b-a218-46b8-a714-c96e9cff2066 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a /dev/vdb
ERROR (Conflict): The supplied device path (/dev/vdb) is in use. (HTTP 409) (Request-ID: req-708dcc24-5fa8-4f3d-8880-ea399aecbfd1)
# Making a curl call to get detail volume attachments for test_server2 to demonstrate that the system now considers the volume to be mounted, even though cinder does not track the same information
pcrews@erlking-dev:~/git/rannsaka$ curl -i 'http://192.168.0.5:8774/v2/c8d54cca25a9496ab264be0c2d96e567/servers/44d13e4b-a218-46b8-a714-c96e9cff2066/os-volume_attachments' -X GET -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: d" -H "X-Auth-Token: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN"
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 197
X-Compute-Request-Id: req-69d8fc33-35c1-4b93-ba05-9b48b7b602e0
Date: Tue, 02 Dec 2014 21:49:15 GMT
# cinder list to show that the system notes the volume is attached to test_server1 and not test_server2
pcrews@erlking-dev:~/git/rannsaka$ cinder list
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
| 41dcbd0b-ac6b-477e-84f9-bbe62da29a6a | in-use | test_volume1 | 1 | lvmdriver-1 | false | 9991ead8-8a88-45c3-83d0-a2ac5e7fb232 |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+
# Listing our test servers 192.168. 0.5:5000/ v2.0 list ------- ------- ------- ------- ----+-- ------- -----+- ------- +------ ------+ ------- ------+ ------- ------- ----+ ------- ------- ------- ------- ----+-- ------- -----+- ------- +------ ------+ ------- ------+ ------- ------- ----+ 8a88-45c3- 83d0-a2ac5e7fb2 32 | test_server1 | ACTIVE | - | Running | private=10.0.0.2 | a218-46b8- a714-c96e9cff20 66 | test_server2 | ACTIVE | - | Running | private=10.0.0.3 | ------- ------- ------- ------- ----+-- ------- -----+- ------- +------ ------+ ------- ------+ ------- ------- ----+
nova --os-auth-url=http://
+------
| ID | Name | Status | Task State | Power State | Networks |
+------
| 9991ead8-
| 44d13e4b-
+------
# Listing our test volume erlking- dev:~/git/ rannsaka$ cinder list ------- ------- ------- ------- ----+-- ------- --+---- ------- ---+--- ---+--- ------- ---+--- ------- +------ ------- + ------- ------- ------- ------- ----+-- ------- --+---- ------- ---+--- ---+--- ------- ---+--- ------- +------ ------- + ac6b-477e- 84f9-bbe62da29a 6a | available | test_volume1 | 1 | lvmdriver-1 | false | | ------- ------- ------- ------- ----+-- ------- --+---- ------- ---+--- ---+--- ------- ---+--- ------- +------ ------- +
pcrews@
+------
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+------
| 41dcbd0b-
+------
# Attaching volume to test_server1 on /dev/vdc erlking- dev:~/git/ rannsaka$ nova --os-auth-url=http:// 192.168. 0.5:5000/ v2.0 volume-attach 9991ead8- 8a88-45c3- 83d0-a2ac5e7fb2 32 41dcbd0b- ac6b-477e- 84f9-bbe62da29a 6a /dev/vdc ----+-- ------- ------- ------- ------- ------- -+ ----+-- ------- ------- ------- ------- ------- -+ ac6b-477e- 84f9-bbe62da29a 6a | 8a88-45c3- 83d0-a2ac5e7fb2 32 | ac6b-477e- 84f9-bbe62da29a 6a | ----+-- ------- ------- ------- ------- ------- -+
pcrews@
+------
| Property | Value |
+------
| device | /dev/vdc |
| id | 41dcbd0b-
| serverId | 9991ead8-
| volumeId | 41dcbd0b-
+------
# Attaching same volume to test_server2 on /dev/vdb erlking- dev:~/git/ rannsaka$ nova --os-auth-url=http:// 192.168. 0.5:5000/ v2.0 volume-attach 44d13e4b- a218-46b8- a714-c96e9cff20 66 41dcbd0b- ac6b-477e- 84f9-bbe62da29a 6a /dev/vdb e920-425d- 9c7a-e1b6b78b3e ea)
pcrews@
ERROR (BadRequest): Invalid volume: status must be 'available' (HTTP 400) (Request-ID: req-0eed3b96-
# Second request repeating the previous one - NOTE the device path is now in-use: erlking- dev:~/git/ rannsaka$ nova --os-auth-url=http:// 192.168. 0.5:5000/ v2.0 volume-attach 44d13e4b- a218-46b8- a714-c96e9cff20 66 41dcbd0b- ac6b-477e- 84f9-bbe62da29a 6a /dev/vdb 5fa8-4f3d- 8880-ea399aecbf d1)
pcrews@
ERROR (Conflict): The supplied device path (/dev/vdb) is in use. (HTTP 409) (Request-ID: req-708dcc24-
# Making a curl call to get detail volume attachments for test_server2 to demonstrate that the system now considers the volume to be mounted, even though cinder does not track the same information erlking- dev:~/git/ rannsaka$ curl -i 'http:// 192.168. 0.5:8774/ v2/c8d54cca25a9 496ab264be0c2d9 6e567/servers/ 44d13e4b- a218-46b8- a714-c96e9cff20 66/os-volume_ attachments' -X GET -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: d" -H "X-Auth-Token: NNNNNNNNNNNNNNN NNNNNNNNNNNNNNN N" Request- Id: req-69d8fc33- 35c1-4b93- ba05-9b48b7b602 e0
pcrews@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 197
X-Compute-
Date: Tue, 02 Dec 2014 21:49:15 GMT
{"volumeAttachm ents": [{"device": "/dev/vdb", "serverId": "44d13e4b- a218-46b8- a714-c96e9cff20 66", "id": "41dcbd0b- ac6b-477e- 84f9-bbe62da29a 6a", "volumeId": "41dcbd0b- ac6b-477e- 84f9-bbe62da29a 6a"}]}
# cinder list to show that the system notes the volume is attached to test_server1 and not test_server2 erlking- dev:~/git/ rannsaka$ cinder list ------- ------- ------- ------- ----+-- ------+ ------- ------- +------ +------ ------- +------ ----+-- ------- ------- ------- ------- ------- -+ ------- ------- ------- ------- ----+-- ------+ ------- ------- +------ +------ ------- +------ ----+-- ------- ------- ------- ------- ------- -+ ac6b-477e- 84f9-bbe62da29a 6a | in-use | test_volume1 | 1 | lvmdriver-1 | false | 9991ead8- 8a88-45c3- 83d0-a2ac5e7fb2 32 | ------- ------- ------- ------- ----+-- ------+ ------- ------- +------ +------ ------- +------ ----+-- ------- ------- ------- ------- ------- -+
pcrews@
+------
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+------
| 41dcbd0b-
+------