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 Jan 30, 2024
1 parent b29f2e1 commit 301a2ea
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,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 +356,11 @@ def start_middletotop_blkpull_on_vm():
setup_nbd_env(params)
try:
vm.start()
vm.wait_for_login().close()
disk_name = device_target
if additional_disk:
session = vm.wait_for_login()
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 +369,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 301a2ea

Please sign in to comment.