diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-29 17:14:45 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-29 17:14:45 +0000 |
| commit | d9f02e6cedbc59dd22f1208cc9b9f30202d84db3 (patch) | |
| tree | 7762299f635631335316fa3c85badf25a6617bef | |
| parent | 85ae44a753281d7ed6019020cbdfcf7dd52dfd55 (diff) | |
| parent | c9273ab7974d72e935537c3c25110f15096a01e9 (diff) | |
| download | nova-d9f02e6cedbc59dd22f1208cc9b9f30202d84db3.tar.gz nova-d9f02e6cedbc59dd22f1208cc9b9f30202d84db3.tar.xz nova-d9f02e6cedbc59dd22f1208cc9b9f30202d84db3.zip | |
Merge "Complete API samples for Hosts extension"
21 files changed, 96 insertions, 0 deletions
diff --git a/doc/api_samples/os-hosts/host-get-reboot.json b/doc/api_samples/os-hosts/host-get-reboot.json new file mode 100644 index 000000000..a93e48953 --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-reboot.json @@ -0,0 +1,4 @@ +{ + "host": "066bf157ab50481d8c607cfe584b2230", + "power_action": "reboot" +}
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-get-reboot.xml b/doc/api_samples/os-hosts/host-get-reboot.xml new file mode 100644 index 000000000..3b3fe27b5 --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-reboot.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host host="ce8c5f8cde4a46ffb01dec0788ad4dfc" power_action="reboot"/>
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-get-shutdown.json b/doc/api_samples/os-hosts/host-get-shutdown.json new file mode 100644 index 000000000..b584c9044 --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-shutdown.json @@ -0,0 +1,4 @@ +{ + "host": "d2576862a2144ee6ad37d9e1938460a2", + "power_action": "shutdown" +}
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-get-shutdown.xml b/doc/api_samples/os-hosts/host-get-shutdown.xml new file mode 100644 index 000000000..4f5f1a758 --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-shutdown.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host host="c82ca6da579440ac930ddee0e6530176" power_action="shutdown"/>
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-get-startup.json b/doc/api_samples/os-hosts/host-get-startup.json new file mode 100644 index 000000000..d66895ecf --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-startup.json @@ -0,0 +1,4 @@ +{ + "host": "57f5de2fa5b44f14974a4f50b9ffcbf8", + "power_action": "startup" +}
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-get-startup.xml b/doc/api_samples/os-hosts/host-get-startup.xml new file mode 100644 index 000000000..8d6959946 --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-startup.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host host="7fae168ed18140d5a785ade2ac1bd420" power_action="startup"/>
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-put-maintenance-req.json b/doc/api_samples/os-hosts/host-put-maintenance-req.json new file mode 100644 index 000000000..6accac164 --- /dev/null +++ b/doc/api_samples/os-hosts/host-put-maintenance-req.json @@ -0,0 +1,4 @@ +{ + "status": "enable", + "maintenance_mode": "disable" +}
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-put-maintenance-req.xml b/doc/api_samples/os-hosts/host-put-maintenance-req.xml new file mode 100644 index 000000000..42b995b5d --- /dev/null +++ b/doc/api_samples/os-hosts/host-put-maintenance-req.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<updates> + <status>enable</status> + <maintenance_mode>disable</maintenance_mode> +</updates>
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-put-maintenance-resp.json b/doc/api_samples/os-hosts/host-put-maintenance-resp.json new file mode 100644 index 000000000..2feb88405 --- /dev/null +++ b/doc/api_samples/os-hosts/host-put-maintenance-resp.json @@ -0,0 +1,5 @@ +{ + "host": "0738dca90a8c43fdadd0be28715520e2", + "maintenance_mode": "off_maintenance", + "status": "enabled" +}
\ No newline at end of file diff --git a/doc/api_samples/os-hosts/host-put-maintenance-resp.xml b/doc/api_samples/os-hosts/host-put-maintenance-resp.xml new file mode 100644 index 000000000..c4d165628 --- /dev/null +++ b/doc/api_samples/os-hosts/host-put-maintenance-resp.xml @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host status="enabled" maintenance_mode="off_maintenance" host="d85f05519b57457c83da18c39fa8e00d"/>
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.json.tpl b/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.json.tpl new file mode 100644 index 000000000..4ed89a182 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.json.tpl @@ -0,0 +1,4 @@ +{ + "host": "%(host_name)s", + "power_action": "reboot" +} diff --git a/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.xml.tpl b/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.xml.tpl new file mode 100644 index 000000000..4f9c8e437 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.xml.tpl @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host host="%(host_name)s" power_action="reboot"/> diff --git a/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.json.tpl b/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.json.tpl new file mode 100644 index 000000000..c0df4481a --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.json.tpl @@ -0,0 +1,4 @@ +{ + "host": "%(host_name)s", + "power_action": "shutdown" +} diff --git a/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.xml.tpl b/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.xml.tpl new file mode 100644 index 000000000..d78bd32a5 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.xml.tpl @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host host="%(host_name)s" power_action="shutdown"/> diff --git a/nova/tests/integrated/api_samples/os-hosts/host-get-startup.json.tpl b/nova/tests/integrated/api_samples/os-hosts/host-get-startup.json.tpl new file mode 100644 index 000000000..90f5ac7bc --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-startup.json.tpl @@ -0,0 +1,4 @@ +{ + "host": "%(host_name)s", + "power_action": "startup" +} diff --git a/nova/tests/integrated/api_samples/os-hosts/host-get-startup.xml.tpl b/nova/tests/integrated/api_samples/os-hosts/host-get-startup.xml.tpl new file mode 100644 index 000000000..581f7cf07 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-startup.xml.tpl @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host host="%(host_name)s" power_action="startup"/> diff --git a/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.json.tpl b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.json.tpl new file mode 100644 index 000000000..6accac164 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.json.tpl @@ -0,0 +1,4 @@ +{ + "status": "enable", + "maintenance_mode": "disable" +}
\ No newline at end of file diff --git a/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.xml.tpl b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.xml.tpl new file mode 100644 index 000000000..d127a7a26 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.xml.tpl @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<updates> + <status>enable</status> + <maintenance_mode>disable</maintenance_mode> +</updates> diff --git a/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.json.tpl b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.json.tpl new file mode 100644 index 000000000..92f73892b --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.json.tpl @@ -0,0 +1,5 @@ +{ + "host": "%(host_name)s", + "maintenance_mode": "off_maintenance", + "status": "enabled" +} diff --git a/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.xml.tpl b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.xml.tpl new file mode 100644 index 000000000..e9c99512b --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.xml.tpl @@ -0,0 +1,2 @@ +<?xml version='1.0' encoding='UTF-8'?> +<host status="enabled" maintenance_mode="off_maintenance" host="%(host_name)s"/> diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 3e6513c38..a1b71c2d8 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -499,13 +499,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) |
