diff --git a/doc/api_samples/os-volume-attachment-update/update-volume-req.json b/doc/api_samples/os-volume-attachment-update/update-volume-req.json deleted file mode 100644 index 09b42cf996..0000000000 --- a/doc/api_samples/os-volume-attachment-update/update-volume-req.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f805", - "device": "/dev/sdd" - } -} \ No newline at end of file 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 deleted file mode 100644 index 4062687fc3..0000000000 --- a/doc/api_samples/os-volumes/attach-volume-to-server-req.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "volumeAttachment": { - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "device": "/dev/vdd" - } -} \ 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 deleted file mode 100644 index 2e512ac990..0000000000 --- a/doc/api_samples/os-volumes/attach-volume-to-server-resp.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "volumeAttachment": { - "device": "/dev/vdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "0c92f3f6-c253-4c9b-bd43-e880a8d2eb0a", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } -} \ 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 deleted file mode 100644 index 9ae9b4a2aa..0000000000 --- a/doc/api_samples/os-volumes/list-volume-attachments-resp.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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" - } - ] -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/os-volumes-detail-resp.json b/doc/api_samples/os-volumes/os-volumes-detail-resp.json deleted file mode 100644 index 6a92f5e0d5..0000000000 --- a/doc/api_samples/os-volumes/os-volumes-detail-resp.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "volumes": [ - { - "attachments": [ - { - "device": "/", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "3912f2b4-c5ba-4aec-9165-872876fe202e", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "1999-01-01T01:01:01.000000", - "displayDescription": "Volume Description", - "displayName": "Volume Name", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } - ] -} diff --git a/doc/api_samples/os-volumes/os-volumes-get-resp.json b/doc/api_samples/os-volumes/os-volumes-get-resp.json deleted file mode 100644 index 5c8429cb1b..0000000000 --- a/doc/api_samples/os-volumes/os-volumes-get-resp.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "volume": { - "attachments": [ - { - "device": "/", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "3912f2b4-c5ba-4aec-9165-872876fe202e", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "2013-02-18T14:51:18.528085", - "displayDescription": "Volume Description", - "displayName": "Volume Name", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/os-volumes-index-resp.json b/doc/api_samples/os-volumes/os-volumes-index-resp.json deleted file mode 100644 index c0fa4b8917..0000000000 --- a/doc/api_samples/os-volumes/os-volumes-index-resp.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "volumes": [ - { - "attachments": [ - { - "device": "/", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "3912f2b4-c5ba-4aec-9165-872876fe202e", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "2013-02-19T20:01:40.274897", - "displayDescription": "Volume Description", - "displayName": "Volume Name", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } - ] -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/os-volumes-post-req.json b/doc/api_samples/os-volumes/os-volumes-post-req.json deleted file mode 100644 index c8b218adbe..0000000000 --- a/doc/api_samples/os-volumes/os-volumes-post-req.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "volume": - { - "availability_zone": "zone1:host1", - "display_name": "Volume Name", - "display_description": "Volume Description", - "size": 100 - } -} diff --git a/doc/api_samples/os-volumes/os-volumes-post-resp.json b/doc/api_samples/os-volumes/os-volumes-post-resp.json deleted file mode 100644 index ba3795a0bb..0000000000 --- a/doc/api_samples/os-volumes/os-volumes-post-resp.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "volume": { - "attachments": [ - { - "device": "/", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "3912f2b4-c5ba-4aec-9165-872876fe202e", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "2013-02-18T14:51:17.970024", - "displayDescription": "Volume Description", - "displayName": "Volume Name", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/snapshot-create-req.json b/doc/api_samples/os-volumes/snapshot-create-req.json deleted file mode 100644 index 8ad5b3cb04..0000000000 --- a/doc/api_samples/os-volumes/snapshot-create-req.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "snapshot": { - "display_name": "snap-001", - "display_description": "Daily backup", - "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c", - "force": false - } -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/snapshot-create-resp.json b/doc/api_samples/os-volumes/snapshot-create-resp.json deleted file mode 100644 index a8dd57d841..0000000000 --- a/doc/api_samples/os-volumes/snapshot-create-resp.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "snapshot": { - "createdAt": "2013-02-25T16:27:54.680544", - "displayDescription": "Daily backup", - "displayName": "snap-001", - "id": 100, - "size": 100, - "status": "available", - "volumeId": "521752a6-acf6-4b2d-bc7a-119f9148cd8c" - } -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/snapshots-detail-resp.json b/doc/api_samples/os-volumes/snapshots-detail-resp.json deleted file mode 100644 index 796e522c43..0000000000 --- a/doc/api_samples/os-volumes/snapshots-detail-resp.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "snapshots": [ - { - "createdAt": "2013-02-25T16:27:54.671372", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 100, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "2013-02-25T16:27:54.671378", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 101, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "2013-02-25T16:27:54.671381", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 102, - "size": 100, - "status": "available", - "volumeId": 12 - } - ] -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/snapshots-list-resp.json b/doc/api_samples/os-volumes/snapshots-list-resp.json deleted file mode 100644 index 9b7cb412a8..0000000000 --- a/doc/api_samples/os-volumes/snapshots-list-resp.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "snapshots": [ - { - "createdAt": "2013-02-25T16:27:54.684999", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 100, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "2013-02-25T16:27:54.685005", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 101, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "2013-02-25T16:27:54.685008", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 102, - "size": 100, - "status": "available", - "volumeId": 12 - } - ] -} \ No newline at end of file diff --git a/doc/api_samples/os-volumes/snapshots-show-resp.json b/doc/api_samples/os-volumes/snapshots-show-resp.json deleted file mode 100644 index d7b3f26e41..0000000000 --- a/doc/api_samples/os-volumes/snapshots-show-resp.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "snapshot": { - "createdAt": "2013-02-25T16:27:54.724209", - "displayDescription": "Default description", - "displayName": "Default name", - "id": "100", - "size": 100, - "status": "available", - "volumeId": 12 - } -} \ 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 deleted file mode 100644 index 5375033bb9..0000000000 --- a/doc/api_samples/os-volumes/volume-attachment-detail-resp.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "2390fb4d-1693-45d7-b309-e29c4af16538", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } -} \ No newline at end of file diff --git a/nova/tests/functional/api_samples/os-volume-attachment-update/update-volume-req.json.tpl b/nova/tests/functional/api_samples/os-volume-attachment-update/update-volume-req.json.tpl deleted file mode 100644 index 3d360a57bc..0000000000 --- a/nova/tests/functional/api_samples/os-volume-attachment-update/update-volume-req.json.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{ - "volumeAttachment": { - "volumeId": "%(volume_id)s", - "device": "%(device)s" - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/attach-volume-to-server-req.json.tpl b/nova/tests/functional/api_samples/os-volumes/attach-volume-to-server-req.json.tpl deleted file mode 100644 index 3d360a57bc..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/attach-volume-to-server-req.json.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{ - "volumeAttachment": { - "volumeId": "%(volume_id)s", - "device": "%(device)s" - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/attach-volume-to-server-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/attach-volume-to-server-resp.json.tpl deleted file mode 100644 index 4730b3c197..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/attach-volume-to-server-resp.json.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{ - "volumeAttachment": { - "device": "%(device)s", - "id": "%(volume_id)s", - "serverId": "%(uuid)s", - "volumeId": "%(volume_id)s" - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/list-volume-attachments-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/list-volume-attachments-resp.json.tpl deleted file mode 100644 index 6c1da07ef6..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/list-volume-attachments-resp.json.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{ - "volumeAttachments": [ - { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "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" - } - ] -} diff --git a/nova/tests/functional/api_samples/os-volumes/os-volumes-detail-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/os-volumes-detail-resp.json.tpl deleted file mode 100644 index 82a63eda5f..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/os-volumes-detail-resp.json.tpl +++ /dev/null @@ -1,24 +0,0 @@ -{ - "volumes": [ - { - "attachments": [ - { - "device": "/", - "id": "%(uuid)s", - "serverId": "%(uuid)s", - "volumeId": "%(uuid)s" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "%(strtime)s", - "displayDescription": "%(volume_desc)s", - "displayName": "%(volume_name)s", - "id": "%(uuid)s", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } - ] -} diff --git a/nova/tests/functional/api_samples/os-volumes/os-volumes-get-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/os-volumes-get-resp.json.tpl deleted file mode 100644 index 84bfdd2a5b..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/os-volumes-get-resp.json.tpl +++ /dev/null @@ -1,22 +0,0 @@ -{ - "volume": { - "attachments": [ - { - "device": "/", - "id": "%(uuid)s", - "serverId": "%(uuid)s", - "volumeId": "%(uuid)s" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "%(strtime)s", - "displayDescription": "%(volume_desc)s", - "displayName": "%(volume_name)s", - "id": "%(uuid)s", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/os-volumes-index-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/os-volumes-index-resp.json.tpl deleted file mode 100644 index 82a63eda5f..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/os-volumes-index-resp.json.tpl +++ /dev/null @@ -1,24 +0,0 @@ -{ - "volumes": [ - { - "attachments": [ - { - "device": "/", - "id": "%(uuid)s", - "serverId": "%(uuid)s", - "volumeId": "%(uuid)s" - } - ], - "availabilityZone": "zone1:host1", - "createdAt": "%(strtime)s", - "displayDescription": "%(volume_desc)s", - "displayName": "%(volume_name)s", - "id": "%(uuid)s", - "metadata": {}, - "size": 100, - "snapshotId": null, - "status": "in-use", - "volumeType": "Backup" - } - ] -} diff --git a/nova/tests/functional/api_samples/os-volumes/os-volumes-post-req.json.tpl b/nova/tests/functional/api_samples/os-volumes/os-volumes-post-req.json.tpl deleted file mode 100644 index db7fbff4d4..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/os-volumes-post-req.json.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{ - "volume": - { - "availability_zone": "zone1:host1", - "display_name": "%(volume_name)s", - "display_description": "%(volume_desc)s", - "size": 100 - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/os-volumes-post-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/os-volumes-post-resp.json.tpl deleted file mode 100644 index d13ce20cc3..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/os-volumes-post-resp.json.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{ - "volume": { - "status": "in-use", - "displayDescription": "%(volume_desc)s", - "availabilityZone": "zone1:host1", - "displayName": "%(volume_name)s", - "attachments": [ - { "device": "/", - "serverId": "%(uuid)s", - "id": "%(uuid)s", - "volumeId": "%(uuid)s" - } - ], - "volumeType": "Backup", - "snapshotId": null, - "metadata": {}, - "id": "%(uuid)s", - "createdAt": "%(strtime)s", - "size": 100 - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/snapshot-create-req.json.tpl b/nova/tests/functional/api_samples/os-volumes/snapshot-create-req.json.tpl deleted file mode 100644 index a8d47ea031..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/snapshot-create-req.json.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{ - "snapshot": { - "display_name": "%(snapshot_name)s", - "display_description": "%(description)s", - "volume_id": "%(volume_id)s", - "force": false - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/snapshot-create-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/snapshot-create-resp.json.tpl deleted file mode 100644 index 6153e8140e..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/snapshot-create-resp.json.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{ - "snapshot": { - "createdAt": "%(strtime)s", - "displayDescription": "%(description)s", - "displayName": "%(snapshot_name)s", - "id": 100, - "size": 100, - "status": "available", - "volumeId": "%(uuid)s" - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/snapshots-detail-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/snapshots-detail-resp.json.tpl deleted file mode 100644 index 1b509d54f8..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/snapshots-detail-resp.json.tpl +++ /dev/null @@ -1,31 +0,0 @@ -{ - "snapshots": [ - { - "createdAt": "%(strtime)s", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 100, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "%(strtime)s", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 101, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "%(strtime)s", - "displayDescription": "Default description", - "displayName": "Default name", - "id": 102, - "size": 100, - "status": "available", - "volumeId": 12 - } - ] -} diff --git a/nova/tests/functional/api_samples/os-volumes/snapshots-list-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/snapshots-list-resp.json.tpl deleted file mode 100644 index c65d073ad7..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/snapshots-list-resp.json.tpl +++ /dev/null @@ -1,31 +0,0 @@ -{ - "snapshots": [ - { - "createdAt": "%(strtime)s", - "displayDescription": "%(text)s", - "displayName": "%(text)s", - "id": 100, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "%(strtime)s", - "displayDescription": "%(text)s", - "displayName": "%(text)s", - "id": 101, - "size": 100, - "status": "available", - "volumeId": 12 - }, - { - "createdAt": "%(strtime)s", - "displayDescription": "%(text)s", - "displayName": "%(text)s", - "id": 102, - "size": 100, - "status": "available", - "volumeId": 12 - } - ] -} diff --git a/nova/tests/functional/api_samples/os-volumes/snapshots-show-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/snapshots-show-resp.json.tpl deleted file mode 100644 index a9ab6240d6..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/snapshots-show-resp.json.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{ - "snapshot": { - "createdAt": "%(strtime)s", - "displayDescription": "%(description)s", - "displayName": "%(snapshot_name)s", - "id": "100", - "size": 100, - "status": "available", - "volumeId": 12 - } -} diff --git a/nova/tests/functional/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl b/nova/tests/functional/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl deleted file mode 100644 index 86099eeb87..0000000000 --- a/nova/tests/functional/api_samples/os-volumes/volume-attachment-detail-resp.json.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{ - "volumeAttachment": { - "device": "/dev/sdd", - "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803", - "serverId": "%(uuid)s", - "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803" - } -} diff --git a/nova/tests/functional/test_api_samples.py b/nova/tests/functional/test_api_samples.py index 7373b37922..f6f8e6a704 100644 --- a/nova/tests/functional/test_api_samples.py +++ b/nova/tests/functional/test_api_samples.py @@ -37,12 +37,10 @@ from nova.cells import utils as cells_utils from nova.cloudpipe import pipelib from nova.compute import api as compute_api from nova.compute import cells_api as cells_api -from nova.compute import manager as compute_manager from nova.compute import rpcapi as compute_rpcapi from nova.compute import vm_states from nova.conductor import manager as conductor_manager from nova.console import manager as console_manager # noqa - only for cfg -from nova import context from nova import db from nova import exception from nova.network import api as network_api @@ -56,8 +54,6 @@ from nova.tests.unit.api.openstack.compute.contrib import test_fping from nova.tests.unit.api.openstack.compute.contrib import test_networks from nova.tests.unit.api.openstack.compute.contrib import test_services from nova.tests.unit.api.openstack import fakes -from nova.tests.unit import fake_block_device -from nova.tests.unit import fake_instance from nova.tests.unit import fake_network from nova.tests.unit import fake_network_cache_model from nova.tests.unit import fake_utils @@ -2383,64 +2379,6 @@ class AttachInterfacesSampleJsonTest(ServersSampleBase): self.assertEqual(response.content, '') -class SnapshotsSampleJsonTests(ApiSampleTestBaseV2): - extension_name = "nova.api.openstack.compute.contrib.volumes.Volumes" - - create_subs = { - 'snapshot_name': 'snap-001', - 'description': 'Daily backup', - 'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c' - } - - def setUp(self): - super(SnapshotsSampleJsonTests, self).setUp() - self.stubs.Set(cinder.API, "get_all_snapshots", - fakes.stub_snapshot_get_all) - self.stubs.Set(cinder.API, "get_snapshot", fakes.stub_snapshot_get) - - def _create_snapshot(self): - self.stubs.Set(cinder.API, "create_snapshot", - fakes.stub_snapshot_create) - - response = self._do_post("os-snapshots", - "snapshot-create-req", - self.create_subs) - return response - - def test_snapshots_create(self): - response = self._create_snapshot() - self.create_subs.update(self._get_regexes()) - self._verify_response("snapshot-create-resp", - self.create_subs, response, 200) - - def test_snapshots_delete(self): - self.stubs.Set(cinder.API, "delete_snapshot", - fakes.stub_snapshot_delete) - self._create_snapshot() - response = self._do_delete('os-snapshots/100') - self.assertEqual(response.status_code, 202) - self.assertEqual(response.content, '') - - def test_snapshots_detail(self): - response = self._do_get('os-snapshots/detail') - subs = self._get_regexes() - self._verify_response('snapshots-detail-resp', subs, response, 200) - - def test_snapshots_list(self): - response = self._do_get('os-snapshots') - subs = self._get_regexes() - self._verify_response('snapshots-list-resp', subs, response, 200) - - def test_snapshots_show(self): - response = self._do_get('os-snapshots/100') - subs = { - 'snapshot_name': 'Default name', - 'description': 'Default description' - } - subs.update(self._get_regexes()) - self._verify_response('snapshots-show-resp', subs, response, 200) - - class AssistedVolumeSnapshotsJsonTest(ApiSampleTestBaseV2): """Assisted volume snapshots.""" extension_name = ("nova.api.openstack.compute.contrib." @@ -2481,238 +2419,6 @@ class AssistedVolumeSnapshotsJsonTest(ApiSampleTestBaseV2): self.assertEqual(response.content, '') -class VolumeAttachmentsSampleBase(ServersSampleBase): - 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': 'a26887c6-c47b-4654-abb5-dfadf7d3f803', - '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'}) - ] - return bdms - - self.stubs.Set(db, 'block_device_mapping_get_all_by_instance', - fake_bdms_get_all_by_instance) - - def _stub_compute_api_get(self): - - def fake_compute_api_get(self, context, instance_id, - want_objects=False, expected_attrs=None): - if want_objects: - return fake_instance.fake_instance_obj( - context, **{'uuid': instance_id}) - else: - return {'uuid': instance_id} - - self.stubs.Set(compute_api.API, 'get', fake_compute_api_get) - - -class VolumeAttachmentsSampleJsonTest(VolumeAttachmentsSampleBase): - extension_name = ("nova.api.openstack.compute.contrib.volumes.Volumes") - - def test_attach_volume_to_server(self): - self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get) - self.stubs.Set(cinder.API, 'check_attach', lambda *a, **k: None) - self.stubs.Set(cinder.API, 'reserve_volume', lambda *a, **k: None) - device_name = '/dev/vdd' - bdm = objects.BlockDeviceMapping() - bdm['device_name'] = device_name - self.stubs.Set(compute_manager.ComputeManager, - "reserve_block_device_name", - lambda *a, **k: bdm) - self.stubs.Set(compute_manager.ComputeManager, - 'attach_volume', - lambda *a, **k: None) - self.stubs.Set(objects.BlockDeviceMapping, 'get_by_volume_id', - classmethod(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 - } - server_id = self._post_server() - response = self._do_post('servers/%s/os-volume_attachments' - % server_id, - 'attach-volume-to-server-req', subs) - - subs.update(self._get_regexes()) - self._verify_response('attach-volume-to-server-resp', subs, - response, 200) - - def test_list_volume_attachments(self): - server_id = self._post_server() - - self._stub_db_bdms_get_all_by_instance(server_id) - - response = self._do_get('servers/%s/os-volume_attachments' - % server_id) - subs = self._get_regexes() - self._verify_response('list-volume-attachments-resp', subs, - response, 200) - - def test_volume_attachment_detail(self): - server_id = self._post_server() - attach_id = "a26887c6-c47b-4654-abb5-dfadf7d3f803" - self._stub_db_bdms_get_all_by_instance(server_id) - self._stub_compute_api_get() - response = self._do_get('servers/%s/os-volume_attachments/%s' - % (server_id, attach_id)) - subs = self._get_regexes() - self._verify_response('volume-attachment-detail-resp', subs, - response, 200) - - def test_volume_attachment_delete(self): - server_id = self._post_server() - attach_id = "a26887c6-c47b-4654-abb5-dfadf7d3f803" - self._stub_db_bdms_get_all_by_instance(server_id) - self._stub_compute_api_get() - self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get) - self.stubs.Set(compute_api.API, 'detach_volume', lambda *a, **k: None) - response = self._do_delete('servers/%s/os-volume_attachments/%s' - % (server_id, attach_id)) - self.assertEqual(response.status_code, 202) - self.assertEqual(response.content, '') - - -class VolumeAttachUpdateSampleJsonTest(VolumeAttachmentsSampleBase): - extends_name = ("nova.api.openstack.compute.contrib.volumes.Volumes") - extension_name = ("nova.api.openstack.compute.contrib." - "volume_attachment_update.Volume_attachment_update") - - def test_volume_attachment_update(self): - self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get) - subs = { - 'volume_id': 'a26887c6-c47b-4654-abb5-dfadf7d3f805', - 'device': '/dev/sdd' - } - server_id = self._post_server() - attach_id = 'a26887c6-c47b-4654-abb5-dfadf7d3f803' - self._stub_db_bdms_get_all_by_instance(server_id) - self._stub_compute_api_get() - self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get) - self.stubs.Set(compute_api.API, 'swap_volume', lambda *a, **k: None) - response = self._do_put('servers/%s/os-volume_attachments/%s' - % (server_id, attach_id), - 'update-volume-req', - subs) - self.assertEqual(response.status_code, 202) - self.assertEqual(response.content, '') - - -class VolumesSampleJsonTest(ServersSampleBase): - extension_name = ("nova.api.openstack.compute.contrib.volumes.Volumes") - - def _get_volume_id(self): - return 'a26887c6-c47b-4654-abb5-dfadf7d3f803' - - def _stub_volume(self, id, displayname="Volume Name", - displaydesc="Volume Description", size=100): - volume = { - 'id': id, - 'size': size, - 'availability_zone': 'zone1:host1', - 'instance_uuid': '3912f2b4-c5ba-4aec-9165-872876fe202e', - 'mountpoint': '/', - 'status': 'in-use', - 'attach_status': 'attached', - 'name': 'vol name', - 'display_name': displayname, - 'display_description': displaydesc, - 'created_at': datetime.datetime(2008, 12, 1, 11, 1, 55), - 'snapshot_id': None, - 'volume_type_id': 'fakevoltype', - 'volume_metadata': [], - 'volume_type': {'name': 'Backup'} - } - return volume - - def _stub_volume_get(self, context, volume_id): - return self._stub_volume(volume_id) - - def _stub_volume_delete(self, context, *args, **param): - pass - - def _stub_volume_get_all(self, context, search_opts=None): - id = self._get_volume_id() - return [self._stub_volume(id)] - - def _stub_volume_create(self, context, size, name, description, snapshot, - **param): - id = self._get_volume_id() - return self._stub_volume(id) - - def setUp(self): - super(VolumesSampleJsonTest, self).setUp() - fakes.stub_out_networking(self.stubs) - fakes.stub_out_rate_limiting(self.stubs) - - self.stubs.Set(cinder.API, "delete", self._stub_volume_delete) - self.stubs.Set(cinder.API, "get", self._stub_volume_get) - self.stubs.Set(cinder.API, "get_all", self._stub_volume_get_all) - - def _post_volume(self): - subs_req = { - 'volume_name': "Volume Name", - 'volume_desc': "Volume Description", - } - - self.stubs.Set(cinder.API, "create", self._stub_volume_create) - response = self._do_post('os-volumes', 'os-volumes-post-req', - subs_req) - subs = self._get_regexes() - subs.update(subs_req) - self._verify_response('os-volumes-post-resp', subs, response, 200) - - def test_volumes_show(self): - subs = { - 'volume_name': "Volume Name", - 'volume_desc': "Volume Description", - } - vol_id = self._get_volume_id() - response = self._do_get('os-volumes/%s' % vol_id) - subs.update(self._get_regexes()) - self._verify_response('os-volumes-get-resp', subs, response, 200) - - def test_volumes_index(self): - subs = { - 'volume_name': "Volume Name", - 'volume_desc': "Volume Description", - } - response = self._do_get('os-volumes') - subs.update(self._get_regexes()) - self._verify_response('os-volumes-index-resp', subs, response, 200) - - def test_volumes_detail(self): - # For now, index and detail are the same. - # See the volumes api - subs = { - 'volume_name': "Volume Name", - 'volume_desc': "Volume Description", - } - response = self._do_get('os-volumes/detail') - subs.update(self._get_regexes()) - self._verify_response('os-volumes-detail-resp', subs, response, 200) - - def test_volumes_create(self): - self._post_volume() - - def test_volumes_delete(self): - self._post_volume() - vol_id = self._get_volume_id() - response = self._do_delete('os-volumes/%s' % vol_id) - self.assertEqual(response.status_code, 202) - self.assertEqual(response.content, '') - - class PreserveEphemeralOnRebuildJsonTest(ServersSampleBase): extension_name = ('nova.api.openstack.compute.contrib.' 'preserve_ephemeral_rebuild.' diff --git a/nova/tests/functional/v3/test_volumes.py b/nova/tests/functional/v3/test_volumes.py index 9b8640d2bc..0f8183bbd6 100644 --- a/nova/tests/functional/v3/test_volumes.py +++ b/nova/tests/functional/v3/test_volumes.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_config import cfg + import datetime from nova.compute import api as compute_api @@ -27,9 +29,17 @@ from nova.tests.unit import fake_block_device from nova.tests.unit import fake_instance from nova.volume import cinder +CONF = cfg.CONF +CONF.import_opt('osapi_compute_extension', + 'nova.api.openstack.compute.extensions') + class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3): extension_name = "os-volumes" + # TODO(park): Overriding '_api_version' till all functional tests + # are merged between v2 and v2.1. After that base class variable + # itself can be changed to 'v2' + _api_version = 'v2' create_subs = { 'snapshot_name': 'snap-001', @@ -37,6 +47,13 @@ class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3): 'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c' } + def _get_flags(self): + f = super(SnapshotsSampleJsonTests, self)._get_flags() + f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] + f['osapi_compute_extension'].append( + 'nova.api.openstack.compute.contrib.volumes.Volumes') + return f + def setUp(self): super(SnapshotsSampleJsonTests, self).setUp() self.stubs.Set(cinder.API, "get_all_snapshots", @@ -88,6 +105,17 @@ class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV3): class VolumesSampleJsonTest(test_servers.ServersSampleBase): extension_name = "os-volumes" + # TODO(park): Overriding '_api_version' till all functional tests + # are merged between v2 and v2.1. After that base class variable + # itself can be changed to 'v2' + _api_version = 'v2' + + def _get_flags(self): + f = super(VolumesSampleJsonTest, self)._get_flags() + f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] + f['osapi_compute_extension'].append( + 'nova.api.openstack.compute.contrib.volumes.Volumes') + return f def _get_volume_id(self): return 'a26887c6-c47b-4654-abb5-dfadf7d3f803' @@ -225,7 +253,22 @@ class VolumeAttachmentsSampleBase(test_servers.ServersSampleBase): class VolumeAttachmentsSampleJsonTest(VolumeAttachmentsSampleBase): + extra_extensions_to_load = ["os-access-ips"] extension_name = "os-volumes" + # TODO(park): Overriding '_api_version' till all functional tests + # are merged between v2 and v2.1. After that base class variable + # itself can be changed to 'v2' + _api_version = 'v2' + + def _get_flags(self): + f = super(VolumeAttachmentsSampleJsonTest, self)._get_flags() + f['osapi_compute_extension'] = CONF.osapi_compute_extension[:] + f['osapi_compute_extension'].append( + 'nova.api.openstack.compute.contrib.volumes.Volumes') + f['osapi_compute_extension'].append( + 'nova.api.openstack.compute.contrib.' + 'volume_attachment_update.Volume_attachment_update') + return f def test_attach_volume_to_server(self): self.stubs.Set(cinder.API, 'get', fakes.stub_volume_get)