summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangbailin <zhangbailin@inspur.com>2020-02-06 19:34:07 +0800
committerBrin Zhang <zhangbailin@inspur.com>2020-03-30 03:02:31 +0000
commit59156bdf0139fa174dd09dd9d95ce06d5db39c1b (patch)
tree06f8407fff64afbb9de7c0a43f32775648276a71
parent54973653863adefdb730fcb087685a09913874dc (diff)
downloadnova-59156bdf0139fa174dd09dd9d95ce06d5db39c1b.tar.gz
Add instance actions v284 samples test
Implements blueprint action-event-fault-details Change-Id: I8e8a5ca1efe4a3554038dcddc503c3030956e0b9
-rw-r--r--api-ref/source/os-instance-actions.inc6
-rw-r--r--api-ref/source/parameters.yaml7
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json21
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json24
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json24
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json24
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json14
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json20
-rw-r--r--doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json14
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json.tpl21
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json.tpl24
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json.tpl24
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json.tpl24
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json.tpl14
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json.tpl20
-rw-r--r--nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json.tpl14
-rw-r--r--nova/tests/functional/api_sample_tests/test_instance_actions.py9
17 files changed, 304 insertions, 0 deletions
diff --git a/api-ref/source/os-instance-actions.inc b/api-ref/source/os-instance-actions.inc
index 12100d1866..f0c191c67a 100644
--- a/api-ref/source/os-instance-actions.inc
+++ b/api-ref/source/os-instance-actions.inc
@@ -114,6 +114,7 @@ Response
- events.traceback: event_traceback
- events.hostId: event_hostId
- events.host: event_host
+ - events.details: event_details
- updated_at: updated_instance_action
**Example Show Server Action Details For Admin (v2.62)**
@@ -125,3 +126,8 @@ Response
.. literalinclude:: ../../doc/api_samples/os-instance-actions/v2.62/instance-action-get-non-admin-resp.json
:language: javascript
+
+**Example Show Server Action Details For System Reader (v2.84)**
+
+.. literalinclude:: ../../doc/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json
+ :language: javascript
diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml
index fc579791c7..4dff3fcf2b 100644
--- a/api-ref/source/parameters.yaml
+++ b/api-ref/source/parameters.yaml
@@ -2611,6 +2611,13 @@ event:
in: body
required: true
type: string
+event_details:
+ min_version: 2.84
+ description: |
+ Details of the event. May be ``null``.
+ in: body
+ required: true
+ type: string
event_finish_time:
description: |
The date and time when the event was finished. The date and time
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json b/doc/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json
new file mode 100644
index 0000000000..115604d6ac
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json
@@ -0,0 +1,21 @@
+{
+ "instanceAction": {
+ "action": "stop",
+ "events": [
+ {
+ "event": "compute_stop_instance",
+ "finish_time": "2018-04-25T01:26:34.784165",
+ "hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
+ "result": "Success",
+ "start_time": "2018-04-25T01:26:34.612020"
+ }
+ ],
+ "instance_uuid": "79edaa44-ad4f-4af7-b994-154518c2b927",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-8eb28d4a-db6c-4337-bab8-ce154e9c620e",
+ "start_time": "2018-04-25T01:26:34.388280",
+ "updated_at": "2018-04-25T01:26:34.784165",
+ "user_id": "fake"
+ }
+} \ No newline at end of file
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json b/doc/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json
new file mode 100644
index 0000000000..3285f39ef6
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json
@@ -0,0 +1,24 @@
+{
+ "instanceAction": {
+ "action": "stop",
+ "events": [
+ {
+ "event": "compute_stop_instance",
+ "finish_time": "2018-04-25T01:26:36.790544",
+ "host": "compute",
+ "hostId": "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6",
+ "result": "Success",
+ "start_time": "2018-04-25T01:26:36.539271",
+ "traceback": null,
+ "details": null
+ }
+ ],
+ "instance_uuid": "4bf3473b-d550-4b65-9409-292d44ab14a2",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-0d819d5c-1527-4669-bdf0-ffad31b5105b",
+ "start_time": "2018-04-25T01:26:36.341290",
+ "updated_at": "2018-04-25T01:26:36.790544",
+ "user_id": "admin"
+ }
+}
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json
new file mode 100644
index 0000000000..0b2254126b
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json
@@ -0,0 +1,24 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "15835b6f-1e14-4cfa-9f66-1abea1a1c0d5",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-f04d4b92-6241-42da-b82d-2cedb225c58d",
+ "start_time": "2018-04-25T01:26:36.036697",
+ "updated_at": "2018-04-25T01:26:36.525308",
+ "user_id": "admin"
+ },
+ {
+ "action": "create",
+ "instance_uuid": "15835b6f-1e14-4cfa-9f66-1abea1a1c0d5",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-d8790618-9bbf-4df0-8af8-fc9e24de29c0",
+ "start_time": "2018-04-25T01:26:33.692125",
+ "updated_at": "2018-04-25T01:26:35.993821",
+ "user_id": "admin"
+ }
+ ]
+} \ No newline at end of file
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json
new file mode 100644
index 0000000000..28c58384e7
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json
@@ -0,0 +1,24 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "2150964c-30fe-4214-9547-8822375aa7d0",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-0c3b2079-0a44-474d-a5b2-7466d4b4c642",
+ "start_time": "2018-04-25T01:26:29.594237",
+ "updated_at": "2018-04-25T01:26:30.065061",
+ "user_id": "admin"
+ },
+ {
+ "action": "create",
+ "instance_uuid": "15835b6f-1e14-4cfa-9f66-1abea1a1c0d5",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-d8790618-9bbf-4df0-8af8-fc9e24de29c0",
+ "start_time": "2018-04-25T01:26:33.692125",
+ "updated_at": "2018-04-25T01:26:35.993821",
+ "user_id": "admin"
+ }
+ ]
+}
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json
new file mode 100644
index 0000000000..346c93af7a
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json
@@ -0,0 +1,14 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "2150964c-30fe-4214-9547-8822375aa7d0",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-0c3b2079-0a44-474d-a5b2-7466d4b4c642",
+ "start_time": "2018-04-25T01:26:29.594237",
+ "updated_at": "2018-04-25T01:26:30.065061",
+ "user_id": "admin"
+ }
+ ]
+} \ No newline at end of file
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json
new file mode 100644
index 0000000000..7126a9f282
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json
@@ -0,0 +1,20 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "ca3d3be5-1a40-427f-9515-f5e181f479d0",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-4dbefbb7-d743-4d42-b0a1-a79cbe256138",
+ "start_time": "2018-04-25T01:26:28.909887",
+ "updated_at": "2018-04-25T01:26:29.400606",
+ "user_id": "admin"
+ }
+ ],
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2.1/6f70656e737461636b20342065766572/servers/ca3d3be5-1a40-427f-9515-f5e181f479d0/os-instance-actions?limit=1&marker=req-4dbefbb7-d743-4d42-b0a1-a79cbe256138",
+ "rel": "next"
+ }
+ ]
+} \ No newline at end of file
diff --git a/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json
new file mode 100644
index 0000000000..3f6921cb79
--- /dev/null
+++ b/doc/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json
@@ -0,0 +1,14 @@
+{
+ "instanceActions": [
+ {
+ "action": "create",
+ "instance_uuid": "9bde1fd5-8435-45c5-afc1-bedd0605275b",
+ "message": null,
+ "project_id": "6f70656e737461636b20342065766572",
+ "request_id": "req-4510fb10-447f-4572-a64d-c2324547d86c",
+ "start_time": "2018-04-25T01:26:33.710291",
+ "updated_at": "2018-04-25T01:26:35.374936",
+ "user_id": "fake"
+ }
+ ]
+} \ No newline at end of file
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json.tpl
new file mode 100644
index 0000000000..7641428d17
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-non-admin-resp.json.tpl
@@ -0,0 +1,21 @@
+{
+ "instanceAction": {
+ "action": "stop",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null,
+ "events": [
+ {
+ "event": "compute_stop_instance",
+ "start_time": "%(strtime)s",
+ "finish_time": "%(strtime)s",
+ "result": "Success",
+ "hostId": "%(event_hostId)s"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json.tpl
new file mode 100644
index 0000000000..c6209af4a7
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-action-get-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "instanceAction": {
+ "action": "stop",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null,
+ "events": [
+ {
+ "event": "compute_stop_instance",
+ "start_time": "%(strtime)s",
+ "finish_time": "%(strtime)s",
+ "result": "Success",
+ "traceback": null,
+ "host": "%(event_host)s",
+ "hostId": "%(event_hostId)s",
+ "details": null
+ }
+ ]
+ }
+}
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json.tpl
new file mode 100644
index 0000000000..19161da374
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-resp.json.tpl
@@ -0,0 +1,24 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ },
+ {
+ "action": "create",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ }
+ ]
+}
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json.tpl
new file mode 100644
index 0000000000..19161da374
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-before.json.tpl
@@ -0,0 +1,24 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ },
+ {
+ "action": "create",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ }
+ ]
+}
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json.tpl
new file mode 100644
index 0000000000..4b81af86b0
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-changes-since.json.tpl
@@ -0,0 +1,14 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ }
+ ]
+}
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json.tpl
new file mode 100644
index 0000000000..dedbd8d8ad
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-limit-resp.json.tpl
@@ -0,0 +1,20 @@
+{
+ "instanceActions": [
+ {
+ "action": "stop",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ }
+ ],
+ "links": [
+ {
+ "href": "%(versioned_compute_endpoint)s/servers/%(uuid)s/os-instance-actions?limit=1&marker=%(request_id)s",
+ "rel": "next"
+ }
+ ]
+}
diff --git a/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json.tpl b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json.tpl
new file mode 100644
index 0000000000..3e1f1efa8b
--- /dev/null
+++ b/nova/tests/functional/api_sample_tests/api_samples/os-instance-actions/v2.84/instance-actions-list-with-marker-resp.json.tpl
@@ -0,0 +1,14 @@
+{
+ "instanceActions": [
+ {
+ "action": "create",
+ "instance_uuid": "%(uuid)s",
+ "request_id": "%(request_id)s",
+ "user_id": "%(user_id)s",
+ "project_id": "%(project_id)s",
+ "start_time": "%(strtime)s",
+ "updated_at": "%(strtime)s",
+ "message": null
+ }
+ ]
+}
diff --git a/nova/tests/functional/api_sample_tests/test_instance_actions.py b/nova/tests/functional/api_sample_tests/test_instance_actions.py
index b7f5f509e9..e91a87301c 100644
--- a/nova/tests/functional/api_sample_tests/test_instance_actions.py
+++ b/nova/tests/functional/api_sample_tests/test_instance_actions.py
@@ -154,3 +154,12 @@ class ServerActionsV266SampleJsonTest(ServerActionsV262SampleJsonTest):
self._verify_response(
'instance-actions-list-with-changes-before',
self._get_subs(), response, 200)
+
+
+class ServerActionsV284SampleJsonTest(ServerActionsV266SampleJsonTest):
+ microversion = '2.84'
+ scenarios = [('2.84', {'api_major_version': 'v2.1'})]
+
+
+class ServerActionsV284NonAdminSampleJsonTest(ServerActionsV284SampleJsonTest):
+ ADMIN_API = False