Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from lisa.operating_system import Windows
from lisa.sut_orchestrator import CLOUD_HYPERVISOR
from lisa.testsuite import TestResult
from lisa.tools import Dhclient, Kill, Sysctl
from lisa.tools import Dhclient, Kill, PowerShell, Sysctl
from lisa.tools.iperf3 import (
IPERF_TCP_BUFFER_LENGTHS,
IPERF_TCP_CONCURRENCY,
Expand Down Expand Up @@ -615,9 +615,9 @@ def _configure_passthrough_nic_for_node(
node, mgmt_iface, iface_info_raw
)

node.log.info(f"[passthrough-nic] GUEST iface={interface_name!r}")
node.log.debug(f"[passthrough-nic] GUEST iface={interface_name!r}")
if host_node is not None and host_nic_name:
host_node.log.info(
host_node.log.debug(
f"[passthrough-nic] HOST nic={host_nic_name!r} BDF={device_bdf!r}"
)

Expand Down Expand Up @@ -1016,6 +1016,17 @@ def _get_host_as_server(self, variables: Dict[str, Any]) -> RemoteNode:
private_key_file=private_key,
)
server.internal_address = ip

server.initialize()

if isinstance(server.os, Windows):
Comment thread
LiliDeng marked this conversation as resolved.
server.close()
server.cleanup()
raise SkippedException(
"Host/guest passthrough performance tests require a Linux "
"baremetal host; Windows baremetal hosts are not supported."
)
Comment thread
vyadavmsft marked this conversation as resolved.

# Track baremetal host for cleanup.
if server not in self._baremetal_hosts:
self._baremetal_hosts.append(server)
Expand Down Expand Up @@ -1058,11 +1069,49 @@ def after_case(self, log: Logger, **kwargs: Any) -> None:
all_nodes.extend(self._baremetal_hosts)

def do_process_cleanup(process: str, node: Node) -> None:
kill = node.tools[Kill]
kill.by_name(process, ignore_not_exist=True)
try:
if isinstance(node.os, Windows):
escaped_process = process.replace("'", "''")
node.tools[PowerShell].run_cmdlet(
cmdlet=(
f"$p = Get-Process -Name '{escaped_process}' "
"-ErrorAction SilentlyContinue; "
"if ($p) { $p | Stop-Process -Force "
"-ErrorAction SilentlyContinue }"
),
fail_on_error=False,
)
return

kill = node.tools[Kill]
kill.by_name(process, ignore_not_exist=True)
except LisaException as identifier_error:
log.debug(
f"Skipping Kill tool-based cleanup for '{process}' on "
f"node '{node.name}': {identifier_error}"
)
if isinstance(node.os, Windows):
return

node.execute(
cmd=(
f"pids=$(pidof {process} 2>/dev/null || true); "
'[ -z "$pids" ] || kill -9 $pids || true'
),
shell=True,
sudo=True,
)

def do_sysctl_cleanup(node: Node) -> None:
node.tools[Sysctl].reset()
if isinstance(node.os, Windows):
return

try:
node.tools[Sysctl].reset()
except LisaException as sysctl_error:
log.debug(
f"Skipping sysctl cleanup on node '{node.name}': {sysctl_error}"
)

cleanup_tasks: List[Callable[[], None]] = []
for process in ["lagscope", "netperf", "netserver", "ntttcp", "iperf3"]:
Expand Down
Loading