summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>2012-10-10 22:22:31 -0400
committerMauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>2012-10-22 07:14:49 -0400
commitd6e0fdf752cf67ff9729b3fdcdeb925bd0c1cd3f (patch)
tree66c0b56f2b194ef226f0c5592ec9aee65c8edfb4
parentad2d4c379c5d424bde1832b664f36aa29432d64f (diff)
downloadnova-d6e0fdf752cf67ff9729b3fdcdeb925bd0c1cd3f.tar.gz
nova-d6e0fdf752cf67ff9729b3fdcdeb925bd0c1cd3f.tar.xz
nova-d6e0fdf752cf67ff9729b3fdcdeb925bd0c1cd3f.zip
Add Server diagnostics extension api samples
Change-Id: Id53e17caa75dcab01dd3209f771891b4e92debec
-rw-r--r--doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json17
-rw-r--r--doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml18
-rw-r--r--doc/api_samples/os-server-diagnostics/server-post-req.json16
-rw-r--r--doc/api_samples/os-server-diagnostics/server-post-req.xml19
-rw-r--r--doc/api_samples/os-server-diagnostics/server-post-resp.json16
-rw-r--r--doc/api_samples/os-server-diagnostics/server-post-resp.xml6
-rw-r--r--nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl17
-rw-r--r--nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml.tpl18
-rw-r--r--nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.json.tpl16
-rw-r--r--nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.xml.tpl19
-rw-r--r--nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.json.tpl16
-rw-r--r--nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.xml.tpl6
-rw-r--r--nova/tests/integrated/test_api_samples.py17
13 files changed, 201 insertions, 0 deletions
diff --git a/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json b/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json
new file mode 100644
index 000000000..d33654392
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json
@@ -0,0 +1,17 @@
+{
+ "cpu0_time": 17300000000,
+ "memory": 524288,
+ "vda_errors": -1,
+ "vda_read": 262144,
+ "vda_read_req": 112,
+ "vda_write": 5778432,
+ "vda_write_req": 488,
+ "vnet1_rx": 2070139,
+ "vnet1_rx_drop": 0,
+ "vnet1_rx_errors": 0,
+ "vnet1_rx_packets": 26701,
+ "vnet1_tx": 140208,
+ "vnet1_tx_drop": 0,
+ "vnet1_tx_errors": 0,
+ "vnet1_tx_packets": 662
+} \ No newline at end of file
diff --git a/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml b/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml
new file mode 100644
index 000000000..776419f82
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<diagnostics xmlns="http://docs.openstack.org/compute/api/v1.1">
+ <memory>524288</memory>
+ <vda_write>5778432</vda_write>
+ <vnet1_rx_packets>26701</vnet1_rx_packets>
+ <vnet1_rx_drop>0</vnet1_rx_drop>
+ <vnet1_tx_drop>0</vnet1_tx_drop>
+ <vnet1_rx>2070139</vnet1_rx>
+ <vda_read>262144</vda_read>
+ <vda_write_req>488</vda_write_req>
+ <vnet1_tx>140208</vnet1_tx>
+ <vnet1_tx_errors>0</vnet1_tx_errors>
+ <vnet1_tx_packets>662</vnet1_tx_packets>
+ <vnet1_rx_errors>0</vnet1_rx_errors>
+ <cpu0_time>17300000000</cpu0_time>
+ <vda_read_req>112</vda_read_req>
+ <vda_errors>-1</vda_errors>
+</diagnostics> \ No newline at end of file
diff --git a/doc/api_samples/os-server-diagnostics/server-post-req.json b/doc/api_samples/os-server-diagnostics/server-post-req.json
new file mode 100644
index 000000000..d88eb4122
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-post-req.json
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "flavorRef" : "http://openstack.example.com/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/doc/api_samples/os-server-diagnostics/server-post-req.xml b/doc/api_samples/os-server-diagnostics/server-post-req.xml
new file mode 100644
index 000000000..0a3c8bb53
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-post-req.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" flavorRef="http://openstack.example.com/openstack/flavors/1" name="new-server-test">
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <personality>
+ <file path="/etc/banner.txt">
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+ </file>
+ </personality>
+</server> \ No newline at end of file
diff --git a/doc/api_samples/os-server-diagnostics/server-post-resp.json b/doc/api_samples/os-server-diagnostics/server-post-resp.json
new file mode 100644
index 000000000..b14c071cc
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-post-resp.json
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "gSLumCiGg3V9",
+ "id": "b10a33d1-6fb5-45d4-876d-4e68962db878",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v2/openstack/servers/b10a33d1-6fb5-45d4-876d-4e68962db878",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/openstack/servers/b10a33d1-6fb5-45d4-876d-4e68962db878",
+ "rel": "bookmark"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/doc/api_samples/os-server-diagnostics/server-post-resp.xml b/doc/api_samples/os-server-diagnostics/server-post-resp.xml
new file mode 100644
index 000000000..b7210473d
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-post-resp.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="1d946791-e7c9-41fc-9b03-550c94b7216a" adminPass="km2Dr44vFMaK">
+ <metadata/>
+ <atom:link href="http://openstack.example.com/v2/openstack/servers/1d946791-e7c9-41fc-9b03-550c94b7216a" rel="self"/>
+ <atom:link href="http://openstack.example.com/openstack/servers/1d946791-e7c9-41fc-9b03-550c94b7216a" rel="bookmark"/>
+</server> \ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl
new file mode 100644
index 000000000..1afedaee9
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.json.tpl
@@ -0,0 +1,17 @@
+{
+ "cpu0_time": 17300000000,
+ "memory": 524288,
+ "vda_errors": -1,
+ "vda_read": 262144,
+ "vda_read_req": 112,
+ "vda_write": 5778432,
+ "vda_write_req": 488,
+ "vnet1_rx": 2070139,
+ "vnet1_rx_drop": 0,
+ "vnet1_rx_errors": 0,
+ "vnet1_rx_packets": 26701,
+ "vnet1_tx": 140208,
+ "vnet1_tx_drop": 0,
+ "vnet1_tx_errors": 0,
+ "vnet1_tx_packets": 662
+}
diff --git a/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml.tpl
new file mode 100644
index 000000000..776419f82
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml.tpl
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<diagnostics xmlns="http://docs.openstack.org/compute/api/v1.1">
+ <memory>524288</memory>
+ <vda_write>5778432</vda_write>
+ <vnet1_rx_packets>26701</vnet1_rx_packets>
+ <vnet1_rx_drop>0</vnet1_rx_drop>
+ <vnet1_tx_drop>0</vnet1_tx_drop>
+ <vnet1_rx>2070139</vnet1_rx>
+ <vda_read>262144</vda_read>
+ <vda_write_req>488</vda_write_req>
+ <vnet1_tx>140208</vnet1_tx>
+ <vnet1_tx_errors>0</vnet1_tx_errors>
+ <vnet1_tx_packets>662</vnet1_tx_packets>
+ <vnet1_rx_errors>0</vnet1_rx_errors>
+ <cpu0_time>17300000000</cpu0_time>
+ <vda_read_req>112</vda_read_req>
+ <vda_errors>-1</vda_errors>
+</diagnostics> \ No newline at end of file
diff --git a/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.json.tpl b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.json.tpl
new file mode 100644
index 000000000..d3916d1aa
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "imageRef" : "%(host)s/openstack/images/%(image_id)s",
+ "flavorRef" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.xml.tpl
new file mode 100644
index 000000000..f92614984
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.xml.tpl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="http://docs.openstack.org/compute/api/v1.1" imageRef="%(host)s/openstack/images/%(image_id)s" flavorRef="%(host)s/openstack/flavors/1" name="new-server-test">
+ <metadata>
+ <meta key="My Server Name">Apache1</meta>
+ </metadata>
+ <personality>
+ <file path="/etc/banner.txt">
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+ </file>
+ </personality>
+</server>
diff --git a/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.json.tpl
new file mode 100644
index 000000000..d5f030c87
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "adminPass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "%(host)s/v2/openstack/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "%(host)s/openstack/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.xml.tpl
new file mode 100644
index 000000000..3bb13e69b
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.xml.tpl
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<server xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://docs.openstack.org/compute/api/v1.1" id="%(id)s" adminPass="%(password)s">
+ <metadata/>
+ <atom:link href="%(host)s/v2/openstack/servers/%(uuid)s" rel="self"/>
+ <atom:link href="%(host)s/openstack/servers/%(uuid)s" rel="bookmark"/>
+</server>
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index cfdd27bcc..792384ed6 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -1269,3 +1269,20 @@ class SimpleTenantUsageSampleJsonTest(ServersSampleBase):
class SimpleTenantUsageSampleXmlTest(SimpleTenantUsageSampleJsonTest):
ctype = "xml"
+
+
+class ServerDiagnosticsSamplesJsonTest(ServersSampleBase):
+ extension_name = ("nova.api.openstack.compute.contrib.server_diagnostics."
+ "Server_diagnostics")
+
+ def test_server_diagnostics_get(self):
+ uuid = self._post_server()
+ response = self._do_get('servers/%s/diagnostics' % uuid)
+ self.assertEqual(response.status, 200)
+ subs = self._get_regexes()
+ return self._verify_response('server-diagnostics-get-resp', subs,
+ response)
+
+
+class ServerDiagnosticsSamplesXmlTest(ServerDiagnosticsSamplesJsonTest):
+ ctype = "xml"