Merge "Adds v3 API samples for hosts extension"

This commit is contained in:
Jenkins 2013-09-24 05:23:30 +00:00 committed by Gerrit Code Review
commit 6163e808bd
29 changed files with 378 additions and 0 deletions

View File

@ -0,0 +1,6 @@
{
"host": {
"host": "9557750dbc464741a89c907921c1cb31",
"power_action": "reboot"
}
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<host>34e0a2409dab4052b17b4172a2a44172</host>
<power_action>reboot</power_action>
</host>

View File

@ -0,0 +1,31 @@
{
"host": [
{
"resource": {
"cpu": 1,
"disk_gb": 1028,
"host": "c1a7de0ac9d94e4baceae031d05caae3",
"memory_mb": 8192,
"project": "(total)"
}
},
{
"resource": {
"cpu": 0,
"disk_gb": 0,
"host": "c1a7de0ac9d94e4baceae031d05caae3",
"memory_mb": 512,
"project": "(used_now)"
}
},
{
"resource": {
"cpu": 0,
"disk_gb": 0,
"host": "c1a7de0ac9d94e4baceae031d05caae3",
"memory_mb": 0,
"project": "(used_max)"
}
}
]
}

View File

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<resource>
<project>(total)</project>
<memory_mb>8192</memory_mb>
<host>ee7466478092405c8f8e001b9ca0afb0</host>
<cpu>1</cpu>
<disk_gb>1028</disk_gb>
</resource>
<resource>
<project>(used_now)</project>
<memory_mb>512</memory_mb>
<host>ee7466478092405c8f8e001b9ca0afb0</host>
<cpu>0</cpu>
<disk_gb>0</disk_gb>
</resource>
<resource>
<project>(used_max)</project>
<memory_mb>0</memory_mb>
<host>ee7466478092405c8f8e001b9ca0afb0</host>
<cpu>0</cpu>
<disk_gb>0</disk_gb>
</resource>
</host>

View File

@ -0,0 +1,6 @@
{
"host": {
"host": "77cfa0002e4d45fe97f185968111b27b",
"power_action": "shutdown"
}
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<host>9c1d73144d4d43e28fe32840e35fec91</host>
<power_action>shutdown</power_action>
</host>

View File

@ -0,0 +1,6 @@
{
"host": {
"host": "4b392b27930343bbaa27fd5d8328a564",
"power_action": "startup"
}
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<host>f6bf5a52bd0645cdb7e1b28a1d647f3c</host>
<power_action>startup</power_action>
</host>

View File

@ -0,0 +1,6 @@
{
"host": {
"status": "enable",
"maintenance_mode": "disable"
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<host>
<status>enable</status>
<maintenance_mode>disable</maintenance_mode>
</host>

View File

@ -0,0 +1,7 @@
{
"host": {
"host": "65c5d5b7e3bd44308e67fc50f362aee6",
"maintenance_mode": "off_maintenance",
"status": "enabled"
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<status>enabled</status>
<maintenance_mode>off_maintenance</maintenance_mode>
<host>966158fd3a084a7791a11c592d1a5fcb</host>
</host>

View File

@ -0,0 +1,39 @@
{
"hosts": [
{
"host_name": "b6e4adbc193d428ea923899d07fb001e",
"service": "conductor",
"zone": "internal"
},
{
"host_name": "09c025b0efc64211bd23fc50fa974cdf",
"service": "compute",
"zone": "nova"
},
{
"host_name": "a942ebfa00064d9d89a9e5a175cb9ba8",
"service": "cert",
"zone": "internal"
},
{
"host_name": "e73ec0bd35c64de4a1adfa8b8969a1f6",
"service": "consoleauth",
"zone": "internal"
},
{
"host_name": "396a8a0a234f476eb05fb9fbc5802ba7",
"service": "network",
"zone": "internal"
},
{
"host_name": "abffda96592c4eacaf4111c28fddee17",
"service": "scheduler",
"zone": "internal"
},
{
"host_name": "a8820f04962a4b4ba9fe2e9540c24094",
"service": "cells",
"zone": "internal"
}
]
}

View File

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<hosts>
<host zone="internal" host_name="dbd50e387bcf4ad4a7cb82c0d4cd1a29" service="conductor"/>
<host zone="nova" host_name="548b88fe0ad1461b8f2d297ffb6ebb90" service="compute"/>
<host zone="internal" host_name="5c03090b25a04e46be1b77b6bcca515e" service="cert"/>
<host zone="internal" host_name="d354e5c745424dd5829d2af58d5647fc" service="consoleauth"/>
<host zone="internal" host_name="15136bf1ba7040e691cb48ea72ec9fef" service="network"/>
<host zone="internal" host_name="0577e9f8391c436b9ea55226738c8e66" service="scheduler"/>
<host zone="internal" host_name="8d07b10240d14df7b7bf5cdbf178f969" service="cells"/>
</hosts>

View File

@ -0,0 +1,6 @@
{
"host": {
"host": "%(host_name)s",
"power_action": "reboot"
}
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<host>%(host_name)s</host>
<power_action>reboot</power_action>
</host>

View File

@ -0,0 +1,31 @@
{
"host": [
{
"resource": {
"cpu": 1,
"disk_gb": 1028,
"host": "%(host_name)s",
"memory_mb": 8192,
"project": "(total)"
}
},
{
"resource": {
"cpu": 0,
"disk_gb": 0,
"host": "%(host_name)s",
"memory_mb": 512,
"project": "(used_now)"
}
},
{
"resource": {
"cpu": 0,
"disk_gb": 0,
"host": "%(host_name)s",
"memory_mb": 0,
"project": "(used_max)"
}
}
]
}

View File

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<resource>
<project>(total)</project>
<memory_mb>8192</memory_mb>
<host>%(host_name)s</host>
<cpu>1</cpu>
<disk_gb>1028</disk_gb>
</resource>
<resource>
<project>(used_now)</project>
<memory_mb>512</memory_mb>
<host>%(host_name)s</host>
<cpu>0</cpu>
<disk_gb>0</disk_gb>
</resource>
<resource>
<project>(used_max)</project>
<memory_mb>0</memory_mb>
<host>%(host_name)s</host>
<cpu>0</cpu>
<disk_gb>0</disk_gb>
</resource>
</host>

View File

@ -0,0 +1,6 @@
{
"host": {
"host": "%(host_name)s",
"power_action": "shutdown"
}
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<host>%(host_name)s</host>
<power_action>shutdown</power_action>
</host>

View File

@ -0,0 +1,6 @@
{
"host": {
"host": "%(host_name)s",
"power_action": "startup"
}
}

View File

@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<host>%(host_name)s</host>
<power_action>startup</power_action>
</host>

View File

@ -0,0 +1,6 @@
{
"host": {
"status": "enable",
"maintenance_mode": "disable"
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<host>
<status>enable</status>
<maintenance_mode>disable</maintenance_mode>
</host>

View File

@ -0,0 +1,7 @@
{
"host": {
"host": "%(host_name)s",
"maintenance_mode": "off_maintenance",
"status": "enabled"
}
}

View File

@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<host>
<status>enabled</status>
<maintenance_mode>off_maintenance</maintenance_mode>
<host>%(host_name)s</host>
</host>

View File

@ -0,0 +1,39 @@
{
"hosts": [
{
"host_name": "%(host_name)s",
"service": "conductor",
"zone": "internal"
},
{
"host_name": "%(host_name)s",
"service": "compute",
"zone": "nova"
},
{
"host_name": "%(host_name)s",
"service": "cert",
"zone": "internal"
},
{
"host_name": "%(host_name)s",
"service": "consoleauth",
"zone": "internal"
},
{
"host_name": "%(host_name)s",
"service": "network",
"zone": "internal"
},
{
"host_name": "%(host_name)s",
"service": "scheduler",
"zone": "internal"
},
{
"host_name": "%(host_name)s",
"service": "cells",
"zone": "internal"
}
]
}

View File

@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<hosts>
<host zone="internal" host_name="%(host_name)s" service="conductor"/>
<host zone="nova" host_name="%(host_name)s" service="compute"/>
<host zone="internal" host_name="%(host_name)s" service="cert"/>
<host zone="internal" host_name="%(host_name)s" service="consoleauth"/>
<host zone="internal" host_name="%(host_name)s" service="network"/>
<host zone="internal" host_name="%(host_name)s" service="scheduler"/>
<host zone="internal" host_name="%(host_name)s" service="cells"/>
</hosts>

View File

@ -0,0 +1,56 @@
# 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 api_sample_base
class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
extension_name = "os-hosts"
def test_host_startup(self):
response = self._do_get('os-hosts/%s/startup' % self.compute.host)
subs = self._get_regexes()
self._verify_response('host-get-startup', subs, response, 200)
def test_host_reboot(self):
response = self._do_get('os-hosts/%s/reboot' % self.compute.host)
subs = self._get_regexes()
self._verify_response('host-get-reboot', subs, response, 200)
def test_host_shutdown(self):
response = self._do_get('os-hosts/%s/shutdown' % self.compute.host)
subs = self._get_regexes()
self._verify_response('host-get-shutdown', subs, response, 200)
def test_host_maintenance(self):
response = self._do_put('os-hosts/%s' % self.compute.host,
'host-put-maintenance-req', {})
subs = self._get_regexes()
self._verify_response('host-put-maintenance-resp', subs, response, 200)
def test_host_get(self):
response = self._do_get('os-hosts/%s' % self.compute.host)
subs = self._get_regexes()
self._verify_response('host-get-resp', subs, response, 200)
def test_hosts_list(self):
response = self._do_get('os-hosts')
subs = self._get_regexes()
self._verify_response('hosts-list-resp', subs, response, 200)
class HostsSampleXmlTest(HostsSampleJsonTest):
ctype = 'xml'