Skip to content

Commit 6ebf72d

Browse files
fix(linstor): move next call in try block and use vdi object
Signed-off-by: Mathieu Labourier <[email protected]>
1 parent d1fafa5 commit 6ebf72d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/storage/linstor/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,6 @@ def host_and_corrupted_vdi_on_linstor_sr(host: Host, linstor_sr: SR, vm_ref: str
181181
vm: VM = host.import_vm(vm_ref, sr_uuid=linstor_sr.uuid)
182182
pool: Pool = host.pool
183183
master: Host = pool.master
184-
vdi_uuid: str = next((
185-
uuid for uuid in vm.vdi_uuids()
186-
if pool.get_vdi_sr_uuid(uuid) == linstor_sr.uuid
187-
))
188184

189185
def get_vdi_volume_name_from_linstor() -> str:
190186
result = master.ssh([
@@ -212,6 +208,10 @@ def get_vdi_host(path: str) -> Host:
212208
raise FileNotFoundError(f"Could not find matching host for `{vdi_uuid}`")
213209

214210
try:
211+
vdi_uuid: str = next((
212+
vdi.uuid for vdi in vm.vdis if vdi.sr.uuid == linstor_sr.uuid
213+
))
214+
215215
volume_name = get_vdi_volume_name_from_linstor()
216216
lv_path = f"/dev/{GROUP_NAME}/{volume_name}_00000"
217217
vdi_host = get_vdi_host(lv_path)

0 commit comments

Comments
 (0)