зеркало из https://github.com/microsoft/lisa.git
SRIOV: allow old sriov switch behavior that doesn't kill connection (#2294)
This commit is contained in:
Родитель
11e56c922c
Коммит
27cd0345db
|
@ -21,7 +21,9 @@ class NetworkInterface(Feature):
|
|||
def enabled(self) -> bool:
|
||||
return True
|
||||
|
||||
def switch_sriov(self, enable: bool, wait: bool = True) -> None:
|
||||
def switch_sriov(
|
||||
self, enable: bool, wait: bool = True, reset_connections: bool = True
|
||||
) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
def is_enabled_sriov(self) -> bool:
|
||||
|
|
|
@ -167,7 +167,9 @@ class NetworkInterface(AwsFeatureMixin, features.NetworkInterface):
|
|||
raise LisaException(f"fail to find primary nic for vm {self._node.name}")
|
||||
return nic
|
||||
|
||||
def switch_sriov(self, enable: bool, wait: bool = True) -> None:
|
||||
def switch_sriov(
|
||||
self, enable: bool, wait: bool = True, reset_connections: bool = True
|
||||
) -> None:
|
||||
aws_platform: AwsPlatform = self._platform # type: ignore
|
||||
instance = boto3.resource("ec2").Instance(self._instance_id)
|
||||
|
||||
|
|
|
@ -601,7 +601,9 @@ class NetworkInterface(AzureFeatureMixin, features.NetworkInterface):
|
|||
len(all_nics) - self.origin_extra_synthetic_nics_count - 1
|
||||
)
|
||||
|
||||
def switch_sriov(self, enable: bool, wait: bool = True) -> None:
|
||||
def switch_sriov(
|
||||
self, enable: bool, wait: bool = True, reset_connections: bool = True
|
||||
) -> None:
|
||||
azure_platform: AzurePlatform = self._platform # type: ignore
|
||||
network_client = get_network_client(azure_platform)
|
||||
vm = get_vm(azure_platform, self._node)
|
||||
|
@ -639,7 +641,7 @@ class NetworkInterface(AzureFeatureMixin, features.NetworkInterface):
|
|||
|
||||
# wait settings effective
|
||||
if wait:
|
||||
self._check_sriov_enabled(enable)
|
||||
self._check_sriov_enabled(enable, reset_connections)
|
||||
|
||||
def is_enabled_sriov(self) -> bool:
|
||||
azure_platform: AzurePlatform = self._platform # type: ignore
|
||||
|
@ -774,8 +776,11 @@ class NetworkInterface(AzureFeatureMixin, features.NetworkInterface):
|
|||
modprobe_tool.reload(["hv_netvsc"])
|
||||
|
||||
@retry(tries=60, delay=10)
|
||||
def _check_sriov_enabled(self, enabled: bool) -> None:
|
||||
self._node.close()
|
||||
def _check_sriov_enabled(
|
||||
self, enabled: bool, reset_connections: bool = True
|
||||
) -> None:
|
||||
if reset_connections:
|
||||
self._node.close()
|
||||
self._node.nics.reload()
|
||||
default_nic = self._node.nics.get_nic_by_index(0)
|
||||
|
||||
|
|
|
@ -665,4 +665,5 @@ class Dpdk(TestSuite):
|
|||
if modprobe.module_exists("uio_hv_generic"):
|
||||
node.tools[Service].stop_service("vpp")
|
||||
modprobe.remove(["uio_hv_generic"])
|
||||
node.close()
|
||||
modprobe.reload(["hv_netvsc"])
|
||||
|
|
|
@ -333,14 +333,18 @@ def run_testpmd_concurrent(
|
|||
|
||||
# disable sriov (and wait for change to apply)
|
||||
for node_resources in [x for x in test_kits if x.switch_sriov]:
|
||||
node_resources.nic_controller.switch_sriov(enable=False, wait=True)
|
||||
node_resources.nic_controller.switch_sriov(
|
||||
enable=False, wait=True, reset_connections=False
|
||||
)
|
||||
|
||||
# let run for a bit with SRIOV disabled
|
||||
time.sleep(10)
|
||||
|
||||
# re-enable sriov
|
||||
for node_resources in [x for x in test_kits if x.switch_sriov]:
|
||||
node_resources.nic_controller.switch_sriov(enable=True, wait=True)
|
||||
node_resources.nic_controller.switch_sriov(
|
||||
enable=True, wait=True, reset_connections=False
|
||||
)
|
||||
|
||||
# run for a bit with SRIOV re-enabled
|
||||
time.sleep(10)
|
||||
|
|
Загрузка…
Ссылка в новой задаче