Skip to content

Commit

Permalink
Merge pull request #1008 from aschnell/master
Browse files Browse the repository at this point in the history
- add additional udevadm settle call
  • Loading branch information
aschnell authored Jan 23, 2025
2 parents f8bfd58 + 25dd050 commit 6f99410
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 37 deletions.
6 changes: 3 additions & 3 deletions integration-tests/bcache/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
print(staging)

sdc1 = Partition.find_by_name(staging, "/dev/sdc1")
sdc1.remove_descendants()
sdc1.remove_descendants(View_REMOVE)

sdc2 = Partition.find_by_name(staging, "/dev/sdc2")
sdc2.remove_descendants()
sdc2.remove_descendants(View_REMOVE)

sdd1 = Partition.find_by_name(staging, "/dev/sdd1")
sdd1.remove_descendants()
sdd1.remove_descendants(View_REMOVE)

print(staging)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
print(staging)

sdc1 = Partition.find_by_name(staging, "/dev/sdc1")
sdc1.remove_descendants()
sdc1.remove_descendants(View_REMOVE)

print(staging)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/filesystems/delete-nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

nfs = Nfs.find_by_server_and_path(staging, "dist", "/dist")

nfs.remove_descendants()
nfs.remove_descendants(View_REMOVE)
staging.remove_device(nfs)

print(staging)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/filesystems/delete-tmpfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
mount_point = tmpfs.get_mount_point()

if mount_point.get_path() == "/test":
tmpfs.remove_descendants()
tmpfs.remove_descendants(View_REMOVE)
staging.remove_device(tmpfs)

print(staging)
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/lvm/create-complete.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

# requirements: disk /dev/sdb with empty partitions sdb1 and sdb2
# requirements: disk /dev/sdc with empty partitions sdc1 and sdd1


from sys import exit
Expand All @@ -17,12 +17,12 @@

staging = storage.get_staging()

sdb1 = Partition.find_by_name(staging, "/dev/sdb1")
sdb2 = Partition.find_by_name(staging, "/dev/sdb2")
sdc1 = Partition.find_by_name(staging, "/dev/sdc1")
sdd1 = Partition.find_by_name(staging, "/dev/sdd1")

test = LvmVg.create(staging, "test")
test.add_lvm_pv(sdb1)
test.add_lvm_pv(sdb2)
test.add_lvm_pv(sdc1)
test.add_lvm_pv(sdd1)

test.create_lvm_lv("1", LvType_NORMAL, 1 * GiB)
test.create_lvm_lv("2", LvType_NORMAL, 1 * GiB)
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/lvm/create-vg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

# requirements: empty partitions sdb1 and sdc1
# requirements: empty partitions sdc1 and sdd1


from sys import exit
Expand All @@ -17,12 +17,12 @@

staging = storage.get_staging()

sdb1 = Partition.find_by_name(staging, "/dev/sdb1")
sdc1 = Partition.find_by_name(staging, "/dev/sdc1")
sdd1 = Partition.find_by_name(staging, "/dev/sdd1")

test = LvmVg.create(staging, "test")
test.add_lvm_pv(sdb1)
test.add_lvm_pv(sdc1)
test.add_lvm_pv(sdd1)
test.set_extent_size(128 * MiB)

print(staging)
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/lvm/delete-complete.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

# requirements: disk /dev/sdb with lvm on partition sdb1 and sdb2
# requirements: disk /dev/sdc with lvm on partition sdc1 and sdd1


from sys import exit
Expand All @@ -17,11 +17,11 @@

staging = storage.get_staging()

sdb1 = Partition.find_by_name(staging, "/dev/sdb1")
sdb1.remove_descendants()
sdc1 = Partition.find_by_name(staging, "/dev/sdc1")
sdc1.remove_descendants(View_REMOVE)

sdb2 = Partition.find_by_name(staging, "/dev/sdb2")
sdb2.remove_descendants()
sdd1 = Partition.find_by_name(staging, "/dev/sdd1")
sdd1.remove_descendants(View_REMOVE)

print(staging)

Expand Down
6 changes: 3 additions & 3 deletions integration-tests/lvm/resize-info-pv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

# requirements: lvm vg test with physical volume /dev/sdb1
# requirements: lvm vg test with physical volume /dev/sdc1


from sys import exit
Expand All @@ -19,9 +19,9 @@

print(probed)

sdb1 = BlkDevice.find_by_name(probed, "/dev/sdb1")
sdc1 = BlkDevice.find_by_name(probed, "/dev/sdc1")

resize_info = sdb1.detect_resize_info()
resize_info = sdc1.detect_resize_info()

print(resize_info)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/md/delete-named.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

md_test = Md.find_by_name(staging, "/dev/md/test")

md_test.remove_descendants()
md_test.remove_descendants(View_REMOVE)
staging.remove_device(md_test)

print(staging)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/md/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

md0 = Md.find_by_name(staging, "/dev/md0")

md0.remove_descendants()
md0.remove_descendants(View_REMOVE)
staging.remove_device(md0)

print(staging)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/mount-points/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

for descendant in blk_filesystem.get_descendants(False):
if is_mount_point(descendant):
blk_filesystem.remove_descendants()
blk_filesystem.remove_descendants(View_REMOVE)

print(staging)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/partition-tables/create-dasd.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

partitionable = Partitionable.find_by_name(staging, "/dev/dasdb")

partitionable.remove_descendants()
partitionable.remove_descendants(View_REMOVE)

partitionable.create_partition_table(PtType_DASD)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/partition-tables/create-gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

partitionable = Partitionable.find_by_name(staging, "/dev/sdc")

partitionable.remove_descendants()
partitionable.remove_descendants(View_REMOVE)

partitionable.create_partition_table(PtType_GPT)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/partition-tables/create-implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

partitionable = Partitionable.find_by_name(staging, "/dev/dasdb")

partitionable.remove_descendants()
partitionable.remove_descendants(View_REMOVE)

partitionable.create_partition_table(PtType_IMPLICIT)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/partition-tables/create-msdos.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

partitionable = Partitionable.find_by_name(staging, "/dev/sdc")

partitionable.remove_descendants()
partitionable.remove_descendants(View_REMOVE)

partitionable.create_partition_table(PtType_MSDOS)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/partition-tables/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

partitionable = Partitionable.find_by_name(staging, "/dev/sdc")

partitionable.remove_descendants()
partitionable.remove_descendants(View_REMOVE)

# print(staging)

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/plain-encryption/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

sdc1 = Partition.find_by_name(staging, "/dev/sdc1")

sdc1.remove_descendants()
sdc1.remove_descendants(View_REMOVE)

print(staging)

Expand Down
2 changes: 2 additions & 0 deletions storage/Devices/MdImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ namespace storage
void
Md::Impl::probe_uuid()
{
udev_settle();

// Note: The UUID reported by mdadm has a different format than reported by
// e.g. blkid.

Expand Down
4 changes: 2 additions & 2 deletions storage/Filesystems/Btrfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ namespace storage
*/
static std::vector<const Btrfs*> get_all(const Devicegraph* devicegraph);

bool get_configure_snapper() const;
void set_configure_snapper(bool configure);
bool get_configure_snapper() const ST_DEPRECATED;
void set_configure_snapper(bool configure) ST_DEPRECATED;

public:

Expand Down
4 changes: 4 additions & 0 deletions storage/Utils/Udev.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ namespace storage

public:

/**
* Settle iff flag is set.
*/
void settle();

void set_settle_needed();

private:
Expand Down
4 changes: 2 additions & 2 deletions testsuite/CompoundAction/bcache-sentence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace storage
bcache0 = disk0->create_bcache( "/dev/bcache0" );

if(cset)
bcache0->add_bcache_cset( cset0 );
bcache0->attach_bcache_cset(cset0);
}


Expand All @@ -74,7 +74,7 @@ namespace storage
bcache1 = disk1->create_bcache( "/dev/bcache1" );

if(cset)
bcache1->add_bcache_cset( cset1 );
bcache1->attach_bcache_cset(cset1);
}

Disk* disk0 = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions testsuite/bcache1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(reassign_numbers)
}


BOOST_AUTO_TEST_CASE(remove_bcache_cset)
BOOST_AUTO_TEST_CASE(detach_bcache_cset)
{
Environment environment(true, ProbeMode::READ_DEVICEGRAPH, TargetMode::DIRECT);
environment.set_devicegraph_filename("probe/bcache1-devicegraph.xml");
Expand All @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(remove_bcache_cset)
BOOST_CHECK_EQUAL(bcache1->has_bcache_cset(), true);
BOOST_CHECK_EQUAL(bcache2->has_bcache_cset(), true);

bcache1->remove_bcache_cset();
bcache1->detach_bcache_cset();

BOOST_CHECK_EQUAL(bcache1->has_bcache_cset(), false);
BOOST_CHECK_EQUAL(bcache2->has_bcache_cset(), true);
Expand Down

0 comments on commit 6f99410

Please sign in to comment.