Skip to content

Commit fc1e701

Browse files
committed
storage: limit data written per VDI with --write-volume-cap
Refactor stream management to support arbitrary span distributions. The new StreamSpan dataclass encapsulates stream metadata and operations, while partially_populate_device() now supports configurable span counts and skip patterns. This required to upgrade randstream to the version 0.6.0 which supports arbitrary position. The default cap is 2GiB. Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent d273947 commit fc1e701

5 files changed

Lines changed: 171 additions & 66 deletions

File tree

conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,18 @@ def pytest_addoption(parser):
107107
default="1GiB",
108108
help="Default volume size for tests"
109109
)
110+
parser.addoption(
111+
"--write-volume-cap",
112+
action="store",
113+
default="2GiB",
114+
help="Maximum amount of data written to a volume"
115+
)
110116

111117
def pytest_configure(config):
112118
global_config.ignore_ssh_banner = config.getoption('--ignore-ssh-banner')
113119
global_config.ssh_output_max_lines = int(config.getoption('--ssh-output-max-lines'))
114120
global_config.volume_size = parse_size(config.getoption('--volume-size'))
121+
global_config.write_volume_cap = parse_size(config.getoption('--write-volume-cap'))
115122

116123
def pytest_generate_tests(metafunc):
117124
if "vm_ref" in metafunc.fixturenames:

lib/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
ignore_ssh_banner = False
44
ssh_output_max_lines = 20
55
volume_size = 1 * GiB
6+
write_volume_cap = 2 * GiB
67

78
def sr_device_config(datakey, *, required=[]):
89
import data # import here to avoid depending on this user file for collecting tests

tests/storage/nfs/test_nfs_sr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ def test_invalid_vdi_size(self, nfs_sr: SR, image_format: ImageFormat):
142142
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
143143
def test_xva_export_import(self, host: Host, dispatch_nfs: SR, vm_ref: str, compression: XVACompression,
144144
temp_large_dir: str, defer: Defer):
145-
if "NFS4" in dispatch_nfs.get_name_label() and config.volume_size > 20 * GiB:
145+
if "NFS4" in dispatch_nfs.get_name_label() and config.write_volume_cap > 20 * GiB:
146146
pytest.skip("Skipping NFSv4 large VDI test (known performance issue)")
147147
xva_export_import(host, dispatch_nfs, vm_ref, compression, temp_large_dir, defer)
148148

149149
@pytest.mark.small_vm
150150
@pytest.mark.parametrize('dispatch_nfs', ['nfs_sr', 'nfs4_sr'], indirect=True)
151151
def test_vdi_export_import(self, storage_test_vm: VM, dispatch_nfs: SR, image_format: ImageFormat,
152152
temp_large_dir: str, defer: Defer):
153-
if "NFS4" in dispatch_nfs.get_name_label() and config.volume_size > 20 * GiB:
153+
if "NFS4" in dispatch_nfs.get_name_label() and config.write_volume_cap > 20 * GiB:
154154
pytest.skip("Skipping NFSv4 large VDI test (known performance issue)")
155155
vdi_export_import(storage_test_vm, dispatch_nfs, image_format, temp_large_dir, defer)
156156

0 commit comments

Comments
 (0)