Skip to content

Commit 431de49

Browse files
authored
Merge branch 'main' into testGuestLoadMetrics
2 parents a6fa08a + e8752af commit 431de49

87 files changed

Lines changed: 1694 additions & 1047 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ fcn_exclude_functions =
7474
skip,
7575
QueueListener,
7676
requests,
77+
multiprocessing,
7778

7879
nit_exclude_imports =
7980
os_params,

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ sig-scale:
3333
sig-storage:
3434
- changed-files:
3535
- any-glob-to-any-file:
36-
- 'tests/{data_protection,storage}/**'
36+
- 'tests/{data_protection,storage,cross_cluster_live_migration}/**'
3737
- 'utilities/storage.py'
3838

3939
sig-virt:

.github/workflows/request-coderabbit-test-instructions.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
<details>
3838
<summary>Test execution plan request details</summary>
3939
40+
CRITICAL: You MUST respond with a review comment on the Files Changed tab, NOT as a regular PR comment.
41+
If it cannot be on the 1st line of the 1st file, add it to any other changed file.
42+
4043
As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
4144
You will create a change request comment on the 1st line of the 1st file in the pr with the test execution plan.
4245
If you fail to run or post a comment, retry.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
stages: [pre-commit]
1414

1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.14.2
16+
rev: v0.14.3
1717
hooks:
1818
- id: ruff
1919
stages: [pre-commit]

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ARG TIMEOUT_SAMPLER_COMMIT=''
3131

3232
ENV LANG=C.UTF-8
3333
ENV CNV_TESTS_CONTAINER=Yes
34-
ENV UV_PYTHON=python3.12
34+
ENV UV_PYTHON=python3.14
3535
ENV UV_NO_SYNC=1
3636

3737
WORKDIR ${TEST_DIR}

containers/fedora/user-data

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ write_files:
2222
WantedBy=cloud-init.service
2323
runcmd:
2424
- systemctl daemon-reload
25-
- dnf install -y tcpdump qemu-guest-agent iperf3 dmidecode nginx lldpad kernel-modules nmap dhcp-server dhcp-relay sshpass podman ethtool libibverbs dpdk stress-ng iotop fio
25+
- |
26+
PACKAGES="tcpdump qemu-guest-agent iperf3 nginx lldpad kernel-modules nmap dhcp-server dhcp-relay sshpass podman ethtool libibverbs stress-ng iotop fio"
27+
ARCH=$(uname -m)
28+
if [ "${ARCH}" != "s390x" ]; then
29+
PACKAGES="$PACKAGES dmidecode dpdk"
30+
fi
31+
dnf install -y ${PACKAGES}
2632
- dnf autoremove
2733
- dnf clean all
2834
- rpm -q kernel-core | sort | head -1 | xargs rpm -e

docs/GETTING_STARTED.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Please refer to [ARCHITECTURE_SUPPORT.md](ARCHITECTURE_SUPPORT.md) for more deta
4343

4444

4545
## Python and dependencies
46-
python >=3.12
46+
python >=3.14
4747

4848
The Complete list of environment dependencies can be found in [Dockerfile](../Dockerfile)
4949

@@ -55,3 +55,13 @@ The Complete list of environment dependencies can be found in [Dockerfile](../Do
5555
## oc
5656

5757
`oc` client should be downloaded from `consoleCliDownloads` resource of the cluster under test.
58+
59+
## bws - Bitwarden CLI
60+
61+
Bitwarden CLI should be installed on the machine running the tests. See [Secrets Manager CLI](https://bitwarden.com/help/secrets-manager-cli/#download-and-install).
62+
Bitwarden token should be set in the `ACCESS_TOKEN` environment variable.
63+
Ensure the `unzip` package is installed on your system, as it is required by the bws installation script.
64+
65+
```bash
66+
curl -fsSL https://bws.bitwarden.com/install | sh
67+
```

libs/infra/images.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Windows:
7272
ISO_WIN11_DIR: str = f"{ISO_BASE_DIR}/win11"
7373
ISO_WIN2022_DIR: str = f"{ISO_BASE_DIR}/win2022"
7474
ISO_WIN2025_DIR: str = f"{ISO_BASE_DIR}/win2025"
75+
CONTAINER_DISK_DV_SIZE = "40Gi"
7576
DEFAULT_DV_SIZE: str = "70Gi"
7677
DEFAULT_MEMORY_SIZE: str = "8Gi"
7778
DEFAULT_MEMORY_SIZE_WSL: str = "12Gi"

libs/net/OWNERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root-approvers: False
2+
approvers:
3+
- EdDev
4+
reviewers:
5+
- yossisegev
6+
- Anatw
7+
- EdDev
8+
- servolkov
9+
- azhivovk

libs/net/traffic_generator.py

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from ocp_resources.pod import Pod
66
from ocp_utilities.exceptions import CommandExecFailed
7-
from timeout_sampler import TimeoutExpiredError, TimeoutSampler, retry
7+
from timeout_sampler import retry
88

99
from libs.vm.vm import BaseVirtualMachine
1010

@@ -15,7 +15,7 @@
1515
LOGGER = logging.getLogger(__name__)
1616

1717

18-
class BaseClient(ABC):
18+
class BaseTcpClient(ABC):
1919
"""Base abstract class for network traffic generator client."""
2020

2121
def __init__(self, server_ip: str, server_port: int):
@@ -24,7 +24,7 @@ def __init__(self, server_ip: str, server_port: int):
2424
self._cmd = f"{_IPERF_BIN} --client {self._server_ip} --time 0 --port {self.server_port} --connect-timeout 300"
2525

2626
@abstractmethod
27-
def __enter__(self) -> "BaseClient":
27+
def __enter__(self) -> "BaseTcpClient":
2828
pass
2929

3030
@abstractmethod
@@ -36,7 +36,7 @@ def is_running(self) -> bool:
3636
pass
3737

3838

39-
class Server:
39+
class TcpServer:
4040
"""
4141
Represents a server running on a virtual machine for testing network performance.
4242
Implemented with iperf3
@@ -55,11 +55,13 @@ def __init__(
5555
self._port = port
5656
self._cmd = f"{_IPERF_BIN} --server --port {self._port} --one-off"
5757

58-
def __enter__(self) -> "Server":
58+
def __enter__(self) -> "TcpServer":
5959
self._vm.console(
6060
commands=[f"{self._cmd} &"],
6161
timeout=_DEFAULT_CMD_TIMEOUT_SEC,
6262
)
63+
self._ensure_is_running()
64+
6365
return self
6466

6567
def __exit__(self, exc_type: BaseException, exc_value: BaseException, traceback: object) -> None:
@@ -72,10 +74,13 @@ def vm(self) -> BaseVirtualMachine:
7274
def is_running(self) -> bool:
7375
return _is_process_running(vm=self._vm, cmd=self._cmd)
7476

77+
@retry(wait_timeout=30, sleep=2, exceptions_dict={})
78+
def _ensure_is_running(self) -> bool:
79+
return self.is_running()
80+
7581

76-
class Client(BaseClient):
77-
"""
78-
Represents a client that connects to a server to test network performance.
82+
class VMTcpClient(BaseTcpClient):
83+
"""Represents a TCP client that connects to a server to test network performance.
7984
Implemented with iperf3
8085
8186
Args:
@@ -93,11 +98,13 @@ def __init__(
9398
super().__init__(server_ip=server_ip, server_port=server_port)
9499
self._vm = vm
95100

96-
def __enter__(self) -> "Client":
101+
def __enter__(self) -> "VMTcpClient":
97102
self._vm.console(
98103
commands=[f"{self._cmd} &"],
99104
timeout=_DEFAULT_CMD_TIMEOUT_SEC,
100105
)
106+
self._ensure_is_running()
107+
101108
return self
102109

103110
def __exit__(self, exc_type: BaseException, exc_value: BaseException, traceback: object) -> None:
@@ -110,6 +117,10 @@ def vm(self) -> BaseVirtualMachine:
110117
def is_running(self) -> bool:
111118
return _is_process_running(vm=self._vm, cmd=self._cmd)
112119

120+
@retry(wait_timeout=30, sleep=2, exceptions_dict={})
121+
def _ensure_is_running(self) -> bool:
122+
return self.is_running()
123+
113124

114125
def _stop_process(vm: BaseVirtualMachine, cmd: str) -> None:
115126
try:
@@ -118,25 +129,18 @@ def _stop_process(vm: BaseVirtualMachine, cmd: str) -> None:
118129
LOGGER.warning(str(e))
119130

120131

121-
def _is_process_running( # type: ignore[return]
122-
vm: BaseVirtualMachine, cmd: str
123-
) -> bool:
132+
def _is_process_running(vm: BaseVirtualMachine, cmd: str) -> bool:
124133
try:
125-
for sample in TimeoutSampler(
126-
wait_timeout=60,
127-
sleep=5,
128-
func=vm.console,
134+
vm.console(
129135
commands=[f"pgrep -fx '{cmd}'"],
130136
timeout=_DEFAULT_CMD_TIMEOUT_SEC,
131-
):
132-
if sample:
133-
return True
134-
except TimeoutExpiredError as e:
135-
LOGGER.warning(f"Process is not running on VM {vm.name}. Error: {str(e.last_exp)}")
137+
)
138+
return True
139+
except CommandExecFailed:
136140
return False
137141

138142

139-
class PodClient(BaseClient):
143+
class PodTcpClient(BaseTcpClient):
140144
"""Represents a TCP client that connects to a server to test network performance.
141145
142146
Expects pod to have iperf3 container.
@@ -155,7 +159,7 @@ def __init__(self, pod: Pod, server_ip: str, server_port: int, bind_interface: s
155159
self._container = _IPERF_BIN
156160
self._cmd += f" --bind {bind_interface}" if bind_interface else ""
157161

158-
def __enter__(self) -> "PodClient":
162+
def __enter__(self) -> "PodTcpClient":
159163
# run the command in the background using nohup to ensure it keeps running after the exec session ends
160164
self._pod.execute(
161165
command=["sh", "-c", f"nohup {self._cmd} >/tmp/{_IPERF_BIN}.log 2>&1 &"], container=self._container
@@ -178,5 +182,5 @@ def _ensure_is_running(self) -> bool:
178182
return self.is_running()
179183

180184

181-
def is_tcp_connection(server: Server, client: Client | PodClient) -> bool:
185+
def is_tcp_connection(server: TcpServer, client: BaseTcpClient) -> bool:
182186
return server.is_running() and client.is_running()

0 commit comments

Comments
 (0)