diff --git a/doc/api_samples/all_extensions/extensions-get-resp.json b/doc/api_samples/all_extensions/extensions-get-resp.json
index fa780a5562c5..3c25de219de9 100644
--- a/doc/api_samples/all_extensions/extensions-get-resp.json
+++ b/doc/api_samples/all_extensions/extensions-get-resp.json
@@ -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.",
diff --git a/doc/api_samples/all_extensions/extensions-get-resp.xml b/doc/api_samples/all_extensions/extensions-get-resp.xml
index d12e74d80a56..5a1adebbde8d 100644
--- a/doc/api_samples/all_extensions/extensions-get-resp.xml
+++ b/doc/api_samples/all_extensions/extensions-get-resp.xml
@@ -126,6 +126,9 @@
Extended services support.
+
+ Extended hypervisors support.
+
Extended Volumes support.
diff --git a/doc/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.json b/doc/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.json
new file mode 100644
index 000000000000..01b6428446c9
--- /dev/null
+++ b/doc/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.json
@@ -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
+ }
+}
diff --git a/doc/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.xml b/doc/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.xml
new file mode 100644
index 000000000000..244e8999691b
--- /dev/null
+++ b/doc/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/doc/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json b/doc/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json
index 149f031ded55..5fa4493ef601 100644
--- a/doc/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json
+++ b/doc/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json
@@ -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
}
]
-}
\ No newline at end of file
+}
diff --git a/doc/v3/api_samples/os-hypervisors/hypervisors-show-resp.json b/doc/v3/api_samples/os-hypervisors/hypervisors-show-resp.json
index ef1aac63376c..1ab1b99be882 100644
--- a/doc/v3/api_samples/os-hypervisors/hypervisors-show-resp.json
+++ b/doc/v3/api_samples/os-hypervisors/hypervisors-show-resp.json
@@ -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
}
-}
\ No newline at end of file
+}
diff --git a/doc/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json b/doc/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json
index 8751f9c44b75..aa0e92efb39b 100644
--- a/doc/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json
+++ b/doc/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json
@@ -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
}
]
-}
\ No newline at end of file
+}
diff --git a/doc/v3/api_samples/os-pci/hypervisors-pci-show-resp.json b/doc/v3/api_samples/os-pci/hypervisors-pci-show-resp.json
index 16b178ad5f30..175050162120 100644
--- a/doc/v3/api_samples/os-pci/hypervisors-pci-show-resp.json
+++ b/doc/v3/api_samples/os-pci/hypervisors-pci-show-resp.json
@@ -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
}
-}
\ No newline at end of file
+}
diff --git a/nova/api/openstack/compute/contrib/extended_hypervisors.py b/nova/api/openstack/compute/contrib/extended_hypervisors.py
new file mode 100644
index 000000000000..a627205b9f07
--- /dev/null
+++ b/nova/api/openstack/compute/contrib/extended_hypervisors.py
@@ -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"
diff --git a/nova/api/openstack/compute/contrib/hypervisors.py b/nova/api/openstack/compute/contrib/hypervisors.py
index d0e2daaca2dd..b80a2ac2c661 100644
--- a/nova/api/openstack/compute/contrib/hypervisors.py
+++ b/nova/api/openstack/compute/contrib/hypervisors.py
@@ -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',
diff --git a/nova/api/openstack/compute/plugins/v3/hypervisors.py b/nova/api/openstack/compute/plugins/v3/hypervisors.py
index 007b8853859a..644d73a6be5f 100644
--- a/nova/api/openstack/compute/plugins/v3/hypervisors.py
+++ b/nova/api/openstack/compute/plugins/v3/hypervisors.py
@@ -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'] = {
diff --git a/nova/tests/api/openstack/compute/contrib/test_extended_hypervisors.py b/nova/tests/api/openstack/compute/contrib/test_extended_hypervisors.py
new file mode 100644
index 000000000000..72be69744c31
--- /dev/null
+++ b/nova/tests/api/openstack/compute/contrib/test_extended_hypervisors.py
@@ -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')))
diff --git a/nova/tests/api/openstack/compute/contrib/test_hypervisors.py b/nova/tests/api/openstack/compute/contrib/test_hypervisors.py
index 3b9824f98735..80f499175462 100644
--- a/nova/tests/api/openstack/compute/contrib/test_hypervisors.py
+++ b/nova/tests/api/openstack/compute/contrib/test_hypervisors.py
@@ -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)
diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_hypervisors.py b/nova/tests/api/openstack/compute/plugins/v3/test_hypervisors.py
index 629843311bc5..7d746c8148d8 100644
--- a/nova/tests/api/openstack/compute/plugins/v3/test_hypervisors.py
+++ b/nova/tests/api/openstack/compute/plugins/v3/test_hypervisors.py
@@ -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')
diff --git a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl
index c3ae0280047d..6a59a356be23 100644
--- a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.json.tpl
@@ -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",
diff --git a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl
index e8715ee8f77d..20fc74cf6806 100644
--- a/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/all_extensions/extensions-get-resp.xml.tpl
@@ -147,6 +147,9 @@
%(text)s
+
+ %(text)s
+
%(text)s
diff --git a/nova/tests/integrated/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.json.tpl b/nova/tests/integrated/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.json.tpl
new file mode 100644
index 000000000000..6b287a838ce8
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.json.tpl
@@ -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
+ }
+}
diff --git a/nova/tests/integrated/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.xml.tpl b/nova/tests/integrated/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.xml.tpl
new file mode 100644
index 000000000000..5b9f66416ecd
--- /dev/null
+++ b/nova/tests/integrated/api_samples/os-extended-hypervisors/hypervisors-show-with-ip-resp.xml.tpl
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl b/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
index 88eb4ad86e58..db29146071a2 100644
--- a/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
@@ -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",
diff --git a/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.xml.tpl b/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.xml.tpl
index f0c20662d4e7..e8d8a3f40aae 100644
--- a/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-hypervisors/hypervisors-detail-resp.xml.tpl
@@ -1,6 +1,6 @@
-
+
diff --git a/nova/tests/integrated/test_api_samples.py b/nova/tests/integrated/test_api_samples.py
index a81ab20e7217..4ee9fae0e832 100644
--- a/nova/tests/integrated/test_api_samples.py
+++ b/nova/tests/integrated/test_api_samples.py
@@ -3410,6 +3410,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")
diff --git a/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
index 47c5065d351c..06789221149c 100644
--- a/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
+++ b/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-detail-resp.json.tpl
@@ -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",
diff --git a/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl
index c9638423d29d..6b287a838ce8 100644
--- a/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl
+++ b/nova/tests/integrated/v3/api_samples/os-hypervisors/hypervisors-show-resp.json.tpl
@@ -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",
diff --git a/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl
index 8751f9c44b75..9eb9e8c9c0ba 100644
--- a/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl
+++ b/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-detail-resp.json.tpl
@@ -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
}
]
-}
\ No newline at end of file
+}
diff --git a/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl
index 16b178ad5f30..8c626fd57009 100644
--- a/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl
+++ b/nova/tests/integrated/v3/api_samples/os-pci/hypervisors-pci-show-resp.json.tpl
@@ -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
}
-}
\ No newline at end of file
+}
diff --git a/nova/tests/integrated/v3/test_pci.py b/nova/tests/integrated/v3/test_pci.py
index 0faa79283ddd..cfe6210cd648 100644
--- a/nova/tests/integrated/v3/test_pci.py
+++ b/nova/tests/integrated/v3/test_pci.py
@@ -45,6 +45,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",