Adds V3 API samples for srvcs, tenant usage, server_diagnostics
Adds V3 API samples for the services, simple tenant usage and server_diagnostics extensions. Bundling them together to save on review load Partially implements blueprint v3-api-unittests Partially implements blueprint v3-api-specification Change-Id: I91edc6500acbe92221427383b4bcd3d00a8faadd
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"image_ref" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
|
||||
"flavor_ref" : "http://openstack.example.com/openstack/flavors/1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
},
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
19
doc/v3/api_samples/os-server-diagnostics/server-post-req.xml
Normal file
19
doc/v3/api_samples/os-server-diagnostics/server-post-req.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b" flavor_ref="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>
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"admin_pass": "H83mnjinc5jy",
|
||||
"id": "b2bbf280-a78d-4724-90ba-b00dd5659097",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://openstack.example.com/v3/servers/b2bbf280-a78d-4724-90ba-b00dd5659097",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://openstack.example.com/servers/b2bbf280-a78d-4724-90ba-b00dd5659097",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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="40cefec3-6e0d-4e5b-9c1a-64d0bd407ce9" admin_pass="SY4ozi9N4Jw9">
|
||||
<metadata/>
|
||||
<atom:link href="http://openstack.example.com/v3/servers/40cefec3-6e0d-4e5b-9c1a-64d0bd407ce9" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/40cefec3-6e0d-4e5b-9c1a-64d0bd407ce9" rel="bookmark"/>
|
||||
</server>
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"host": "host1",
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test2"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service host="host1" binary="nova-compute" disabled_reason="test2"/>
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"service": {
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test2",
|
||||
"host": "host1",
|
||||
"status": "disabled"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service status="disabled" binary="nova-compute" host="host1" disabled_reason="test2"/>
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "host1",
|
||||
"binary": "nova-compute"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service host="host1" binary="nova-compute" />
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"service": {
|
||||
"binary": "nova-compute",
|
||||
"host": "host1",
|
||||
"status": "disabled"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service status="disabled" binary="nova-compute" host="host1"/>
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "host1",
|
||||
"binary": "nova-compute"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service host="host1" binary="nova-compute" />
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"service": {
|
||||
"binary": "nova-compute",
|
||||
"host": "host1",
|
||||
"status": "enabled"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service status="enabled" binary="nova-compute" host="host1"/>
|
||||
40
doc/v3/api_samples/os-services/services-list-get-resp.json
Normal file
40
doc/v3/api_samples/os-services/services-list-get-resp.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"services": [
|
||||
{
|
||||
"binary": "nova-scheduler",
|
||||
"disabled_reason": "test1",
|
||||
"host": "host1",
|
||||
"state": "up",
|
||||
"status": "disabled",
|
||||
"updated_at": "2012-10-29T13:42:02.000000",
|
||||
"zone": "internal"
|
||||
},
|
||||
{
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test2",
|
||||
"host": "host1",
|
||||
"state": "up",
|
||||
"status": "disabled",
|
||||
"updated_at": "2012-10-29T13:42:05.000000",
|
||||
"zone": "nova"
|
||||
},
|
||||
{
|
||||
"binary": "nova-scheduler",
|
||||
"disabled_reason": "",
|
||||
"host": "host2",
|
||||
"state": "down",
|
||||
"status": "enabled",
|
||||
"updated_at": "2012-09-19T06:55:34.000000",
|
||||
"zone": "internal"
|
||||
},
|
||||
{
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test4",
|
||||
"host": "host2",
|
||||
"state": "down",
|
||||
"status": "disabled",
|
||||
"updated_at": "2012-09-18T08:03:38.000000",
|
||||
"zone": "nova"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<services>
|
||||
<service status="disabled" binary="nova-scheduler" zone="internal" state="up" updated_at="2012-10-29 13:42:02" host="host1" disabled_reason="test1"/>
|
||||
<service status="disabled" binary="nova-compute" zone="nova" state="up" updated_at="2012-10-29 13:42:05" host="host1" disabled_reason="test2"/>
|
||||
<service status="enabled" binary="nova-scheduler" zone="internal" state="down" updated_at="2012-09-19 06:55:34" host="host2" disabled_reason=""/>
|
||||
<service status="disabled" binary="nova-compute" zone="nova" state="down" updated_at="2012-09-18 08:03:38" host="host2" disabled_reason="test4"/>
|
||||
</services>
|
||||
@@ -13,4 +13,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
<metadata/>
|
||||
<atom:link href="http://openstack.example.com/v3/servers/f14ff0d3-cebe-4692-9202-71946f4db8e4" rel="self"/>
|
||||
<atom:link href="http://openstack.example.com/servers/f14ff0d3-cebe-4692-9202-71946f4db8e4" rel="bookmark"/>
|
||||
</server>
|
||||
</server>
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
"total_memory_mb_usage": 512.0,
|
||||
"total_vcpus_usage": 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
<uptime>3600</uptime>
|
||||
</server_usage>
|
||||
</server_usages>
|
||||
</tenant_usage>
|
||||
</tenant_usage>
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
"total_vcpus_usage": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
<stop>2013-09-09 14:18:27.998271</stop>
|
||||
<server_usages/>
|
||||
</tenant_usage>
|
||||
</tenant_usages>
|
||||
</tenant_usages>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"server" : {
|
||||
"name" : "new-server-test",
|
||||
"image_ref" : "%(host)s/openstack/images/%(image_id)s",
|
||||
"flavor_ref" : "%(host)s/openstack/flavors/1",
|
||||
"metadata" : {
|
||||
"My Server Name" : "Apache1"
|
||||
},
|
||||
"personality" : [
|
||||
{
|
||||
"path" : "/etc/banner.txt",
|
||||
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<server xmlns="http://docs.openstack.org/compute/api/v1.1" image_ref="%(host)s/openstack/images/%(image_id)s" flavor_ref="%(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>
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"server": {
|
||||
"admin_pass": "%(password)s",
|
||||
"id": "%(id)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/servers/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/servers/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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" admin_pass="%(password)s">
|
||||
<metadata/>
|
||||
<atom:link href="%(host)s/v3/servers/%(uuid)s" rel="self"/>
|
||||
<atom:link href="%(host)s/servers/%(uuid)s" rel="bookmark"/>
|
||||
</server>
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"service":
|
||||
{
|
||||
"host": "%(host)s",
|
||||
"binary": "%(binary)s",
|
||||
"disabled_reason": "%(disabled_reason)s"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service host="%(host)s" binary="%(binary)s" disabled_reason="%(disabled_reason)s"/>
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"service": {
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test2",
|
||||
"host": "host1",
|
||||
"status": "disabled"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service status="disabled" binary="nova-compute" host="host1" disabled_reason="test2"/>
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"service":
|
||||
{
|
||||
"host": "%(host)s",
|
||||
"binary": "%(binary)s"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service host="%(host)s" binary="%(binary)s" />
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"service": {
|
||||
"binary": "nova-compute",
|
||||
"host": "host1",
|
||||
"status": "disabled"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service status="disabled" binary="nova-compute" host="host1"/>
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"service":
|
||||
{
|
||||
"host": "%(host)s",
|
||||
"binary": "%(binary)s"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service host="%(host)s" binary="%(binary)s" />
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"service": {
|
||||
"binary": "nova-compute",
|
||||
"host": "host1",
|
||||
"status": "enabled"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<service status="enabled" binary="nova-compute" host="host1"/>
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"services": [
|
||||
{
|
||||
"binary": "nova-scheduler",
|
||||
"disabled_reason": "test1",
|
||||
"host": "host1",
|
||||
"state": "up",
|
||||
"status": "disabled",
|
||||
"updated_at": "%(timestamp)s",
|
||||
"zone": "internal"
|
||||
},
|
||||
{
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test2",
|
||||
"host": "host1",
|
||||
"state": "up",
|
||||
"status": "disabled",
|
||||
"updated_at": "%(timestamp)s",
|
||||
"zone": "nova"
|
||||
},
|
||||
{
|
||||
"binary": "nova-scheduler",
|
||||
"disabled_reason": "",
|
||||
"host": "host2",
|
||||
"state": "down",
|
||||
"status": "enabled",
|
||||
"updated_at": "%(timestamp)s",
|
||||
"zone": "internal"
|
||||
},
|
||||
{
|
||||
"binary": "nova-compute",
|
||||
"disabled_reason": "test4",
|
||||
"host": "host2",
|
||||
"state": "down",
|
||||
"status": "disabled",
|
||||
"updated_at": "%(timestamp)s",
|
||||
"zone": "nova"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<services>
|
||||
<service status="disabled" binary="nova-scheduler" zone="internal" state="up" updated_at="%(timestamp)s" host="host1" disabled_reason="test1"/>
|
||||
<service status="disabled" binary="nova-compute" zone="nova" state="up" updated_at="%(timestamp)s" host="host1" disabled_reason="test2"/>
|
||||
<service status="enabled" binary="nova-scheduler" zone="internal" state="down" updated_at="%(timestamp)s" host="host2" disabled_reason=""/>
|
||||
<service status="disabled" binary="nova-compute" zone="nova" state="down" updated_at="%(timestamp)s" host="host2" disabled_reason="test4"/>
|
||||
</services>
|
||||
32
nova/tests/integrated/v3/test_server_diagnostics.py
Normal file
32
nova/tests/integrated/v3/test_server_diagnostics.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# Copyright 2012 Nebula, Inc.
|
||||
# Copyright 2013 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.tests.integrated.v3 import test_servers
|
||||
|
||||
|
||||
class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-server-diagnostics"
|
||||
|
||||
def test_server_diagnostics_get(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers/%s/os-server-diagnostics' % uuid)
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('server-diagnostics-get-resp', subs,
|
||||
response, 200)
|
||||
|
||||
|
||||
class ServerDiagnosticsSamplesXmlTest(ServerDiagnosticsSamplesJsonTest):
|
||||
ctype = "xml"
|
||||
83
nova/tests/integrated/v3/test_services.py
Normal file
83
nova/tests/integrated/v3/test_services.py
Normal file
@@ -0,0 +1,83 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# Copyright 2012 Nebula, Inc.
|
||||
# Copyright 2013 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova import db
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.tests.api.openstack.compute.plugins.v3 import test_services
|
||||
from nova.tests.integrated.v3 import api_sample_base
|
||||
|
||||
|
||||
class ServicesJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
extension_name = "os-services"
|
||||
|
||||
def setUp(self):
|
||||
super(ServicesJsonTest, self).setUp()
|
||||
self.stubs.Set(db, "service_get_all",
|
||||
test_services.fake_db_api_service_get_all)
|
||||
self.stubs.Set(timeutils, "utcnow", test_services.fake_utcnow)
|
||||
self.stubs.Set(db, "service_get_by_args",
|
||||
test_services.fake_service_get_by_host_binary)
|
||||
self.stubs.Set(db, "service_update",
|
||||
test_services.fake_service_update)
|
||||
|
||||
def tearDown(self):
|
||||
super(ServicesJsonTest, self).tearDown()
|
||||
timeutils.clear_time_override()
|
||||
|
||||
def test_services_list(self):
|
||||
"""Return a list of all agent builds."""
|
||||
response = self._do_get('os-services')
|
||||
subs = {'binary': 'nova-compute',
|
||||
'host': 'host1',
|
||||
'zone': 'nova',
|
||||
'status': 'disabled',
|
||||
'state': 'up'}
|
||||
subs.update(self._get_regexes())
|
||||
self._verify_response('services-list-get-resp', subs, response, 200)
|
||||
|
||||
def test_service_enable(self):
|
||||
"""Enable an existing agent build."""
|
||||
subs = {"host": "host1",
|
||||
'binary': 'nova-compute'}
|
||||
response = self._do_put('os-services/enable',
|
||||
'service-enable-put-req', subs)
|
||||
subs = {"host": "host1",
|
||||
"binary": "nova-compute"}
|
||||
self._verify_response('service-enable-put-resp', subs, response, 200)
|
||||
|
||||
def test_service_disable(self):
|
||||
"""Disable an existing agent build."""
|
||||
subs = {"host": "host1",
|
||||
'binary': 'nova-compute'}
|
||||
response = self._do_put('os-services/disable',
|
||||
'service-disable-put-req', subs)
|
||||
subs = {"host": "host1",
|
||||
"binary": "nova-compute"}
|
||||
self._verify_response('service-disable-put-resp', subs, response, 200)
|
||||
|
||||
def test_service_disable_log_reason(self):
|
||||
"""Disable an existing service and log the reason."""
|
||||
subs = {"host": "host1",
|
||||
'binary': 'nova-compute',
|
||||
'disabled_reason': 'test2'}
|
||||
response = self._do_put('os-services/disable-log-reason',
|
||||
'service-disable-log-put-req', subs)
|
||||
return self._verify_response('service-disable-log-put-resp',
|
||||
subs, response, 200)
|
||||
|
||||
|
||||
class ServicesXmlTest(ServicesJsonTest):
|
||||
ctype = 'xml'
|
||||
Reference in New Issue
Block a user