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 0000000000..d336543929
--- /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 0000000000..776419f82f
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml
@@ -0,0 +1,18 @@
+
+
+ 524288
+ 5778432
+ 26701
+ 0
+ 0
+ 2070139
+ 262144
+ 488
+ 140208
+ 0
+ 662
+ 0
+ 17300000000
+ 112
+ -1
+
\ 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 0000000000..d88eb41222
--- /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 0000000000..0a3c8bb530
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-post-req.xml
@@ -0,0 +1,19 @@
+
+
+
+ Apache1
+
+
+
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+
+
+
\ 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 0000000000..b14c071cc9
--- /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 0000000000..b7210473d5
--- /dev/null
+++ b/doc/api_samples/os-server-diagnostics/server-post-resp.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ 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 0000000000..1afedaee9c
--- /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 0000000000..776419f82f
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-diagnostics-get-resp.xml.tpl
@@ -0,0 +1,18 @@
+
+
+ 524288
+ 5778432
+ 26701
+ 0
+ 0
+ 2070139
+ 262144
+ 488
+ 140208
+ 0
+ 662
+ 0
+ 17300000000
+ 112
+ -1
+
\ 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 0000000000..d3916d1aa6
--- /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 0000000000..f926149842
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-req.xml.tpl
@@ -0,0 +1,19 @@
+
+
+
+ Apache1
+
+
+
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+
+
+
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 0000000000..d5f030c873
--- /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 0000000000..3bb13e69bd
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-server-diagnostics/server-post-resp.xml.tpl
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index cfdd27bccb..792384ed66 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"