Merge "Adds host_ip to hypervisor show API"
This commit is contained in:
commit
50d3ddaedc
@ -280,6 +280,14 @@
|
||||
"namespace": "http://docs.openstack.org/compute/ext/extended_quotas/api/v1.1",
|
||||
"updated": "2013-06-09T00:00:00+00:00"
|
||||
},
|
||||
{
|
||||
"alias": "os-extended-hypervisors",
|
||||
"description": "Extended hypervisors support.",
|
||||
"links": [],
|
||||
"name": "ExtendedHypervisors",
|
||||
"namespace": "http://docs.openstack.org/compute/ext/extended_hypervisors/api/v1.1",
|
||||
"updated": "2013-10-21T00:00:00-00:00"
|
||||
},
|
||||
{
|
||||
"alias": "os-extended-services",
|
||||
"description": "Extended services support.",
|
||||
|
@ -126,6 +126,9 @@
|
||||
<extension alias="os-extended-services" updated="2013-05-17T00:00:00-00:00" namespace="http://docs.openstack.org/compute/ext/extended_services/api/v2" name="ExtendedServices">
|
||||
<description>Extended services support.</description>
|
||||
</extension>
|
||||
<extension alias="os-extended-hypervisors" updated="2013-10-21T00:00:00-00:00" namespace="http://docs.openstack.org/compute/ext/extended_hypervisors/api/v1.1" name="ExtendedHypervisors">
|
||||
<description>Extended hypervisors support.</description>
|
||||
</extension>
|
||||
<extension alias="os-extended-volumes" updated="2013-06-07T00:00:00+00:00" namespace="http://docs.openstack.org/compute/ext/extended_volumes/api/v1.1" name="ExtendedVolumes">
|
||||
<description>Extended Volumes support.</description>
|
||||
</extension>
|
||||
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"id": 1,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"service": {
|
||||
"host": "5641188ab2964f88a21042b493585ff8",
|
||||
"id": 2
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="0" host_ip="1.1.1.1" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<service host="807e1a43ceb740138eea32969c3e9fe5" id="2"/>
|
||||
</hypervisor>
|
@ -4,6 +4,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
@ -23,4 +24,4 @@
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
@ -21,4 +22,4 @@
|
||||
"vcpus": 1,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
@ -35,4 +36,4 @@
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
@ -33,4 +34,4 @@
|
||||
"vcpus": 1,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
25
nova/api/openstack/compute/contrib/extended_hypervisors.py
Normal file
25
nova/api/openstack/compute/contrib/extended_hypervisors.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright 2014 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.api.openstack import extensions
|
||||
|
||||
|
||||
class Extended_hypervisors(extensions.ExtensionDescriptor):
|
||||
"""Extended hypervisors support."""
|
||||
|
||||
name = "ExtendedHypervisors"
|
||||
alias = "os-extended-hypervisors"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"extended_hypervisors/api/v1.1")
|
||||
updated = "2014-01-04T00:00:00-00:00"
|
@ -46,6 +46,7 @@ def make_hypervisor(elem, detail):
|
||||
elem.set('running_vms')
|
||||
elem.set('cpu_info')
|
||||
elem.set('disk_available_least')
|
||||
elem.set('host_ip')
|
||||
|
||||
service = xmlutil.SubTemplateElement(elem, 'service',
|
||||
selector='service')
|
||||
@ -125,9 +126,10 @@ class HypervisorStatisticsTemplate(xmlutil.TemplateBuilder):
|
||||
class HypervisorsController(object):
|
||||
"""The Hypervisors API controller for the OpenStack API."""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, ext_mgr):
|
||||
self.host_api = compute.HostAPI()
|
||||
super(HypervisorsController, self).__init__()
|
||||
self.ext_mgr = ext_mgr
|
||||
|
||||
def _view_hypervisor(self, hypervisor, detail, servers=None, **kwargs):
|
||||
hyp_dict = {
|
||||
@ -136,11 +138,15 @@ class HypervisorsController(object):
|
||||
}
|
||||
|
||||
if detail and not servers:
|
||||
for field in ('vcpus', 'memory_mb', 'local_gb', 'vcpus_used',
|
||||
'memory_mb_used', 'local_gb_used',
|
||||
'hypervisor_type', 'hypervisor_version',
|
||||
'free_ram_mb', 'free_disk_gb', 'current_workload',
|
||||
'running_vms', 'cpu_info', 'disk_available_least'):
|
||||
fields = ('vcpus', 'memory_mb', 'local_gb', 'vcpus_used',
|
||||
'memory_mb_used', 'local_gb_used',
|
||||
'hypervisor_type', 'hypervisor_version',
|
||||
'free_ram_mb', 'free_disk_gb', 'current_workload',
|
||||
'running_vms', 'cpu_info', 'disk_available_least')
|
||||
ext_loaded = self.ext_mgr.is_loaded('os-extended-hypervisors')
|
||||
if ext_loaded:
|
||||
fields += ('host_ip',)
|
||||
for field in fields:
|
||||
hyp_dict[field] = hypervisor[field]
|
||||
|
||||
hyp_dict['service'] = {
|
||||
@ -258,7 +264,7 @@ class Hypervisors(extensions.ExtensionDescriptor):
|
||||
|
||||
def get_resources(self):
|
||||
resources = [extensions.ResourceExtension('os-hypervisors',
|
||||
HypervisorsController(),
|
||||
HypervisorsController(self.ext_mgr),
|
||||
collection_actions={'detail': 'GET',
|
||||
'statistics': 'GET'},
|
||||
member_actions={'uptime': 'GET',
|
||||
|
@ -45,7 +45,8 @@ class HypervisorsController(object):
|
||||
'memory_mb_used', 'local_gb_used',
|
||||
'hypervisor_type', 'hypervisor_version',
|
||||
'free_ram_mb', 'free_disk_gb', 'current_workload',
|
||||
'running_vms', 'cpu_info', 'disk_available_least'):
|
||||
'running_vms', 'cpu_info', 'disk_available_least',
|
||||
'host_ip'):
|
||||
hyp_dict[field] = hypervisor[field]
|
||||
|
||||
hyp_dict['service'] = {
|
||||
|
@ -0,0 +1,115 @@
|
||||
# Copyright 2014 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.api.openstack.compute.contrib import hypervisors
|
||||
from nova.tests.api.openstack.compute.contrib import test_hypervisors
|
||||
from nova.tests.api.openstack import fakes
|
||||
|
||||
|
||||
class ExtendedHypervisorsTest(test_hypervisors.HypervisorsTest):
|
||||
def setUp(self):
|
||||
super(ExtendedHypervisorsTest, self).setUp()
|
||||
self.ext_mgr.extensions['os-extended-hypervisors'] = True
|
||||
self.controller = hypervisors.HypervisorsController(self.ext_mgr)
|
||||
|
||||
def test_view_hypervisor_detail_noservers(self):
|
||||
result = self.controller._view_hypervisor(
|
||||
test_hypervisors.TEST_HYPERS[0], True)
|
||||
|
||||
self.assertEqual(result, dict(
|
||||
id=1,
|
||||
hypervisor_hostname="hyper1",
|
||||
vcpus=4,
|
||||
memory_mb=10 * 1024,
|
||||
local_gb=250,
|
||||
vcpus_used=2,
|
||||
memory_mb_used=5 * 1024,
|
||||
local_gb_used=125,
|
||||
hypervisor_type="xen",
|
||||
hypervisor_version=3,
|
||||
free_ram_mb=5 * 1024,
|
||||
free_disk_gb=125,
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1',
|
||||
service=dict(id=1, host='compute1')))
|
||||
|
||||
def test_detail(self):
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/os-hypervisors/detail',
|
||||
use_admin_context=True)
|
||||
result = self.controller.detail(req)
|
||||
|
||||
self.assertEqual(result, dict(hypervisors=[
|
||||
dict(id=1,
|
||||
service=dict(id=1, host="compute1"),
|
||||
vcpus=4,
|
||||
memory_mb=10 * 1024,
|
||||
local_gb=250,
|
||||
vcpus_used=2,
|
||||
memory_mb_used=5 * 1024,
|
||||
local_gb_used=125,
|
||||
hypervisor_type="xen",
|
||||
hypervisor_version=3,
|
||||
hypervisor_hostname="hyper1",
|
||||
free_ram_mb=5 * 1024,
|
||||
free_disk_gb=125,
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1'),
|
||||
dict(id=2,
|
||||
service=dict(id=2, host="compute2"),
|
||||
vcpus=4,
|
||||
memory_mb=10 * 1024,
|
||||
local_gb=250,
|
||||
vcpus_used=2,
|
||||
memory_mb_used=5 * 1024,
|
||||
local_gb_used=125,
|
||||
hypervisor_type="xen",
|
||||
hypervisor_version=3,
|
||||
hypervisor_hostname="hyper2",
|
||||
free_ram_mb=5 * 1024,
|
||||
free_disk_gb=125,
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100,
|
||||
host_ip='2.2.2.2')]))
|
||||
|
||||
def test_show_withid(self):
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/os-hypervisors/1')
|
||||
result = self.controller.show(req, '1')
|
||||
|
||||
self.assertEqual(result, dict(hypervisor=dict(
|
||||
id=1,
|
||||
service=dict(id=1, host="compute1"),
|
||||
vcpus=4,
|
||||
memory_mb=10 * 1024,
|
||||
local_gb=250,
|
||||
vcpus_used=2,
|
||||
memory_mb_used=5 * 1024,
|
||||
local_gb_used=125,
|
||||
hypervisor_type="xen",
|
||||
hypervisor_version=3,
|
||||
hypervisor_hostname="hyper1",
|
||||
free_ram_mb=5 * 1024,
|
||||
free_disk_gb=125,
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1')))
|
@ -17,6 +17,7 @@ from lxml import etree
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack.compute.contrib import hypervisors
|
||||
from nova.api.openstack import extensions
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova.db.sqlalchemy import api as db_api
|
||||
@ -49,7 +50,8 @@ TEST_HYPERS = [
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100),
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1'),
|
||||
dict(id=2,
|
||||
service_id=2,
|
||||
service=dict(id=2,
|
||||
@ -73,7 +75,8 @@ TEST_HYPERS = [
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100)]
|
||||
disk_available_least=100,
|
||||
host_ip='2.2.2.2')]
|
||||
TEST_SERVERS = [dict(name="inst1", uuid="uuid1", host="compute1"),
|
||||
dict(name="inst2", uuid="uuid2", host="compute2"),
|
||||
dict(name="inst3", uuid="uuid3", host="compute1"),
|
||||
@ -134,7 +137,9 @@ class HypervisorsTest(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
super(HypervisorsTest, self).setUp()
|
||||
self.context = context.get_admin_context()
|
||||
self.controller = hypervisors.HypervisorsController()
|
||||
self.ext_mgr = extensions.ExtensionManager()
|
||||
self.ext_mgr.extensions = {}
|
||||
self.controller = hypervisors.HypervisorsController(self.ext_mgr)
|
||||
|
||||
self.stubs.Set(db, 'compute_node_get_all', fake_compute_node_get_all)
|
||||
self.stubs.Set(db, 'compute_node_search_by_hypervisor',
|
||||
@ -402,6 +407,7 @@ class HypervisorsSerializersTest(test.NoDBTestCase):
|
||||
running_vms=2,
|
||||
cpu_info="json data",
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1',
|
||||
service=dict(id=1, host="compute1")),
|
||||
dict(hypervisor_hostname="hyper2",
|
||||
id=2,
|
||||
@ -419,6 +425,7 @@ class HypervisorsSerializersTest(test.NoDBTestCase):
|
||||
running_vms=2,
|
||||
cpu_info="json data",
|
||||
disk_available_least=100,
|
||||
host_ip='2.2.2.2',
|
||||
service=dict(id=2, host="compute2"))])
|
||||
text = serializer.serialize(exemplar)
|
||||
tree = etree.fromstring(text)
|
||||
@ -448,6 +455,7 @@ class HypervisorsSerializersTest(test.NoDBTestCase):
|
||||
running_vms=2,
|
||||
cpu_info="json data",
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1',
|
||||
service=dict(id=1, host="compute1")))
|
||||
text = serializer.serialize(exemplar)
|
||||
tree = etree.fromstring(text)
|
||||
|
@ -47,7 +47,8 @@ TEST_HYPERS = [
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100),
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1'),
|
||||
dict(id=2,
|
||||
service_id=2,
|
||||
service=dict(id=2,
|
||||
@ -71,7 +72,8 @@ TEST_HYPERS = [
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100)]
|
||||
disk_available_least=100,
|
||||
host_ip='2.2.2.2')]
|
||||
TEST_SERVERS = [dict(name="inst1", uuid="uuid1", host="compute1"),
|
||||
dict(name="inst2", uuid="uuid2", host="compute2"),
|
||||
dict(name="inst3", uuid="uuid3", host="compute1"),
|
||||
@ -168,6 +170,7 @@ class HypervisorsTest(test.NoDBTestCase):
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1',
|
||||
service=dict(id=1, host='compute1')))
|
||||
|
||||
def test_view_hypervisor_servers(self):
|
||||
@ -219,7 +222,8 @@ class HypervisorsTest(test.NoDBTestCase):
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100),
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1'),
|
||||
dict(id=2,
|
||||
service=dict(id=2, host="compute2"),
|
||||
vcpus=4,
|
||||
@ -236,7 +240,8 @@ class HypervisorsTest(test.NoDBTestCase):
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100)]))
|
||||
disk_available_least=100,
|
||||
host_ip='2.2.2.2')]))
|
||||
|
||||
def test_detail_non_admin(self):
|
||||
req = fakes.HTTPRequestV3.blank('/os-hypervisors/detail')
|
||||
@ -275,7 +280,8 @@ class HypervisorsTest(test.NoDBTestCase):
|
||||
current_workload=2,
|
||||
running_vms=2,
|
||||
cpu_info='cpu_info',
|
||||
disk_available_least=100)))
|
||||
disk_available_least=100,
|
||||
host_ip='1.1.1.1')))
|
||||
|
||||
def test_show_non_admin(self):
|
||||
req = fakes.HTTPRequestV3.blank('/os-hypervisors/1')
|
||||
|
@ -400,6 +400,14 @@
|
||||
"namespace": "http://docs.openstack.org/compute/ext/hypervisors/api/v1.1",
|
||||
"updated": "%(timestamp)s"
|
||||
},
|
||||
{
|
||||
"alias": "os-extended-hypervisors",
|
||||
"description": "%(text)s",
|
||||
"links": [],
|
||||
"name": "ExtendedHypervisors",
|
||||
"namespace": "http://docs.openstack.org/compute/ext/extended_hypervisors/api/v1.1",
|
||||
"updated": "%(timestamp)s"
|
||||
},
|
||||
{
|
||||
"alias": "os-instance_usage_audit_log",
|
||||
"description": "%(text)s",
|
||||
|
@ -147,6 +147,9 @@
|
||||
<extension alias="os-hypervisors" updated="%(timestamp)s" namespace="http://docs.openstack.org/compute/ext/hypervisors/api/v1.1" name="Hypervisors">
|
||||
<description>%(text)s</description>
|
||||
</extension>
|
||||
<extension alias="os-extended-hypervisors" name="ExtendedHypervisors" namespace="http://docs.openstack.org/compute/ext/extended_hypervisors/api/v1.1" updated="%(timestamp)s">
|
||||
<description>%(text)s</description>
|
||||
</extension>
|
||||
<extension alias="os-instance_usage_audit_log" updated="%(timestamp)s" namespace="http://docs.openstack.org/ext/services/api/v1.1" name="OSInstanceUsageAuditLog">
|
||||
<description>%(text)s</description>
|
||||
</extension>
|
||||
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hypervisor": {
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "%(ip)s",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
"hypervisor_type": "fake",
|
||||
"hypervisor_version": 1,
|
||||
"id": %(hypervisor_id)s,
|
||||
"local_gb": 1028,
|
||||
"local_gb_used": 0,
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"service": {
|
||||
"host": "%(host_name)s",
|
||||
"id": 2
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="0" host_ip="%(ip)s" local_gb="1028" free_ram_mb="7680" id="%(hypervisor_id)s">
|
||||
<service host="%(host_name)s" id="2"/>
|
||||
</hypervisor>
|
@ -4,6 +4,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": null,
|
||||
"host_ip": "%(ip)s",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hypervisors>
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="None" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<hypervisor vcpus_used="0" hypervisor_type="fake" local_gb_used="0" hypervisor_hostname="fake-mini" memory_mb_used="512" memory_mb="8192" current_workload="0" vcpus="1" cpu_info="?" running_vms="0" free_disk_gb="1028" hypervisor_version="1" disk_available_least="None" host_ip="%(ip)s" local_gb="1028" free_ram_mb="7680" id="1">
|
||||
<service host="%(host_name)s" id="2"/>
|
||||
</hypervisor>
|
||||
</hypervisors>
|
||||
|
@ -3468,6 +3468,27 @@ class HypervisorsSampleXmlTests(HypervisorsSampleJsonTests):
|
||||
ctype = "xml"
|
||||
|
||||
|
||||
class ExtendedHypervisorsJsonTest(ApiSampleTestBaseV2):
|
||||
extends_name = ("nova.api.openstack.compute.contrib."
|
||||
"hypervisors.Hypervisors")
|
||||
extension_name = ("nova.api.openstack.compute.contrib."
|
||||
"extended_hypervisors.Extended_hypervisors")
|
||||
|
||||
def test_hypervisors_show_with_ip(self):
|
||||
hypervisor_id = 1
|
||||
subs = {
|
||||
'hypervisor_id': hypervisor_id
|
||||
}
|
||||
response = self._do_get('os-hypervisors/%s' % hypervisor_id)
|
||||
subs.update(self._get_regexes())
|
||||
self._verify_response('hypervisors-show-with-ip-resp',
|
||||
subs, response, 200)
|
||||
|
||||
|
||||
class ExtendedHypervisorsXmlTest(ExtendedHypervisorsJsonTest):
|
||||
ctype = 'xml'
|
||||
|
||||
|
||||
class HypervisorsCellsSampleJsonTests(ApiSampleTestBaseV2):
|
||||
extension_name = ("nova.api.openstack.compute.contrib.hypervisors."
|
||||
"Hypervisors")
|
||||
|
@ -4,6 +4,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "%(ip)s",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
|
@ -3,6 +3,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "%(ip)s",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
|
@ -4,6 +4,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "%(ip)s",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
@ -35,4 +36,4 @@
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "%(ip)s",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
@ -33,4 +34,4 @@
|
||||
"vcpus": 1,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ class ExtendedHyervisorPciSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
self.fake_compute_node = {"cpu_info": "?",
|
||||
"current_workload": 0,
|
||||
"disk_available_least": 0,
|
||||
"host_ip": "1.1.1.1",
|
||||
"free_disk_gb": 1028,
|
||||
"free_ram_mb": 7680,
|
||||
"hypervisor_hostname": "fake-mini",
|
||||
|
Loading…
x
Reference in New Issue
Block a user