Skip to content

Commit

Permalink
backingchain/snapshot_blockpull: fix disk disovery
Browse files Browse the repository at this point in the history
The test identified new disks by their target name.
However, a reboot can mess up the non-persistent disk namings /dev/vdX.

Use instead a function that identifies a new disk inside of a VM as the
one disk that has no root mount on itself, its partitions or volumes.

Signed-off-by: Sebastian Mitterle <[email protected]>
  • Loading branch information
smitterl committed Feb 21, 2024
1 parent b29f2e1 commit 061336c
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
from virttest import virt_vm
from virttest import virsh

from virttest import utils_disk


from virttest.utils_test import libvirt

from virttest.utils_libvirt import libvirt_disk
Expand Down Expand Up @@ -335,12 +332,9 @@ def start_middletotop_blkpull_on_vm():
# Initialize one NbdExport object
nbd = None

# Start VM and get all partitions in VM.
# Start VM
if vm.is_dead():
vm.start()
session = vm.wait_for_login()
old_parts = utils_disk.get_parts_list(session)
session.close()
vm.destroy(gracefully=False)

# Back up xml file.
Expand All @@ -359,7 +353,11 @@ def start_middletotop_blkpull_on_vm():
setup_nbd_env(params)
try:
vm.start()
vm.wait_for_login().close()
disk_name = device_target
session = vm.wait_for_login()
if additional_disk:
disk_name, _ = libvirt_disk.get_non_root_disk_name(session)
session.close()
except virt_vm.VMStartError as details:
# VM cannot be started
if status_error:
Expand All @@ -368,7 +366,7 @@ def start_middletotop_blkpull_on_vm():
test.fail("VM should start but failed: %s" % str(details))

if fill_in_vm:
libvirt_disk.fill_null_in_vm(vm, device_target)
libvirt_disk.fill_null_in_vm(vm, disk_name)

if backend_path in ['native_path']:
external_snapshot_disks = libvirt_disk.make_external_disk_snapshots(vm, device_target, "blockpull_snapshot", snapshot_take)
Expand Down

0 comments on commit 061336c

Please sign in to comment.