From c0597640854202911bc60493c9ee15135bb765e4 Mon Sep 17 00:00:00 2001 From: James Parker Date: Mon, 24 Jul 2023 14:35:39 -0400 Subject: [PATCH] Enable LM back and forth flag for SRIOV With the inclusion of the Mixed RHEL deployments Live Migration is only supported from older to new hypervisors. Current SR-IOV live migration tests migrate back and forth by default. Add the compute_feature_enabled.live_migrate_back_and_forth to the SR-IOV live migration tests so that when testing Mixed RHEL deployments tests stop after initial live migration. By default the flag is false so adding the configuration as True to devstack if SR-IOV tests are ever enabled upstream. Change-Id: I0b188a484dcefd846613d05fe4c49e710778a952 --- devstack/plugin.sh | 1 + devstack/settings | 1 + .../api/compute/test_sriov.py | 62 ++++++++++--------- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index ebaf8cb8..96dbee86 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -40,6 +40,7 @@ function configure { iniset $TEMPEST_CONFIG compute-feature-enabled rbd_download "$COMPUTE_FEATURE_RBD_DOWNLOAD" iniset $TEMPEST_CONFIG compute-feature-enabled uefi_secure_boot "$COMPUTE_FEATURE_UEFI_SECURE_BOOT" iniset $TEMPEST_CONFIG compute-feature-enabled vtpm_device_supported "$COMPUTE_FEATURE_VTPM_ENABLED" + iniset $TEMPEST_CONFIG compute-feature-enabled live_migrate_back_and_forth "$COMPUTE_FEATURE_LIVE_MIGRATE_BACK_AND_FORTH" } if [[ "$1" == "stack" ]]; then diff --git a/devstack/settings b/devstack/settings index cf250f1e..e5a13ca1 100644 --- a/devstack/settings +++ b/devstack/settings @@ -24,3 +24,4 @@ COMPUTE_FEATURE_VIRTIO_RNG=${COMPUTE_FEATURE_VIRTIO_RNG:-'True'} COMPUTE_FEATURE_RBD_DOWNLOAD=${COMPUTE_FEATURE_RBD_DOWNLOAD:-'False'} COMPUTE_FEATURE_UEFI_SECURE_BOOT=${COMPUTE_FEATURE_UEFI_SECURE_BOOT:-'True'} COMPUTE_FEATURE_VTPM_ENABLED=${COMPUTE_FEATURE_VTPM_ENABLED:-'True'} +COMPUTE_FEATURE_LIVE_MIGRATE_BACK_AND_FORTH=${COMPUTE_FEATURE_LIVE_MIGRATE_BACK_AND_FORTH:-'True'} diff --git a/whitebox_tempest_plugin/api/compute/test_sriov.py b/whitebox_tempest_plugin/api/compute/test_sriov.py index e649066b..90655c5c 100644 --- a/whitebox_tempest_plugin/api/compute/test_sriov.py +++ b/whitebox_tempest_plugin/api/compute/test_sriov.py @@ -748,34 +748,38 @@ class SRIOVMigration(SRIOVBase): 'after first migration should be 1 but instead ' 'is %s' % pci_allocated_count) - # Migrate server back to the original host - self.live_migrate(self.os_admin, server['id'], 'ACTIVE', - target_host=host) + if CONF.compute_feature_enabled.live_migrate_back_and_forth: + # Migrate server back to the original host + self.live_migrate(self.os_admin, server['id'], 'ACTIVE', + target_host=host) - # Again find the instance's network device element based on the mac - # address and binding:vnic_type from the port info provided by ports - # client - interface_xml_element = self._get_xml_interface_device( - server['id'], - port['port']['id'], - ) + # Again find the instance's network device element based on the + # mac address and binding:vnic_type from the port info provided by + # ports client + interface_xml_element = self._get_xml_interface_device( + server['id'], + port['port']['id'], + ) - # Confirm vlan tag in interface XML, dev_type, allocation status, and - # pci address information are correct in pci_devices table of openstack - # DB after second migration - self._validate_port_xml_vlan_tag(interface_xml_element, self.vlan_id) - self._verify_neutron_port_binding( - server['id'], - port['port']['id'] - ) + # Confirm vlan tag in interface XML, dev_type, allocation status, + # and pci address information are correct in pci_devices table of + # openstack DB after second migration + self._validate_port_xml_vlan_tag( + interface_xml_element, + self.vlan_id + ) + self._verify_neutron_port_binding( + server['id'], + port['port']['id'] + ) - # Confirm total port allocations still remains one after final - # migration - pci_allocated_count = self._get_pci_status_count( - pci_device_status_regex) - self.assertEqual(pci_allocated_count, 1, 'Total allocated pci devices ' - 'after second migration should be 1 but instead ' - 'is %s' % pci_allocated_count) + # Confirm total port allocations still remains one after final + # migration + pci_allocated_count = self._get_pci_status_count( + pci_device_status_regex) + self.assertEqual(pci_allocated_count, 1, 'Total allocated pci ' + 'devices after second migration should be 1 but ' + 'instead is %s' % pci_allocated_count) def test_sriov_direct_live_migration(self): """Verify sriov live migration using direct type ports @@ -798,7 +802,7 @@ class SRIOVAttachAndDetach(SRIOVBase): self.network = self._create_net_from_physical_network( self.vlan_id, self.physical_net) - self._create_subnet(self.sriov_network['network']['id']) + self._create_subnet(self.network['network']['id']) @classmethod def skip_checks(cls): @@ -900,7 +904,7 @@ class SRIOVAttachAndDetach(SRIOVBase): attached port :param after_attached: dict, original port data when first created """ - net_id = self.sriov_network.get('network').get('id') + net_id = self.network.get('network').get('id') port_id = pre_attached_port['port']['id'] port_ip_addr = pre_attached_port['port']['fixed_ips'][0]['ip_address'] port_mac_addr = pre_attached_port['port']['mac_address'] @@ -941,7 +945,7 @@ class SRIOVAttachAndDetach(SRIOVBase): servers = [self.create_server_and_ssh(), self.create_server_and_ssh()] port = self._create_port_from_vnic_type( - net=self.sriov_network, + net=self.network, vnic_type=vnic_type ) @@ -1024,7 +1028,7 @@ class SRIOVAttachAndDetach(SRIOVBase): servers = [self.create_server_and_ssh(), self.create_server_and_ssh()] port = self._create_port_from_vnic_type( - net=self.sriov_network, + net=self.network, vnic_type='direct-physical' )