Skip to content

Commit af6499e

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 f244985 commit af6499e

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
@@ -140,15 +140,15 @@ def test_invalid_vdi_size(self, nfs_sr: SR, image_format: ImageFormat):
140140
@pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True)
141141
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
142142
def test_xva_export_import(self, dispatch_nfs: VM, compression: XVACompression, temp_large_dir: str, defer: Defer):
143-
if "NFS4" in dispatch_nfs.vdis[0].sr.get_name_label() and config.volume_size > 20 * GiB:
143+
if "NFS4" in dispatch_nfs.vdis[0].sr.get_name_label() and config.write_volume_cap > 20 * GiB:
144144
pytest.skip("Skipping NFSv4 large VDI test (known performance issue)")
145145
xva_export_import(dispatch_nfs, compression, temp_large_dir, defer)
146146

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

0 commit comments

Comments
 (0)