Use CONF.host for powervm nodename
The get_available_nodes method of the powervm virt driver was returning a string based on the machine type, model, and serial number of the host. This was inconsistent with other drivers. It also required a working NovaLink connection, which cannot be guaranteed. This change replaces the MTMS string with CONF.host. The same change was made to the in-tree driver with nova commits f2e8244e169ed2ecb8e06e76de1755033be87f21 and de5b7d8f257ba89d5f3dab805f8e49ffc6eda4aa Change-Id: Id41c4576c32e7e8cf6b2c3c2020303f87ecaf3d3
This commit is contained in:
parent
74f92e1397
commit
f5b61f15d4
|
@ -138,6 +138,10 @@ class TestPowerVMDriver(test.TestCase):
|
||||||
self.inst_ibmi = objects.Instance(**powervm.TEST_INST_SPAWNING)
|
self.inst_ibmi = objects.Instance(**powervm.TEST_INST_SPAWNING)
|
||||||
self.inst_ibmi.system_metadata = {'image_os_distro': 'ibmi'}
|
self.inst_ibmi.system_metadata = {'image_os_distro': 'ibmi'}
|
||||||
|
|
||||||
|
def test_get_available_nodes(self):
|
||||||
|
self.flags(host='hostname')
|
||||||
|
self.assertEqual(['hostname'], self.drv.get_available_nodes('node'))
|
||||||
|
|
||||||
def test_driver_capabilities(self):
|
def test_driver_capabilities(self):
|
||||||
"""Test the default capabilities."""
|
"""Test the default capabilities."""
|
||||||
test_driver = driver.PowerVMDriver(fake.FakeVirtAPI())
|
test_driver = driver.PowerVMDriver(fake.FakeVirtAPI())
|
||||||
|
|
|
@ -23,7 +23,6 @@ from oslo_serialization import jsonutils
|
||||||
import pypowervm.tests.test_fixtures as pvm_fx
|
import pypowervm.tests.test_fixtures as pvm_fx
|
||||||
from pypowervm.wrappers import iocard as pvm_card
|
from pypowervm.wrappers import iocard as pvm_card
|
||||||
from pypowervm.wrappers import managed_system as pvm_ms
|
from pypowervm.wrappers import managed_system as pvm_ms
|
||||||
from pypowervm.wrappers import mtms as pvm_mtms
|
|
||||||
|
|
||||||
from nova_powervm.virt.powervm import host as pvm_host
|
from nova_powervm.virt.powervm import host as pvm_host
|
||||||
|
|
||||||
|
@ -50,8 +49,6 @@ class TestPowerVMHost(test.NoDBTestCase):
|
||||||
mock_sriov(1, [mock_pport(2, 'foo', 1), mock_pport(3, '', 2)]),
|
mock_sriov(1, [mock_pport(2, 'foo', 1), mock_pport(3, '', 2)]),
|
||||||
mock_sriov(4, [mock_pport(5, 'bar', 3)])]
|
mock_sriov(4, [mock_pport(5, 'bar', 3)])]
|
||||||
ms_wrapper = mock.create_autospec(pvm_ms.System, spec_set=True)
|
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)
|
asio = mock.create_autospec(pvm_ms.ASIOConfig, spec_set=True)
|
||||||
asio.configure_mock(sriov_adapters=sriov_adaps)
|
asio.configure_mock(sriov_adapters=sriov_adaps)
|
||||||
ms_wrapper.configure_mock(
|
ms_wrapper.configure_mock(
|
||||||
|
@ -59,9 +56,9 @@ class TestPowerVMHost(test.NoDBTestCase):
|
||||||
proc_units_avail=500,
|
proc_units_avail=500,
|
||||||
memory_configurable=5242880,
|
memory_configurable=5242880,
|
||||||
memory_free=5242752,
|
memory_free=5242752,
|
||||||
mtms=mtms,
|
|
||||||
memory_region_size='big',
|
memory_region_size='big',
|
||||||
asio_config=asio)
|
asio_config=asio)
|
||||||
|
self.flags(host='the_hostname')
|
||||||
|
|
||||||
# Run the actual test
|
# Run the actual test
|
||||||
stats = pvm_host.build_host_resource_from_ms(ms_wrapper)
|
stats = pvm_host.build_host_resource_from_ms(ms_wrapper)
|
||||||
|
@ -71,7 +68,7 @@ class TestPowerVMHost(test.NoDBTestCase):
|
||||||
fields = (('vcpus', 500), ('vcpus_used', 0),
|
fields = (('vcpus', 500), ('vcpus_used', 0),
|
||||||
('memory_mb', 5242880), ('memory_mb_used', 128),
|
('memory_mb', 5242880), ('memory_mb_used', 128),
|
||||||
'hypervisor_type', 'hypervisor_version',
|
'hypervisor_type', 'hypervisor_version',
|
||||||
'hypervisor_hostname', 'cpu_info',
|
('hypervisor_hostname', 'the_hostname'), 'cpu_info',
|
||||||
'supported_instances', 'stats', 'pci_passthrough_devices')
|
'supported_instances', 'stats', 'pci_passthrough_devices')
|
||||||
for fld in fields:
|
for fld in fields:
|
||||||
if isinstance(fld, tuple):
|
if isinstance(fld, tuple):
|
||||||
|
|
|
@ -69,6 +69,7 @@ from nova_powervm.virt.powervm.tasks import vm as tf_vm
|
||||||
from nova_powervm.virt.powervm import vm
|
from nova_powervm.virt.powervm import vm
|
||||||
from nova_powervm.virt.powervm import volume as vol_attach
|
from nova_powervm.virt.powervm import volume as vol_attach
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
@ -1048,7 +1049,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
||||||
[hypervisor_hostname].
|
[hypervisor_hostname].
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return [self.host_wrapper.mtms.mtms_str]
|
return [CONF.host]
|
||||||
|
|
||||||
def legacy_nwinfo(self):
|
def legacy_nwinfo(self):
|
||||||
"""Indicate if the driver requires the legacy network_info format."""
|
"""Indicate if the driver requires the legacy network_info format."""
|
||||||
|
|
|
@ -22,9 +22,12 @@ from oslo_serialization import jsonutils
|
||||||
from pypowervm.tasks.monitor import util as pcm_util
|
from pypowervm.tasks.monitor import util as pcm_util
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from nova import conf as cfg
|
||||||
from nova_powervm.virt.powervm.i18n import _LW
|
from nova_powervm.virt.powervm.i18n import _LW
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
# Power VM hypervisor info
|
# Power VM hypervisor info
|
||||||
# Normally, the hypervisor version is a string in the form of '8.0.0' and
|
# Normally, the hypervisor version is a string in the form of '8.0.0' and
|
||||||
|
@ -70,7 +73,7 @@ def build_host_resource_from_ms(ms_wrapper):
|
||||||
|
|
||||||
data["hypervisor_type"] = fields.HVType.PHYP
|
data["hypervisor_type"] = fields.HVType.PHYP
|
||||||
data["hypervisor_version"] = IBM_POWERVM_HYPERVISOR_VERSION
|
data["hypervisor_version"] = IBM_POWERVM_HYPERVISOR_VERSION
|
||||||
data["hypervisor_hostname"] = ms_wrapper.mtms.mtms_str
|
data["hypervisor_hostname"] = CONF.host
|
||||||
data["cpu_info"] = HOST_STATS_CPU_INFO
|
data["cpu_info"] = HOST_STATS_CPU_INFO
|
||||||
data["numa_topology"] = None
|
data["numa_topology"] = None
|
||||||
data["supported_instances"] = POWERVM_SUPPORTED_INSTANCES
|
data["supported_instances"] = POWERVM_SUPPORTED_INSTANCES
|
||||||
|
|
Loading…
Reference in New Issue