Skip to content

Commit ce2c156

Browse files
authored
Merge pull request #638 from xcp-ng/aso/feat-storage-linstor-684
Add test for VDI resize support on LINSTOR SR
2 parents 96f5ce5 + 6d41d68 commit ce2c156

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

tests/storage/ext/test_ext_sr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_blktap_activate_failure(self, vm_on_ext_sr: VM) -> None:
106106

107107
@pytest.mark.small_vm
108108
@pytest.mark.big_vm
109-
def test_resize(self, vm_on_ext_sr: VM) -> None:
109+
def test_resize_vdi(self, vm_on_ext_sr: VM) -> None:
110110
vm = vm_on_ext_sr
111111
vdi = VDI(vm.vdi_uuids()[0], host=vm.host)
112112
old_size = vdi.get_virtual_size()
@@ -118,7 +118,7 @@ def test_resize(self, vm_on_ext_sr: VM) -> None:
118118

119119
@pytest.mark.small_vm
120120
@pytest.mark.big_vm
121-
def test_failing_resize(self, host: Host, ext_sr: SR, vm_on_ext_sr: VM, exit_on_fistpoint: None) -> None:
121+
def test_failing_resize_vdi(self, host: Host, ext_sr: SR, vm_on_ext_sr: VM, exit_on_fistpoint: None) -> None:
122122
vm = vm_on_ext_sr
123123
vdi = VDI(vm.vdi_uuids()[0], host=vm.host)
124124
old_size = vdi.get_virtual_size()

tests/storage/linstor/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ def pool_with_linstor(
118118
import concurrent.futures
119119
pool = pool_with_saved_yum_state
120120

121-
def check_linstor_installed(host: Host) -> None:
121+
def ensure_linstor_not_installed(host: Host) -> None:
122122
if host.is_package_installed(LINSTOR_PACKAGE):
123123
raise Exception(
124124
f'{LINSTOR_PACKAGE} is already installed on host {host}. This should not be the case.'
125125
)
126126

127127
with concurrent.futures.ThreadPoolExecutor() as executor:
128-
executor.map(check_linstor_installed, pool.hosts)
128+
executor.map(ensure_linstor_not_installed, pool.hosts)
129129

130130
def install_linstor(host: Host) -> None:
131131
logging.info(f"Installing {LINSTOR_PACKAGE} on host {host}...")

tests/storage/linstor/test_linstor_sr.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,23 @@ def test_resynchronization(
189189
finally:
190190
vm.shutdown(verify=True)
191191

192+
@pytest.mark.small_vm
193+
@pytest.mark.big_vm
194+
def test_resize_vdi(self, vm_on_linstor_sr: VM) -> None:
195+
vm = vm_on_linstor_sr
196+
if vm.is_running():
197+
vm.shutdown(verify=True)
198+
199+
for vdi in vm.vdis:
200+
size = vdi.get_virtual_size()
201+
vdi.resize(size * 2)
202+
assert vdi.get_virtual_size() == size * 2
203+
204+
# Make sure the VM still starts up successfully after resizing
205+
vm.start()
206+
vm.wait_for_os_booted()
207+
vm.shutdown(verify=True)
208+
192209
# *** tests with reboots (longer tests).
193210

194211
@pytest.mark.reboot

tests/storage/lvm/test_lvm_sr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_snapshot(self, vm_on_lvm_sr: VM) -> None:
6565

6666
@pytest.mark.small_vm
6767
@pytest.mark.big_vm
68-
def test_failing_resize_on_inflate_after_setSize(
68+
def test_failing_resize_vdi_on_inflate_after_setSize(
6969
self, host: Host, lvm_sr: SR, vm_on_lvm_sr: VM, exit_on_fistpoint: None
7070
) -> None:
7171
vm = vm_on_lvm_sr
@@ -93,7 +93,7 @@ def test_failing_resize_on_inflate_after_setSize(
9393

9494
@pytest.mark.small_vm
9595
@pytest.mark.big_vm
96-
def test_failing_resize_on_inflate_after_setSizePhys(
96+
def test_failing_resize_vdi_on_inflate_after_setSizePhys(
9797
self, host: Host, lvm_sr: SR, vm_on_lvm_sr: VM, exit_on_fistpoint: None
9898
) -> None:
9999
vm = vm_on_lvm_sr

0 commit comments

Comments
 (0)