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 000000000000..a93e48953482 --- /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 000000000000..3b3fe27b507b --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-reboot.xml @@ -0,0 +1,2 @@ + + \ 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 000000000000..b584c90448ed --- /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 000000000000..4f5f1a758bda --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-shutdown.xml @@ -0,0 +1,2 @@ + + \ 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 000000000000..d66895ecfc9b --- /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 000000000000..8d6959946b98 --- /dev/null +++ b/doc/api_samples/os-hosts/host-get-startup.xml @@ -0,0 +1,2 @@ + + \ 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 000000000000..6accac1644f3 --- /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 000000000000..42b995b5d577 --- /dev/null +++ b/doc/api_samples/os-hosts/host-put-maintenance-req.xml @@ -0,0 +1,5 @@ + + + enable + disable + \ 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 000000000000..2feb884056d2 --- /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 000000000000..c4d165628138 --- /dev/null +++ b/doc/api_samples/os-hosts/host-put-maintenance-resp.xml @@ -0,0 +1,2 @@ + + \ 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 000000000000..4ed89a182d29 --- /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 000000000000..4f9c8e43787b --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-reboot.xml.tpl @@ -0,0 +1,2 @@ + + 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 000000000000..c0df4481a296 --- /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 000000000000..d78bd32a5d07 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-shutdown.xml.tpl @@ -0,0 +1,2 @@ + + 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 000000000000..90f5ac7bcb94 --- /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 000000000000..581f7cf07f37 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-get-startup.xml.tpl @@ -0,0 +1,2 @@ + + 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 000000000000..6accac1644f3 --- /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 000000000000..d127a7a26bf7 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-req.xml.tpl @@ -0,0 +1,5 @@ + + + enable + disable + 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 000000000000..92f73892b3af --- /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 000000000000..e9c99512b8f8 --- /dev/null +++ b/nova/tests/integrated/api_samples/os-hosts/host-put-maintenance-resp.xml.tpl @@ -0,0 +1,2 @@ + + diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py index 5b1de9b7e074..8ed532118435 100644 --- a/nova/tests/integrated/test_api_samples.py +++ b/nova/tests/integrated/test_api_samples.py @@ -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)