Complete API samples for Hosts extension
The API samples for Hosts extension missed power operations (shutdown, reboot and startup) and maintenance/status operations. Complete fix to bug 1070167 Change-Id: I07fd34e071eae9afc82f9320634df24f48623e0b
This commit is contained in:
parent
f58f2b48a1
commit
c9273ab797
4
doc/api_samples/os-hosts/host-get-reboot.json
Normal file
4
doc/api_samples/os-hosts/host-get-reboot.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "066bf157ab50481d8c607cfe584b2230",
|
||||
"power_action": "reboot"
|
||||
}
|
2
doc/api_samples/os-hosts/host-get-reboot.xml
Normal file
2
doc/api_samples/os-hosts/host-get-reboot.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host host="ce8c5f8cde4a46ffb01dec0788ad4dfc" power_action="reboot"/>
|
4
doc/api_samples/os-hosts/host-get-shutdown.json
Normal file
4
doc/api_samples/os-hosts/host-get-shutdown.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "d2576862a2144ee6ad37d9e1938460a2",
|
||||
"power_action": "shutdown"
|
||||
}
|
2
doc/api_samples/os-hosts/host-get-shutdown.xml
Normal file
2
doc/api_samples/os-hosts/host-get-shutdown.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host host="c82ca6da579440ac930ddee0e6530176" power_action="shutdown"/>
|
4
doc/api_samples/os-hosts/host-get-startup.json
Normal file
4
doc/api_samples/os-hosts/host-get-startup.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "57f5de2fa5b44f14974a4f50b9ffcbf8",
|
||||
"power_action": "startup"
|
||||
}
|
2
doc/api_samples/os-hosts/host-get-startup.xml
Normal file
2
doc/api_samples/os-hosts/host-get-startup.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host host="7fae168ed18140d5a785ade2ac1bd420" power_action="startup"/>
|
4
doc/api_samples/os-hosts/host-put-maintenance-req.json
Normal file
4
doc/api_samples/os-hosts/host-put-maintenance-req.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"status": "enable",
|
||||
"maintenance_mode": "disable"
|
||||
}
|
5
doc/api_samples/os-hosts/host-put-maintenance-req.xml
Normal file
5
doc/api_samples/os-hosts/host-put-maintenance-req.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<updates>
|
||||
<status>enable</status>
|
||||
<maintenance_mode>disable</maintenance_mode>
|
||||
</updates>
|
5
doc/api_samples/os-hosts/host-put-maintenance-resp.json
Normal file
5
doc/api_samples/os-hosts/host-put-maintenance-resp.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"host": "0738dca90a8c43fdadd0be28715520e2",
|
||||
"maintenance_mode": "off_maintenance",
|
||||
"status": "enabled"
|
||||
}
|
2
doc/api_samples/os-hosts/host-put-maintenance-resp.xml
Normal file
2
doc/api_samples/os-hosts/host-put-maintenance-resp.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host status="enabled" maintenance_mode="off_maintenance" host="d85f05519b57457c83da18c39fa8e00d"/>
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "%(host_name)s",
|
||||
"power_action": "reboot"
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host host="%(host_name)s" power_action="reboot"/>
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "%(host_name)s",
|
||||
"power_action": "shutdown"
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host host="%(host_name)s" power_action="shutdown"/>
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"host": "%(host_name)s",
|
||||
"power_action": "startup"
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host host="%(host_name)s" power_action="startup"/>
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"status": "enable",
|
||||
"maintenance_mode": "disable"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<updates>
|
||||
<status>enable</status>
|
||||
<maintenance_mode>disable</maintenance_mode>
|
||||
</updates>
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"host": "%(host_name)s",
|
||||
"maintenance_mode": "off_maintenance",
|
||||
"status": "enabled"
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<host status="enabled" maintenance_mode="off_maintenance" host="%(host_name)s"/>
|
@ -462,13 +462,41 @@ class FlavorsSampleXmlTest(FlavorsSampleJsonTest):
|
||||
class HostsSampleJsonTest(ApiSampleTestBase):
|
||||
extension_name = "nova.api.openstack.compute.contrib.hosts.Hosts"
|
||||
|
||||
def test_host_startup(self):
|
||||
response = self._do_get('os-hosts/%s/startup' % self.compute.host)
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('host-get-startup', subs, response)
|
||||
|
||||
def test_host_reboot(self):
|
||||
response = self._do_get('os-hosts/%s/reboot' % self.compute.host)
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('host-get-reboot', subs, response)
|
||||
|
||||
def test_host_shutdown(self):
|
||||
response = self._do_get('os-hosts/%s/shutdown' % self.compute.host)
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('host-get-shutdown', subs, response)
|
||||
|
||||
def test_host_maintenance(self):
|
||||
response = self._do_put('os-hosts/%s' % self.compute.host,
|
||||
'host-put-maintenance-req', {})
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('host-put-maintenance-resp', subs,
|
||||
response)
|
||||
|
||||
def test_host_get(self):
|
||||
response = self._do_get('os-hosts/%s' % self.compute.host)
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('host-get-resp', subs, response)
|
||||
|
||||
def test_hosts_list(self):
|
||||
response = self._do_get('os-hosts')
|
||||
self.assertEqual(response.status, 200)
|
||||
subs = self._get_regexes()
|
||||
return self._verify_response('hosts-list-resp', subs, response)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user