diff --git a/doc/api_samples/os-volumes/attach-volume-to-server-req.json b/doc/api_samples/os-volumes/attach-volume-to-server-req.json index 4062687fc3bb..f2d5f69bd525 100644 --- a/doc/api_samples/os-volumes/attach-volume-to-server-req.json +++ b/doc/api_samples/os-volumes/attach-volume-to-server-req.json @@ -1,6 +1,6 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "device": "/dev/vdd" + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "device": "/dev/sdb" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/attach-volume-to-server-resp.json b/doc/api_samples/os-volumes/attach-volume-to-server-resp.json index 2e512ac99031..5408fb8a9953 100644 --- a/doc/api_samples/os-volumes/attach-volume-to-server-resp.json +++ b/doc/api_samples/os-volumes/attach-volume-to-server-resp.json @@ -1,8 +1,8 @@ { "volumeAttachment": { - "device": "/dev/vdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "0c92f3f6-c253-4c9b-bd43-e880a8d2eb0a", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "802db873-0373-4bdd-a433-d272a539ba18", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/list-volume-attachments-resp.json b/doc/api_samples/os-volumes/list-volume-attachments-resp.json index 9ae9b4a2aa8c..68411d9c95e5 100644 --- a/doc/api_samples/os-volumes/list-volume-attachments-resp.json +++ b/doc/api_samples/os-volumes/list-volume-attachments-resp.json @@ -1,16 +1,10 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "4d8c3732-a248-40ed-bebc-539a6ffd25c0", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804" + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "fd5bb1c4-de31-4071-8472-9410bc9155ec", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } ] } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/update-volume-req.json b/doc/api_samples/os-volumes/update-volume-req.json index bba735eec834..e5ad47aa3cce 100644 --- a/doc/api_samples/os-volumes/update-volume-req.json +++ b/doc/api_samples/os-volumes/update-volume-req.json @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f805" + "volumeId": "227cc671-f30b-4488-96fd-7d0bf13648d8" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-req.json b/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-req.json index 9f49b54d78cb..fdf928be694d 100644 --- a/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-req.json +++ b/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-req.json @@ -1,6 +1,6 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", "tag": "foo" } -} +} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-resp.json b/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-resp.json index df5b887e2186..1e5aa6b1a630 100644 --- a/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-resp.json +++ b/doc/api_samples/os-volumes/v2.49/attach-volume-to-server-resp.json @@ -1,8 +1,8 @@ { "volumeAttachment": { - "device": "/dev/vdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "189dc814-35bc-428b-bba4-8d5ac0d1e087", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "69d19439-fa5f-4d6e-8b78-1868e7eb93a5", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json b/doc/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json index 01623c372335..4e696e9f061b 100644 --- a/doc/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json +++ b/doc/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json @@ -1,16 +1,10 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "4bcb3ae6-68aa-4e89-aac3-97b3dac2f714", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "4bcb3ae6-68aa-4e89-aac3-97b3dac2f714", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804" + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "1b92ff87-0116-40f5-9087-f4b907aeeaf1", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } ] } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.49/update-volume-req.json b/doc/api_samples/os-volumes/v2.49/update-volume-req.json index bba735eec834..e5ad47aa3cce 100644 --- a/doc/api_samples/os-volumes/v2.49/update-volume-req.json +++ b/doc/api_samples/os-volumes/v2.49/update-volume-req.json @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f805" + "volumeId": "227cc671-f30b-4488-96fd-7d0bf13648d8" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json b/doc/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json index 9e483ea66030..af9e64d4c249 100644 --- a/doc/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json +++ b/doc/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json @@ -1,8 +1,8 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "3dc0a2a6-e1bb-4643-8b6f-c146684d676d", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "9ad0352c-48ff-4290-9db8-3385a676f035", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-req.json b/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-req.json index b754722297df..fdf928be694d 100644 --- a/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-req.json +++ b/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-req.json @@ -1,6 +1,6 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", "tag": "foo" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-resp.json b/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-resp.json index 9b968680a497..5c03cbc232bf 100644 --- a/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-resp.json +++ b/doc/api_samples/os-volumes/v2.70/attach-volume-to-server-resp.json @@ -1,9 +1,9 @@ { "volumeAttachment": { - "device": "/dev/vdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "521b9e49-4855-4a9a-8474-759a86c1b12d", + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "70f5c62a-972d-4a8b-abcf-e1375ca7f8c0", "tag": "foo", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json b/doc/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json index b1a481dbe0fd..0b803c6d6b7a 100644 --- a/doc/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json +++ b/doc/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json @@ -1,18 +1,11 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "fb6077e6-c10d-4e81-87fa-cb0f8c103051", + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "297155de-f7f2-4e87-82d0-ccc7d225d491", "tag": "foo", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "fb6077e6-c10d-4e81-87fa-cb0f8c103051", - "tag": null, - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804" + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } ] } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.70/update-volume-req.json b/doc/api_samples/os-volumes/v2.70/update-volume-req.json index bba735eec834..e5ad47aa3cce 100644 --- a/doc/api_samples/os-volumes/v2.70/update-volume-req.json +++ b/doc/api_samples/os-volumes/v2.70/update-volume-req.json @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f805" + "volumeId": "227cc671-f30b-4488-96fd-7d0bf13648d8" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json b/doc/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json index a857b82d4d14..650ede480e81 100644 --- a/doc/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json +++ b/doc/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json @@ -1,9 +1,9 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "d989feee-002d-40f6-b47d-f0dbee48bbc1", "tag": "foo", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } } \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-req.json b/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-req.json index a6087418690f..b4429e12e968 100644 --- a/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-req.json +++ b/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-req.json @@ -1,7 +1,7 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", "tag": "foo", "delete_on_termination": true } -} +} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-resp.json b/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-resp.json index b761bc316886..3a60cdc0d095 100644 --- a/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-resp.json +++ b/doc/api_samples/os-volumes/v2.79/attach-volume-to-server-resp.json @@ -1,10 +1,10 @@ { "volumeAttachment": { - "device": "/dev/vdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "521b9e49-4855-4a9a-8474-759a86c1b12d", + "delete_on_termination": true, + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "09b3b9d1-b8c5-48e1-841d-62c3ef967a88", "tag": "foo", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "delete_on_termination": true + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } -} +} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json b/doc/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json index a6faf7e2f721..26ea4ee7b44d 100644 --- a/doc/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json +++ b/doc/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json @@ -1,20 +1,12 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "fb6077e6-c10d-4e81-87fa-cb0f8c103051", + "delete_on_termination": true, + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "09b3b9d1-b8c5-48e1-841d-62c3ef967a88", "tag": "foo", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "delete_on_termination": false - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "fb6077e6-c10d-4e81-87fa-cb0f8c103051", - "tag": null, - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "delete_on_termination": false + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } ] -} +} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.79/update-volume-req.json b/doc/api_samples/os-volumes/v2.79/update-volume-req.json index d95f96981aa4..e5ad47aa3cce 100644 --- a/doc/api_samples/os-volumes/v2.79/update-volume-req.json +++ b/doc/api_samples/os-volumes/v2.79/update-volume-req.json @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f805" + "volumeId": "227cc671-f30b-4488-96fd-7d0bf13648d8" } -} +} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json b/doc/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json index 172aafc67217..4a54243c2b1c 100644 --- a/doc/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json +++ b/doc/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json @@ -1,10 +1,10 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "delete_on_termination": true, + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "2aad99d3-7aa4-41e9-b4e6-3f960b115d68", "tag": "foo", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "delete_on_termination": false + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } -} +} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/volume-attachment-detail-resp.json b/doc/api_samples/os-volumes/volume-attachment-detail-resp.json index 5375033bb9cd..41b8f21a88c1 100644 --- a/doc/api_samples/os-volumes/volume-attachment-detail-resp.json +++ b/doc/api_samples/os-volumes/volume-attachment-detail-resp.json @@ -1,8 +1,8 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "2390fb4d-1693-45d7-b309-e29c4af16538", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "device": "/dev/sdb", + "id": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113", + "serverId": "1ad6852e-6605-4510-b639-d0bff864b49a", + "volumeId": "a07f71dc-8151-4e7d-a0cc-cd24a3f11113" } } \ No newline at end of file diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/list-volume-attachments-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/list-volume-attachments-resp.json.tpl index 6c1da07ef6f9..6c847d29d248 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/list-volume-attachments-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/list-volume-attachments-resp.json.tpl @@ -1,16 +1,10 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804" + "volumeId": "%(volume_id)s" } ] } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/update-volume-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/update-volume-req.json.tpl index 41411472ab09..85c1244b1438 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/update-volume-req.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/update-volume-req.json.tpl @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "%(volume_id)s" + "volumeId": "%(new_volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json.tpl index 6c1da07ef6f9..6c847d29d248 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/list-volume-attachments-resp.json.tpl @@ -1,16 +1,10 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804" + "volumeId": "%(volume_id)s" } ] } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/update-volume-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/update-volume-req.json.tpl index 41411472ab09..85c1244b1438 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/update-volume-req.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/update-volume-req.json.tpl @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "%(volume_id)s" + "volumeId": "%(new_volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json.tpl index 86099eeb8718..4730b3c197c3 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.49/volume-attachment-detail-resp.json.tpl @@ -1,8 +1,8 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "volumeId": "%(volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json.tpl index 88b3632d9da8..5f2d96bff9cb 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/list-volume-attachments-resp.json.tpl @@ -1,18 +1,11 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", "tag": "%(tag)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "%(uuid)s", - "tag": null, - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804" + "volumeId": "%(volume_id)s" } ] } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/update-volume-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/update-volume-req.json.tpl index 41411472ab09..85c1244b1438 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/update-volume-req.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/update-volume-req.json.tpl @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "%(volume_id)s" + "volumeId": "%(new_volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json.tpl index b8ac7e183392..96f207260c4b 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.70/volume-attachment-detail-resp.json.tpl @@ -1,9 +1,9 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", "tag": "%(tag)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "volumeId": "%(volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json.tpl index 6782aed70e78..db7b4cece656 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/list-volume-attachments-resp.json.tpl @@ -1,20 +1,12 @@ { "volumeAttachments": [ { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", "tag": "%(tag)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "delete_on_termination": false - }, - { - "device": "/dev/sdc", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "serverId": "%(uuid)s", - "tag": null, - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f804", - "delete_on_termination": false + "volumeId": "%(volume_id)s", + "delete_on_termination": true } ] } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/update-volume-req.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/update-volume-req.json.tpl index 41411472ab09..85c1244b1438 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/update-volume-req.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/update-volume-req.json.tpl @@ -1,5 +1,5 @@ { "volumeAttachment": { - "volumeId": "%(volume_id)s" + "volumeId": "%(new_volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json.tpl index 7f4ea81819ac..34eacc94d233 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/v2.79/volume-attachment-detail-resp.json.tpl @@ -1,10 +1,10 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", "tag": "%(tag)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "delete_on_termination": false + "volumeId": "%(volume_id)s", + "delete_on_termination": true } } diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl index 86099eeb8718..4730b3c197c3 100644 --- a/nova/tests/functional/api_sample_tests/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl +++ b/nova/tests/functional/api_sample_tests/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl @@ -1,8 +1,8 @@ { "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", + "device": "%(device)s", + "id": "%(volume_id)s", "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" + "volumeId": "%(volume_id)s" } } diff --git a/nova/tests/functional/api_sample_tests/test_volumes.py b/nova/tests/functional/api_sample_tests/test_volumes.py index f3582cd4bbac..b92c18324d72 100644 --- a/nova/tests/functional/api_sample_tests/test_volumes.py +++ b/nova/tests/functional/api_sample_tests/test_volumes.py @@ -15,16 +15,10 @@ import datetime -from oslo_utils.fixture import uuidsentinel as uuids - -from nova import context -from nova import objects from nova.tests import fixtures from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import test_servers from nova.tests.unit.api.openstack import fakes -from nova.tests.unit import fake_block_device -from nova.tests.unit import fake_instance class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): @@ -198,155 +192,57 @@ class VolumesSampleJsonTest(test_servers.ServersSampleBase): class VolumeAttachmentsSample(test_servers.ServersSampleBase): sample_dir = "os-volumes" - OLD_VOLUME_ID = 'a26887c6-c47b-4654-abb5-dfadf7d3f803' - NEW_VOLUME_ID = 'a26887c6-c47b-4654-abb5-dfadf7d3f805' + OLD_VOLUME_ID = fixtures.CinderFixture.SWAP_OLD_VOL + NEW_VOLUME_ID = fixtures.CinderFixture.SWAP_NEW_VOL - def _get_tags_per_volume(self): - """Allows subclasses to override which volumes have tags - - :returns: dict, keyed by volume ID, to tag value; if a volume ID is - not found in the resulting dict it is assumed to not have a tag - """ - return {} - - # TODO(mriedem): There is really no good reason we should have to stub - # so much of this DB and compute service code when we can just use the - # CinderFixture. The stubs make these tests very brittle and potentially - # false regarding how the API/compute service interaction works. - - def _stub_db_bdms_get_all_by_instance(self, server_id): - - def fake_bdms_get_all_by_instance(context, instance_uuid, - use_slave=False): - bdms = [ - fake_block_device.FakeDbBlockDeviceDict( - {'id': 1, 'volume_id': self.OLD_VOLUME_ID, - 'instance_uuid': server_id, 'source_type': 'volume', - 'destination_type': 'volume', 'device_name': '/dev/sdd'}), - fake_block_device.FakeDbBlockDeviceDict( - {'id': 2, 'volume_id': 'a26887c6-c47b-4654-abb5-dfadf7d3f804', - 'instance_uuid': server_id, 'source_type': 'volume', - 'destination_type': 'volume', 'device_name': '/dev/sdc'}) - ] - tags_per_volume = self._get_tags_per_volume() - for bdm_dict in bdms: - bdm_dict['tag'] = tags_per_volume.get(bdm_dict['volume_id']) - return bdms - - self.stub_out('nova.db.api.block_device_mapping_get_all_by_instance', - fake_bdms_get_all_by_instance) - - def fake_bdm_get_by_volume_and_instance( - self, ctxt, volume_id, instance_uuid, expected_attrs=None): - tag = self._get_tags_per_volume().get(self.OLD_VOLUME_ID) - return objects.BlockDeviceMapping._from_db_object( - ctxt, objects.BlockDeviceMapping(), - fake_block_device.FakeDbBlockDeviceDict( - {'id': 1, 'volume_id': self.OLD_VOLUME_ID, - 'instance_uuid': instance_uuid, 'source_type': 'volume', - 'destination_type': 'volume', 'device_name': '/dev/sdd', - 'tag': tag, 'delete_on_termination': False}) - ) - - def _stub_compute_api_get(self): - - def fake_compute_api_get(self, context, instance_id, - expected_attrs=None, - cell_down_support=False): - return fake_instance.fake_instance_obj( - context, **{'uuid': instance_id}) - - self.stub_out('nova.compute.api.API.get', fake_compute_api_get) + def setUp(self): + super(VolumeAttachmentsSample, self).setUp() + self.useFixture(fixtures.CinderFixture(self)) + self.server_id = self._post_server() def _get_vol_attachment_subs(self, subs): """Allows subclasses to override/supplement request/response subs""" return subs def test_attach_volume_to_server(self): - self.stub_out('nova.volume.cinder.API.get', fakes.stub_volume_get) - self.stub_out('nova.volume.cinder.API.attachment_create', - lambda *a, **k: {'id': uuids.volume}) - device_name = '/dev/vdd' - bdm = objects.BlockDeviceMapping() - bdm['device_name'] = device_name - bdm['delete_on_termination'] = True - self.stub_out( - 'nova.compute.manager.ComputeManager.reserve_block_device_name', - lambda *a, **k: bdm) - # 2.79+ will save the delete_on_termination value on the BDM after - # reserve_block_device_name "creates" the BDM. - self.stub_out('nova.objects.BlockDeviceMapping.save', - lambda *a, **k: None) - self.stub_out( - 'nova.compute.manager.ComputeManager.attach_volume', - lambda *a, **k: None) - - volume = fakes.stub_volume_get(None, context.get_admin_context(), - 'a26887c6-c47b-4654-abb5-dfadf7d3f803') subs = { - 'volume_id': volume['id'], - 'device': device_name + 'volume_id': self.OLD_VOLUME_ID, + 'device': '/dev/sdb' } - server_id = self._post_server() subs = self._get_vol_attachment_subs(subs) response = self._do_post('servers/%s/os-volume_attachments' - % server_id, + % self.server_id, 'attach-volume-to-server-req', subs) - self._verify_response('attach-volume-to-server-resp', subs, response, 200) + return subs def test_list_volume_attachments(self): - server_id = self._post_server() - self._stub_db_bdms_get_all_by_instance(server_id) - + subs = self.test_attach_volume_to_server() response = self._do_get('servers/%s/os-volume_attachments' - % server_id) - subs = self._get_vol_attachment_subs({}) + % self.server_id) self._verify_response('list-volume-attachments-resp', subs, response, 200) def test_volume_attachment_detail(self): - server_id = self._post_server() - self.stub_out( - 'nova.objects.BlockDeviceMapping.get_by_volume_and_instance', - self.fake_bdm_get_by_volume_and_instance) - self._stub_compute_api_get() + subs = self.test_attach_volume_to_server() response = self._do_get('servers/%s/os-volume_attachments/%s' - % (server_id, self.OLD_VOLUME_ID)) - subs = self._get_vol_attachment_subs({}) + % (self.server_id, subs['volume_id'])) self._verify_response('volume-attachment-detail-resp', subs, response, 200) def test_volume_attachment_delete(self): - server_id = self._post_server() - self.stub_out( - 'nova.objects.BlockDeviceMapping.get_by_volume_and_instance', - self.fake_bdm_get_by_volume_and_instance) - self._stub_compute_api_get() - self.stub_out('nova.volume.cinder.API.get', fakes.stub_volume_get) - self.stub_out('nova.compute.api.API.detach_volume', - lambda *a, **k: None) + subs = self.test_attach_volume_to_server() response = self._do_delete('servers/%s/os-volume_attachments/%s' - % (server_id, self.OLD_VOLUME_ID)) + % (self.server_id, subs['volume_id'])) self.assertEqual(202, response.status_code) self.assertEqual('', response.text) def test_volume_attachment_update(self): - self.stub_out('nova.volume.cinder.API.get', fakes.stub_volume_get) - subs = { - 'volume_id': self.NEW_VOLUME_ID - } - server_id = self._post_server() - self.stub_out( - 'nova.objects.BlockDeviceMapping.get_by_volume_and_instance', - self.fake_bdm_get_by_volume_and_instance) - self._stub_compute_api_get() - self.stub_out('nova.volume.cinder.API.get', fakes.stub_volume_get) - self.stub_out('nova.compute.api.API.swap_volume', - lambda *a, **k: None) + subs = self.test_attach_volume_to_server() + subs['new_volume_id'] = self.NEW_VOLUME_ID response = self._do_put('servers/%s/os-volume_attachments/%s' - % (server_id, self.OLD_VOLUME_ID), + % (self.server_id, subs['volume_id']), 'update-volume-req', subs) self.assertEqual(202, response.status_code) @@ -360,7 +256,11 @@ class VolumeAttachmentsSampleV249(VolumeAttachmentsSample): def setUp(self): super(VolumeAttachmentsSampleV249, self).setUp() - self.useFixture(fixtures.CinderFixture(self)) + # Stub out ComputeManager._delete_disk_metadata since the fake virt + # driver does not actually update the instance.device_metadata.devices + # list with the tagged bdm disk device metadata. + self.stub_out('nova.compute.manager.ComputeManager.' + '_delete_disk_metadata', lambda *a, **kw: None) def _get_vol_attachment_subs(self, subs): return dict(subs, tag='foo') @@ -371,12 +271,6 @@ class VolumeAttachmentsSampleV270(VolumeAttachmentsSampleV249): microversion = '2.70' scenarios = [('v2_70', {'api_major_version': 'v2.1'})] - def _get_tags_per_volume(self): - return { - self.OLD_VOLUME_ID: 'foo', - self.NEW_VOLUME_ID: None - } - class VolumeAttachmentsSampleV279(VolumeAttachmentsSampleV270): """Microversion 2.79 adds the "delete_on_termination" parameter to the