From ce0959e71c76d2e8e3d96a293f855f85efad4e14 Mon Sep 17 00:00:00 2001 From: Andre Kantek Date: Thu, 7 Dec 2023 16:12:32 -0300 Subject: [PATCH] Revert "Semantic check for proper sriov plugin configuration" This reverts commit 16e800bcf9a9fc2bd97cc05ba0213091352c6130. Reason for revert: This validation is preventing a 2 step approach to the configuration, first configuring labels and later adding the interface configuration. With the change: https://review.opendev.org/c/starlingx/stx-puppet/+/869852 there is no reason to keep this validation as the pod sriov device plugin will no longer generate log spam since a dummy config file will be created, avoiding the state of CrashBackLoop. Closes-Bug: 2002447 Change-Id: Ice4def2a23c5fe5fc0311bafff1a8ea5051e1609 Signed-off-by: Andre Kantek --- .../sysinv/sysinv/api/controllers/v1/host.py | 22 ------ .../sysinv/sysinv/tests/api/test_host.py | 70 ------------------- 2 files changed, 92 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py index 1b19935b6f..66c171d896 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/host.py @@ -6663,28 +6663,6 @@ class HostController(rest.RestController): % hostupdate.displayid) raise wsme.exc.ClientSideError(msg) - # Check if the label sriovdp is enabled and there are no - # pci-sriov interfaces - label = None - try: - label = pecan.request.dbapi.label_query( - ihost['id'], - constants.SRIOVDP_LABEL.split('=')[0]) - except exception.HostLabelNotFoundByKey: - pass - - if (label and label.label_value == - constants.SRIOVDP_LABEL.split('=')[1]): - for iface in ihost_iinterfaces: - if iface.ifclass == constants.NETWORK_TYPE_PCI_SRIOV: - break - else: - msg = _("Cannot unlock host %s if the label '%s' is " - "present and no '%s' interfaces are configured." - % (hostupdate.displayid, constants.SRIOVDP_LABEL, - constants.NETWORK_TYPE_PCI_SRIOV)) - raise wsme.exc.ClientSideError(msg) - hostupdate.configure_required = True host_uuid = ihost['uuid'] diff --git a/sysinv/sysinv/sysinv/sysinv/tests/api/test_host.py b/sysinv/sysinv/sysinv/sysinv/tests/api/test_host.py index 437bc8c7ee..efd2fc131e 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/api/test_host.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/api/test_host.py @@ -2808,76 +2808,6 @@ class TestPatch(TestHost): # is required to populate the storage (OSDs) for the host. self.skipTest("Not yet implemented") - def _create_sriovdp_test_structure(self, add_label, add_iface): - host = self._create_controller_0( - invprovision=constants.PROVISIONED, - administrative=constants.ADMIN_LOCKED, - operational=constants.OPERATIONAL_ENABLED, - availability=constants.AVAILABILITY_ONLINE) - - self._create_test_host_platform_interface(host) - - if add_label: - sriovdp_key = constants.SRIOVDP_LABEL.split('=')[0] - sriovdp_val = constants.SRIOVDP_LABEL.split('=')[1] - dbutils.create_test_label( - host_id=host.id, - label_key=sriovdp_key, - label_value=sriovdp_val) - - if add_iface: - interface = { - 'forihostid': host['id'], - 'ifname': 'sriov0', - 'iftype': constants.INTERFACE_TYPE_VF, - 'ifclass': constants.INTERFACE_CLASS_PCI_SRIOV - } - dbutils.create_test_interface(**interface) - - return host - - def test_unlock_with_sriovdp_label_without_sriov_ifaces(self): - host = self._create_sriovdp_test_structure(add_label=True, - add_iface=False) - - response = self._patch_host_action( - host['hostname'], constants.UNLOCK_ACTION, 'sysinv-test', - expect_errors=True) - self.assertEqual(response.status_code, http_client.BAD_REQUEST) - self.assertTrue(response.json['error_message']) - self.assertIn("Cannot unlock host %s if the label '%s' is present " - "and no '%s' interfaces are configured." % - (host['hostname'], constants.SRIOVDP_LABEL, - constants.INTERFACE_CLASS_PCI_SRIOV), - response.json['error_message']) - - def test_unlock_with_sriovdp_label_with_sriov_iface(self): - host = self._create_sriovdp_test_structure(add_label=True, - add_iface=True) - - response = self._patch_host_action( - host['hostname'], constants.UNLOCK_ACTION, 'sysinv-test') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.status_code, http_client.OK) - - def test_unlock_without_sriovdp_label_without_sriov_ifaces(self): - host = self._create_sriovdp_test_structure(add_label=False, - add_iface=False) - - response = self._patch_host_action( - host['hostname'], constants.UNLOCK_ACTION, 'sysinv-test') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.status_code, http_client.OK) - - def test_unlock_without_sriovdp_label_with_sriov_iface(self): - host = self._create_sriovdp_test_structure(add_label=False, - add_iface=True) - - response = self._patch_host_action( - host['hostname'], constants.UNLOCK_ACTION, 'sysinv-test') - self.assertEqual(response.content_type, 'application/json') - self.assertEqual(response.status_code, http_client.OK) - def test_worker_unlock_during_kernel_configuration(self): # Create controller-0 self._create_controller_0(