Comment 1 for bug 1398588

Revision history for this message
Patrick Crews (patrick-crews) wrote :

# 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

{"volumeAttachments": [{"device": "/dev/vdb", "serverId": "44d13e4b-a218-46b8-a714-c96e9cff2066", "id": "41dcbd0b-ac6b-477e-84f9-bbe62da29a6a", "volumeId": "41dcbd0b-ac6b-477e-84f9-bbe62da29a6a"}]}

# 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 |
+--------------------------------------+--------+--------------+------+-------------+----------+--------------------------------------+