hypervisor_hostname must match get_available_nodes
Recent change I82142981281f2c26c98e829c728fa96df7555ffd switched get_available_nodes to return the CONF.host of the compute node (it was previously the MTMS of the hypervisor). This change syncs the ['hypervisor_hostname'] member of the data structure returned by get_available_resource accordingly. We also fix the test from the previous patch to use the recommended self.flags instead of using CONF directly. Change-Id: I589a5283d3694cfdaff7dd377f3eaa77dd3b7aef
This commit is contained in:
parent
922f539a67
commit
de5b7d8f25
|
@ -16,7 +16,6 @@ from __future__ import absolute_import
|
|||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from pypowervm import const as pvm_const
|
||||
from pypowervm import exceptions as pvm_exc
|
||||
from pypowervm.helpers import log_helper as pvm_hlp_log
|
||||
|
@ -32,9 +31,6 @@ from nova.virt.powervm.disk import ssp
|
|||
from nova.virt.powervm import driver
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class TestPowerVMDriver(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -93,7 +89,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
|
|||
mock_names.assert_called_once_with(self.adp)
|
||||
|
||||
def test_get_available_nodes(self):
|
||||
self.assertEqual([CONF.host], self.drv.get_available_nodes('node'))
|
||||
self.flags(host='hostname')
|
||||
self.assertEqual(['hostname'], self.drv.get_available_nodes('node'))
|
||||
|
||||
@mock.patch('pypowervm.wrappers.managed_system.System', autospec=True)
|
||||
@mock.patch('nova.virt.powervm.host.build_host_resource_from_ms')
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
import mock
|
||||
from pypowervm.wrappers import managed_system as pvm_ms
|
||||
from pypowervm.wrappers import mtms as pvm_mtms
|
||||
|
||||
from nova import test
|
||||
from nova.virt.powervm import host as pvm_host
|
||||
|
@ -25,17 +24,15 @@ class TestPowerVMHost(test.NoDBTestCase):
|
|||
def test_host_resources(self):
|
||||
# Create objects to test with
|
||||
ms_wrapper = mock.create_autospec(pvm_ms.System, spec_set=True)
|
||||
mtms = mock.create_autospec(pvm_mtms.MTMS, spec_set=True)
|
||||
mtms.configure_mock(mtms_str='8484923A123456')
|
||||
asio = mock.create_autospec(pvm_ms.ASIOConfig, spec_set=True)
|
||||
ms_wrapper.configure_mock(
|
||||
proc_units_configurable=500,
|
||||
proc_units_avail=500,
|
||||
memory_configurable=5242880,
|
||||
memory_free=5242752,
|
||||
mtms=mtms,
|
||||
memory_region_size='big',
|
||||
asio_config=asio)
|
||||
self.flags(host='the_hostname')
|
||||
|
||||
# Run the actual test
|
||||
stats = pvm_host.build_host_resource_from_ms(ms_wrapper)
|
||||
|
@ -45,7 +42,7 @@ class TestPowerVMHost(test.NoDBTestCase):
|
|||
fields = (('vcpus', 500), ('vcpus_used', 0),
|
||||
('memory_mb', 5242880), ('memory_mb_used', 128),
|
||||
'hypervisor_type', 'hypervisor_version',
|
||||
'hypervisor_hostname', 'cpu_info',
|
||||
('hypervisor_hostname', 'the_hostname'), 'cpu_info',
|
||||
'supported_instances', 'stats')
|
||||
for fld in fields:
|
||||
if isinstance(fld, tuple):
|
||||
|
|
|
@ -17,9 +17,12 @@ import math
|
|||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from nova import conf as cfg
|
||||
from nova.objects import fields
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
CONF = cfg.CONF
|
||||
|
||||
# Power VM hypervisor info
|
||||
# Normally, the hypervisor version is a string in the form of '8.0.0' and
|
||||
|
@ -54,7 +57,7 @@ def build_host_resource_from_ms(ms_w):
|
|||
ms_w.memory_free)
|
||||
data["hypervisor_type"] = fields.HVType.PHYP
|
||||
data["hypervisor_version"] = IBM_POWERVM_HYPERVISOR_VERSION
|
||||
data["hypervisor_hostname"] = ms_w.mtms.mtms_str
|
||||
data["hypervisor_hostname"] = CONF.host
|
||||
data["cpu_info"] = jsonutils.dumps({'vendor': 'ibm', 'arch': 'ppc64'})
|
||||
data["numa_topology"] = None
|
||||
data["supported_instances"] = POWERVM_SUPPORTED_INSTANCES
|
||||
|
|
Loading…
Reference in New Issue