Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions lisa/microsoft/testsuites/core/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,11 @@ def _hot_add_disk_serial(
# verify that partition count is increased by 1
# and the size of partition is correct
partitons_after_adding_disk = lsblk.get_disks(force_run=True)
before_names = {d.name for d in partitions_before_adding_disk}
added_partitions = [
item
for item in partitons_after_adding_disk
if item not in partitions_before_adding_disk
if item.name not in before_names
Comment on lines 819 to +824
Comment on lines 819 to +824
]
log.debug(f"added_partitions: {added_partitions}")
assert_that(added_partitions, "Data disk should be added").is_length(
Expand Down Expand Up @@ -853,10 +854,11 @@ def _hot_add_disk_serial(

# verify that all the attached disks are removed
partitions_after_removing_disks = lsblk.get_disks(force_run=True)
after_names = {d.name for d in partitions_after_removing_disks}
partitions_available = [
item
for item in partitions_before_adding_disk
if item not in partitions_after_removing_disks
if item.name not in after_names
]
assert_that(partitions_available, "data disks should not be present").is_length(
0
Expand Down Expand Up @@ -903,10 +905,11 @@ def _hot_add_disk_parallel(
timer = create_timer()
while timeout > timer.elapsed(False):
partitons_after_adding_disks = lsblk.get_disks(force_run=True)
before_names = {d.name for d in partitions_before_adding_disks}
added_partitions = [
item
for item in partitons_after_adding_disks
if item not in partitions_before_adding_disks
if item.name not in before_names
]
Comment on lines 907 to 913
Comment on lines 906 to 913
if len(added_partitions) == disks_to_add:
break
Expand All @@ -928,10 +931,11 @@ def _hot_add_disk_parallel(

# verify that partition count is decreased by disks_to_add
partition_after_removing_disk = lsblk.get_disks(force_run=True)
after_names = {d.name for d in partition_after_removing_disk}
added_partitions = [
item
for item in partitions_before_adding_disks
if item not in partition_after_removing_disk
if item.name not in after_names
]
assert_that(added_partitions, "data disks should not be present").is_length(0)

Expand Down
Loading