From ef5e220e218de65355ac9a3399babf7bbc70dafa Mon Sep 17 00:00:00 2001 From: Teresa Ho Date: Mon, 8 Apr 2024 22:14:06 -0400 Subject: [PATCH] Remove mgmt_ip field from host DB table This commit removes the mgmt_ip field from the database i_host table. Test Plan: PASS: AIO-SX installation PASS: AIO-SX mgmt reconfiguration PASS: AIO-DX installation PASS: Standard installation TBD: DC install TBD: DC AIO-SX mgmt reconfiguration Story: 2010722 Task: 49835 Signed-off-by: Teresa Ho Change-Id: I577fa51df261846292f2e9dff2aeba5fff431848 --- .../controllerconfig/upgrades/controller.py | 5 +- sysinv/sysinv/sysinv/sysinv/agent/manager.py | 14 +++- .../sysinv/sysinv/api/controllers/v1/host.py | 65 ++++--------------- .../sysinv/sysinv/sysinv/conductor/manager.py | 65 +++++++++++++++++-- .../sysinv/sysinv/sysinv/conductor/rpcapi.py | 40 +++++++++++- sysinv/sysinv/sysinv/sysinv/db/api.py | 1 - .../versions/137_host_remove_mgmt_ip.py | 32 +++++++++ .../sysinv/sysinv/db/sqlalchemy/models.py | 1 - sysinv/sysinv/sysinv/sysinv/objects/host.py | 5 +- .../sysinv/tests/conductor/test_manager.py | 41 +++--------- sysinv/sysinv/sysinv/sysinv/tests/db/utils.py | 2 - 11 files changed, 165 insertions(+), 106 deletions(-) create mode 100644 sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/migrate_repo/versions/137_host_remove_mgmt_ip.py diff --git a/controllerconfig/controllerconfig/controllerconfig/upgrades/controller.py b/controllerconfig/controllerconfig/controllerconfig/upgrades/controller.py index 1504f626a5..c5201c75ff 100644 --- a/controllerconfig/controllerconfig/controllerconfig/upgrades/controller.py +++ b/controllerconfig/controllerconfig/controllerconfig/upgrades/controller.py @@ -847,10 +847,9 @@ def apply_sriov_config(db_credentials, hostname): conn = psycopg2.connect(connection_string) cur = conn.cursor() cur.execute( - "select id, mgmt_ip from i_host where hostname=%s;", (hostname,)) + "select id from i_host where hostname=%s;", (hostname,)) host = cur.fetchone() host_id = host[0] - mgmt_ip = host[1] cur.execute("select id from pci_devices " "where sriov_numvfs > 0 and host_id=%s", (host_id,)) @@ -874,7 +873,7 @@ def apply_sriov_config(db_credentials, hostname): with open(tmpfile, 'w') as f: yaml.dump(config, f, default_flow_style=False) puppet_common.puppet_apply_manifest( - mgmt_ip, personality, manifest='runtime', runtime=tmpfile) + hostname, personality, manifest='runtime', runtime=tmpfile) os.close(fd) os.remove(tmpfile) diff --git a/sysinv/sysinv/sysinv/sysinv/agent/manager.py b/sysinv/sysinv/sysinv/sysinv/agent/manager.py index 59f1e73fa1..666c415c0e 100644 --- a/sysinv/sysinv/sysinv/sysinv/agent/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/agent/manager.py @@ -868,7 +868,11 @@ class AgentManager(service.PeriodicService): while (timeutils.utcnow() - wait_time).total_seconds() < MAXSLEEP: # wait for controller to come up first may be a DOR try: - ihost = rpcapi.get_ihost_by_macs(icontext, host_macs) + if (os.path.isfile(tsc.UPGRADE_DO_NOT_USE_FQDN)): + ihost = rpcapi.get_ihost_by_macs(icontext, host_macs) + else: + ihost = rpcapi.get_ihost_by_macs_v1_2(icontext, host_macs) + except Timeout: if not rpc_timeout: rpc_timeout = True @@ -883,8 +887,12 @@ class AgentManager(service.PeriodicService): hostname = socket.gethostname() if hostname != constants.LOCALHOST_HOSTNAME: try: - ihost = rpcapi.get_ihost_by_hostname(icontext, - hostname) + if (os.path.isfile(tsc.UPGRADE_DO_NOT_USE_FQDN)): + ihost = rpcapi.get_ihost_by_hostname(icontext, + hostname) + else: + ihost = rpcapi.get_ihost_by_hostname_v1_2(icontext, + hostname) except Timeout: if not rpc_timeout: rpc_timeout = True diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py index 83efc1073e..586b1de9da 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py @@ -104,7 +104,7 @@ LOG = log.getLogger(__name__) KEYRING_BM_SERVICE = "BM" ERR_CODE_LOCK_SOLE_SERVICE_PROVIDER = "-1003" HOST_XML_ATTRIBUTES = ['hostname', 'personality', 'subfunctions', 'mgmt_mac', - 'mgmt_ip', 'bm_ip', 'bm_type', 'bm_username', + 'bm_ip', 'bm_type', 'bm_username', 'bm_password', 'boot_device', 'rootfs_device', 'hw_settle', 'install_output', 'console', 'vsc_controllers', 'power_on', 'location', 'apparmor'] @@ -371,9 +371,6 @@ class Host(base.APIBase): mgmt_mac = wtypes.text "Represent the provisioned Boot mgmt MAC address of the ihost." - mgmt_ip = wtypes.text - "Represent the provisioned Boot mgmt IP address of the ihost." - bm_ip = wtypes.text "Discovered board management IP address of the ihost." @@ -599,7 +596,7 @@ class Host(base.APIBase): 'subfunction_avail', 'administrative', 'operational', 'availability', 'invprovision', 'task', 'mtce_info', 'action', 'uptime', 'reserved', 'ihost_action', - 'vim_progress_status', 'mgmt_mac', 'mgmt_ip', + 'vim_progress_status', 'mgmt_mac', 'location', 'bm_ip', 'bm_type', 'bm_username', 'isystem_uuid', 'capabilities', 'serialid', 'config_status', 'config_applied', 'config_target', @@ -1351,13 +1348,11 @@ class HostController(rest.RestController): ihost_obj = pecan.request.dbapi.ihost_get_by_mgmt_mac(mac) if ihost_obj['hostname']: hostname = ihost_obj['hostname'] - mgmt_addr = ihost_obj['mgmt_ip'] - if mgmt_addr is None: - address_name = cutils.format_address_name(hostname, - constants.NETWORK_TYPE_MGMT) - address = utils.get_primary_address_by_name(address_name, - constants.NETWORK_TYPE_MGMT, True) - mgmt_addr = address.address + address_name = cutils.format_address_name(hostname, + constants.NETWORK_TYPE_MGMT) + address = utils.get_primary_address_by_name(address_name, + constants.NETWORK_TYPE_MGMT, True) + mgmt_addr = address.address if mgmt_addr is not None: # get the management network netmask @@ -1470,22 +1465,6 @@ class HostController(rest.RestController): self._block_add_host_semantic_checks(ihost_dict) - mgmt_network = pecan.request.dbapi.network_get_by_type( - constants.NETWORK_TYPE_MGMT) - - if mgmt_network.dynamic and ihost_dict.get('mgmt_ip'): - raise wsme.exc.ClientSideError(_( - "Host-add Rejected: Cannot specify a mgmt_ip when dynamic " - "address allocation is configured")) - elif (not mgmt_network.dynamic and - not ihost_dict.get('mgmt_ip') and - ihost_dict.get('personality') not in - [constants.STORAGE, constants.CONTROLLER]): - raise wsme.exc.ClientSideError(_( - "Host-add Rejected: Cannot add a worker host without " - "specifying a mgmt_ip when static address allocation is " - "configured.")) - # Check whether vsc_controllers is set and perform semantic # checking if necessary. if ihost_dict['vsc_controllers']: @@ -1547,11 +1526,6 @@ class HostController(rest.RestController): if ihost_dict['hostname'] in hostnames: raise wsme.exc.ClientSideError( _("Host-add Rejected: Hostname already exists")) - if ihost_dict.get('mgmt_ip') and ihost_dict['mgmt_ip'] in \ - [h['mgmt_ip'] for h in current_ihosts]: - raise wsme.exc.ClientSideError( - _("Host-add Rejected: Host with mgmt_ip %s already " - "exists") % ihost_dict['mgmt_ip']) try: ihost_obj = pecan.request.dbapi.ihost_get_by_mgmt_mac( @@ -1658,19 +1632,6 @@ class HostController(rest.RestController): if ihost_dict['personality'] in (constants.CONTROLLER, constants.STORAGE): self._controller_storage_node_setup(ihost_dict) - # Validate that management name and IP do not already exist - # If one exists, other value must match in addresses table - mgmt_address_name = cutils.format_address_name( - ihost_dict['hostname'], constants.NETWORK_TYPE_MGMT) - self._validate_address_not_allocated(mgmt_address_name, - ihost_dict.get('mgmt_ip'), - constants.NETWORK_TYPE_MGMT) - - if ihost_dict.get('mgmt_ip'): - self._validate_ip_in_mgmt_network(ihost_dict['mgmt_ip']) - else: - del ihost_dict['mgmt_ip'] - # Set host to reinstalling ihost_dict.update({constants.HOST_ACTION_STATE: constants.HAS_REINSTALLING}) @@ -1709,11 +1670,11 @@ class HostController(rest.RestController): constants.NETWORK_TYPE_MGMT) address = utils.get_primary_address_by_name(address_name, constants.NETWORK_TYPE_MGMT, True) - ihost_obj['mgmt_ip'] = address.address # Add ihost to mtc new_ihost_mtc = ihost_obj.as_dict() new_ihost_mtc.update({'operation': 'add'}) + new_ihost_mtc['mgmt_ip'] = address.address new_ihost_mtc = cutils.removekeys_nonmtce(new_ihost_mtc) mtc_response = mtce_api.host_add( @@ -1738,7 +1699,6 @@ class HostController(rest.RestController): new_ihost_mtc.update({'action': constants.POWERON_ACTION}) mtc_response = {'status': None} - mtc_response = mtce_api.host_modify( self._api_token, self._mtc_address, self._mtc_port, new_ihost_mtc, constants.MTC_ADD_TIMEOUT_IN_SECS) @@ -2311,9 +2271,6 @@ class HostController(rest.RestController): pecan.request.dbapi.ihost_update( ihost_obj['uuid'], {'capabilities': ihost_obj['capabilities']}) - # Notify maintenance about updated mgmt_ip - ihost_obj['mgmt_ip'] = self._get_mgmt_ip(ihost_obj.hostname) - hostupdate.notify_mtce = True # Evaluate app reapply on lock/unlock/swact/reinstall @@ -2345,9 +2302,6 @@ class HostController(rest.RestController): LOG.info("%s Action %s perform notify_mtce" % (hostupdate.displayid, myaction)) - # Notify maintenance about updated mgmt_ip - ihost_obj['mgmt_ip'] = self._get_mgmt_ip(ihost_obj.hostname) - new_ihost_mtc = ihost_obj.as_dict() new_ihost_mtc = cutils.removekeys_nonmtce(new_ihost_mtc) @@ -2366,6 +2320,9 @@ class HostController(rest.RestController): elif myaction == constants.FORCE_UNLOCK_ACTION: new_ihost_mtc['action'] = constants.UNLOCK_ACTION + # Notify maintenance about updated mgmt_ip + new_ihost_mtc['mgmt_ip'] = self._get_mgmt_ip(ihost_obj.hostname) + if new_ihost_mtc['operation'] == 'add': # Evaluate apps reapply on new host pecan.request.rpcapi.evaluate_apps_reapply( diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py index 09fe910053..77e6ec8245 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/manager.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/manager.py @@ -311,7 +311,7 @@ class KubeAppBundleDatabase(KubeAppBundleStorageFactory): class ConductorManager(service.PeriodicService): """Sysinv Conductor service main class.""" - RPC_API_VERSION = '1.1' + RPC_API_VERSION = '1.2' my_host_id = None def __init__(self, host, topic): @@ -3699,7 +3699,6 @@ class ConductorManager(service.PeriodicService): addresses = self.dbapi.address_get_by_name(addr_name) for address in addresses: self.dbapi.address_update(address['uuid'], values) - # Do any potential distributed cloud config # We do this here where the interface is created. cutils.perform_distributed_cloud_config(self.dbapi, @@ -3707,7 +3706,6 @@ class ConductorManager(service.PeriodicService): ihost) if port: values = {'interface_id': port.interface_id} - addr_name = cutils.format_address_name(ihost.hostname, networktype) addresses = self.dbapi.address_get_by_name(addr_name) @@ -6670,7 +6668,8 @@ class ConductorManager(service.PeriodicService): ihosts = self.dbapi.ihost_get_list() - LOG.debug("Checking ihost db for macs: %s" % ihost_macs) + LOG.info("v1.1: Checking ihost db for macs: %s" % ihost_macs) + # LOG.debug("Checking ihost db for macs: %s" % ihost_macs) for mac in ihost_macs: try: mac = mac.rstrip() @@ -6681,9 +6680,40 @@ class ConductorManager(service.PeriodicService): for host in ihosts: if host.mgmt_mac == mac: - LOG.info("Host found ihost db for macs: %s" % host.hostname) + host.mgmt_ip = self.get_address_by_host_networktype( + context, host.hostname, constants.NETWORK_TYPE_MGMT) + LOG.info("v1.1: Host found ihost db for macs: %s %s" % + (host.hostname, host.mgmt_ip)) return host - LOG.debug("RPC get_ihost_by_macs called but found no ihost.") + LOG.info("v1.1: RPC get_ihost_by_macs called but found no ihost.") + + def get_ihost_by_macs_v1_2(self, context, ihost_macs): + """Finds ihost db entry based upon the mac list + + This method returns an ihost if it matches a mac + + :param context: an admin context + :param ihost_macs: list of mac addresses + :returns: ihost object, including all fields. + """ + + ihosts = self.dbapi.ihost_get_list() + + LOG.info("v1.2: Checking ihost db for macs: %s" % ihost_macs) + for mac in ihost_macs: + try: + mac = mac.rstrip() + mac = cutils.validate_and_normalize_mac(mac) + except Exception: + LOG.warn("get_ihost_by_macs_v1_2 invalid mac: %s" % mac) + continue + + for host in ihosts: + if host.mgmt_mac == mac: + LOG.info("v1.2: Host found ihost db for macs: %s" % + (host.hostname)) + return host + LOG.info("v1.2: RPC get_ihost_by_macs_v1_2 called but found no ihost.") def get_ihost_by_hostname(self, context, ihost_hostname): """Finds ihost db entry based upon the ihost hostname @@ -6704,7 +6734,28 @@ class ConductorManager(service.PeriodicService): except exception.NodeNotFound: pass - LOG.debug("RPC ihost_get_by_hostname called but found no ihost.") + LOG.info("v1.0: RPC ihost_get_by_hostname called but found no ihost.") + + def get_ihost_by_hostname_v1_2(self, context, ihost_hostname): + """Finds ihost db entry based upon the ihost hostname + + This method returns an ihost if it matches the ihost + hostname. + + :param context: an admin context + :param ihost_hostname: ihost hostname + :returns: ihost object, including all fields. + """ + + try: + ihost = self.dbapi.ihost_get_by_hostname_v1_2(ihost_hostname) + + return ihost + + except exception.NodeNotFound: + pass + + LOG.info("v1.2: RPC ihost_get_by_hostname called but found no ihost.") def get_address_by_host_networktype(self, context, name, networktype): """Finds configured address based on name and network type. diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/rpcapi.py b/sysinv/sysinv/sysinv/sysinv/conductor/rpcapi.py index 27f85f66f1..e22b8f721a 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/rpcapi.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/rpcapi.py @@ -41,9 +41,10 @@ class ConductorAPI(sysinv.openstack.common.rpc.proxy.RpcProxy): 1.0 - Initial version. 1.1 - Used for R5 + 1.2 - Used for stx10.0 """ - RPC_API_VERSION = '1.1' + RPC_API_VERSION = '1.2' def __init__(self, topic=None): if topic is None: @@ -211,7 +212,23 @@ class ConductorAPI(sysinv.openstack.common.rpc.proxy.RpcProxy): return self.call(context, self.make_msg('get_ihost_by_macs', - ihost_macs=ihost_macs)) + ihost_macs=ihost_macs), + version='1.0') + + def get_ihost_by_macs_v1_2(self, context, ihost_macs): + """Finds ihost db entry based upon the mac list + + This method returns an ihost if it matches a mac + + :param context: an admin context + :param ihost_macs: list of mac addresses + :returns: ihost object, including all fields and mgmt address. + """ + + return self.call(context, + self.make_msg('get_ihost_by_macs_v1_2', + ihost_macs=ihost_macs), + version='1.2') def get_ihost_by_hostname(self, context, ihost_hostname): """Finds ihost db entry based upon the ihost hostname @@ -226,7 +243,24 @@ class ConductorAPI(sysinv.openstack.common.rpc.proxy.RpcProxy): return self.call(context, self.make_msg('get_ihost_by_hostname', - ihost_hostname=ihost_hostname)) + ihost_hostname=ihost_hostname), + version='1.0') + + def get_ihost_by_hostname_v1_2(self, context, ihost_hostname): + """Finds ihost db entry based upon the ihost hostname + + This method returns an ihost if it matches the + hostname. + + :param context: an admin context + :param ihost_hostname: ihost hostname + :returns: ihost object, including all fields. + """ + + return self.call(context, + self.make_msg('get_ihost_by_hostname_v1_2', + ihost_hostname=ihost_hostname), + version='1.2') def get_address_by_host_networktype(self, context, name, networktype): """Finds ihost db entry based upon the ihost hostname diff --git a/sysinv/sysinv/sysinv/sysinv/db/api.py b/sysinv/sysinv/sysinv/sysinv/db/api.py index 1259ee091c..cb44e4f522 100644 --- a/sysinv/sysinv/sysinv/sysinv/db/api.py +++ b/sysinv/sysinv/sysinv/sysinv/db/api.py @@ -138,7 +138,6 @@ class Connection(object): 'uuid': uuidutils.generate_uuid(), 'invprovision': 'provisioned', 'mgmt_mac': '01:34:67:9A:CD:FE', - 'mgmt_ip': '192.168.24.11', 'provision_state': states.NOSTATE, 'administrative': 'locked', 'operational': 'disabled', diff --git a/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/migrate_repo/versions/137_host_remove_mgmt_ip.py b/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/migrate_repo/versions/137_host_remove_mgmt_ip.py new file mode 100644 index 0000000000..c25a23d851 --- /dev/null +++ b/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/migrate_repo/versions/137_host_remove_mgmt_ip.py @@ -0,0 +1,32 @@ +# +# Copyright (c) 2024 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +from sqlalchemy import Column, MetaData, Table + +ENGINE = 'InnoDB' +CHARSET = 'utf8' + + +def upgrade(migrate_engine): + """ + This database upgrade removes unused attributes + from i_host table. + """ + + meta = MetaData() + meta.bind = migrate_engine + + host_table = Table('i_host', meta, autoload=True) + host_table.drop_column(Column('mgmt_ip')) + + return True + + +def downgrade(migrate_engine): + meta = MetaData() + meta.bind = migrate_engine + + # Downgrade is unsupported. + raise NotImplementedError('SysInv database downgrade is unsupported.') diff --git a/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/models.py b/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/models.py index ef42779a98..50072cf373 100644 --- a/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/models.py +++ b/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/models.py @@ -195,7 +195,6 @@ class ihost(Base): # MAC 01:34:67:9A:CD:FG (need 16 bytes; convention here String(255)) mgmt_mac = Column(String(255), unique=True) - mgmt_ip = Column(String(255)) # board management IP address, MAC, type and username bm_ip = Column(String(255)) diff --git a/sysinv/sysinv/sysinv/sysinv/objects/host.py b/sysinv/sysinv/sysinv/sysinv/objects/host.py index 471481a357..aed13f0dec 100644 --- a/sysinv/sysinv/sysinv/sysinv/objects/host.py +++ b/sysinv/sysinv/sysinv/sysinv/objects/host.py @@ -64,7 +64,6 @@ class Host(base.SysinvObject): # NOTE: driver should be read-only after server is created 'invprovision': utils.str_or_none, 'mgmt_mac': utils.str_or_none, - 'mgmt_ip': utils.str_or_none, # Board management members 'bm_ip': utils.str_or_none, @@ -121,6 +120,10 @@ class Host(base.SysinvObject): 'target_load': _get_target_load } + _optional_fields = { + 'mgmt_ip': utils.str_or_none + } + @base.remotable_classmethod def get_by_uuid(cls, context, uuid): return cls.dbapi.ihost_get(uuid) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py b/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py index 918ce13382..b6b08fe467 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/conductor/test_manager.py @@ -623,17 +623,14 @@ class ManagerTestCase(base.DbTestCase): return ihost def test_create_ihost(self): - ihost_dict = {'mgmt_mac': '00:11:22:33:44:55', - 'mgmt_ip': '1.2.3.4'} + ihost_dict = {'mgmt_mac': '00:11:22:33:44:55'} self.service.start() res = self.service.create_ihost(self.context, ihost_dict) self.assertEqual(res['mgmt_mac'], '00:11:22:33:44:55') - self.assertEqual(res['mgmt_ip'], '1.2.3.4') def test_create_duplicate_ihost(self): - ihost_dict = {'mgmt_mac': '00:11:22:33:44:55', - 'mgmt_ip': '1.2.3.4'} + ihost_dict = {'mgmt_mac': '00:11:22:33:44:55'} self.service.start() # Create first ihost @@ -649,7 +646,7 @@ class ManagerTestCase(base.DbTestCase): self.assertEqual(res1['serialid'], res2['serialid']) def test_create_ihost_without_mac(self): - ihost_dict = {'mgmt_ip': '1.2.3.4'} + ihost_dict = {} self.assertRaises(exception.SysinvException, self.service.create_ihost, @@ -684,7 +681,6 @@ class ManagerTestCase(base.DbTestCase): def test_create_ihost_with_values(self): ihost_dict = {'mgmt_mac': '00:11:22:33:44:55', - 'mgmt_ip': '1.2.3.4', 'hostname': 'newhost', 'invprovision': 'unprovisioned', 'personality': 'worker', @@ -777,7 +773,6 @@ class ManagerTestCase(base.DbTestCase): ihost = self._create_test_ihost() ihost['mgmt_mac'] = '00:11:22:33:44:55' - ihost['mgmt_ip'] = '1.2.3.4' ihost['hostname'] = 'newhost' ihost['invprovision'] = 'unprovisioned' ihost['personality'] = 'worker' @@ -794,7 +789,6 @@ class ManagerTestCase(base.DbTestCase): res = self.service.update_ihost(self.context, ihost) self.assertEqual(res['mgmt_mac'], '00:11:22:33:44:55') - self.assertEqual(res['mgmt_ip'], '1.2.3.4') self.assertEqual(res['hostname'], 'newhost') self.assertEqual(res['invprovision'], 'unprovisioned') self.assertEqual(res['personality'], 'worker') @@ -838,7 +832,6 @@ class ManagerTestCase(base.DbTestCase): ihost = self._create_test_ihost() ihost['mgmt_mac'] = '00:11:22:33:44:55' - ihost['mgmt_ip'] = '1.2.3.4' ihost['hostname'] = 'newhost' ihost['invprovision'] = 'unprovisioned' ihost['personality'] = 'worker' @@ -875,7 +868,6 @@ class ManagerTestCase(base.DbTestCase): ihost = self._create_test_ihost() ihost['mgmt_mac'] = '00:11:22:33:44:55' - ihost['mgmt_ip'] = '1.2.3.42' ihost['hostname'] = 'newhost' ihost['invprovision'] = 'unprovisioned' ihost['personality'] = 'worker' @@ -1460,7 +1452,6 @@ class ManagerTestCase(base.DbTestCase): operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, mgmt_mac='00:11:22:33:44:56', - mgmt_ip='1.2.3.5', ) # Speed up the test @@ -1679,7 +1670,6 @@ class ManagerTestCase(base.DbTestCase): operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, mgmt_mac='00:11:22:33:44:55', - mgmt_ip='1.2.3.4', ) # Set the target version for controller-0 self.dbapi.kube_host_upgrade_update(1, {'target_version': 'v1.42.2'}) @@ -1906,7 +1896,6 @@ class ManagerTestCase(base.DbTestCase): operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, mgmt_mac='00:11:22:33:44:56', - mgmt_ip='1.2.3.5', ) # Set the target version for controller-1 self.dbapi.kube_host_upgrade_update(2, {'target_version': 'v1.42.2'}) @@ -1998,7 +1987,6 @@ class ManagerTestCase(base.DbTestCase): operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, mgmt_mac='00:11:22:33:44:55', - mgmt_ip='1.2.3.4', ) # Set the target version for controller-0 self.dbapi.kube_host_upgrade_update(1, {'target_version': 'v1.42.2'}) @@ -2016,7 +2004,6 @@ class ManagerTestCase(base.DbTestCase): operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, mgmt_mac='00:11:22:33:44:56', - mgmt_ip='1.2.3.5', ) # Set the target version for controller-1 self.dbapi.kube_host_upgrade_update(2, {'target_version': 'v1.42.2'}) @@ -2609,7 +2596,6 @@ class ManagerTestCase(base.DbTestCase): config_applied=config_applied, config_target=config_target) ihost['mgmt_mac'] = '00:11:22:33:44:55' - ihost['mgmt_ip'] = '1.2.3.42' ihost['hostname'] = hostname ihost['invprovision'] = 'provisioned' ihost['personality'] = 'controller' @@ -2862,8 +2848,7 @@ class ManagerTestCase(base.DbTestCase): administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='00:11:22:33:44:55', - mgmt_ip='1.2.3.4') + mgmt_mac='00:11:22:33:44:55') # Create controller-1 config_uuid = str(uuid.uuid4()) self._create_test_ihost( @@ -2877,8 +2862,7 @@ class ManagerTestCase(base.DbTestCase): administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='22:44:33:55:11:66', - mgmt_ip='1.2.3.5') + mgmt_mac='22:44:33:55:11:66') # Create compute-0 config_uuid = str(uuid.uuid4()) self._create_test_ihost( @@ -2892,8 +2876,7 @@ class ManagerTestCase(base.DbTestCase): administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='22:44:33:55:11:77', - mgmt_ip='1.2.3.6') + mgmt_mac='22:44:33:55:11:77') def _create_test_iports(self): enp25s0f0 = {'dev_id': 0, 'numa_node': 0, 'sriov_numvfs': 0, 'sriov_vfs_pci_address': '', @@ -3016,7 +2999,6 @@ class ManagerTestCase(base.DbTestCase): ihost_hostname = 'controller-1' ihost = self.service.get_ihost_by_hostname(self.context, ihost_hostname) self.assertEqual(ihost.mgmt_mac, '22:44:33:55:11:66') - self.assertEqual(ihost.mgmt_ip, '1.2.3.5') self.assertEqual(ihost.hostname, 'controller-1') def test_get_ihost_by_hostname_invalid_name(self): @@ -3249,7 +3231,7 @@ class ManagerTestCase(base.DbTestCase): config_status=None, config_applied=config_uuid, config_target=config_uuid, invprovision=constants.PROVISIONED, administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='00:11:22:33:44:55', mgmt_ip='1.2.3.4') + mgmt_mac='00:11:22:33:44:55') self._create_test_networks(mgmt_vlan_id) mock_find_local_mgmt_interface_vlan_id = mock.MagicMock() @@ -5257,8 +5239,7 @@ class ManagerTestCase(base.DbTestCase): administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='00:11:22:33:44:55', - mgmt_ip='1.2.3.4') + mgmt_mac='00:11:22:33:44:55') ihost = self.service.get_ihost_by_hostname(self.context, ihost_hostname) @@ -5308,8 +5289,7 @@ class ManagerTestCase(base.DbTestCase): administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='00:11:22:33:44:55', - mgmt_ip='1.2.3.4') + mgmt_mac='00:11:22:33:44:55') # Create controller-1 ihost_hostname1 = 'controller-1' @@ -5326,8 +5306,7 @@ class ManagerTestCase(base.DbTestCase): administrative=constants.ADMIN_UNLOCKED, operational=constants.OPERATIONAL_ENABLED, availability=constants.AVAILABILITY_ONLINE, - mgmt_mac='22:44:33:55:11:66', - mgmt_ip='1.2.3.5') + mgmt_mac='22:44:33:55:11:66') # before - no alarm self.assertFalse(self._is_kernel_alarm_raised(alarm_id, diff --git a/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py b/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py index 3eb02050f9..7d6e908a7c 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/db/utils.py @@ -129,8 +129,6 @@ def get_test_ihost(**kw): 'invprovision': kw.get('invprovision', 'unprovisioned'), 'mgmt_mac': kw.get('mgmt_mac', '01:34:67:9A:CD:FE'), - 'mgmt_ip': kw.get('mgmt_ip', - '192.168.24.11'), 'personality': kw.get('personality', 'controller'), 'administrative': kw.get('administrative', 'locked'), 'operational': kw.get('operational', 'disabled'),