From 2c5187b36249ab46e38d2d0375ed9124a8723525 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Thu, 23 Jan 2025 17:00:06 +0100 Subject: [PATCH 1/4] - add additional udevadm settle call --- storage/Devices/MdImpl.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/Devices/MdImpl.cc b/storage/Devices/MdImpl.cc index ef768dd4..5b811974 100644 --- a/storage/Devices/MdImpl.cc +++ b/storage/Devices/MdImpl.cc @@ -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. From 8c2eb9fc24f69c4c8638d7da79cb65f97818852f Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Thu, 23 Jan 2025 17:00:25 +0100 Subject: [PATCH 2/4] - added note --- storage/Utils/Udev.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/Utils/Udev.h b/storage/Utils/Udev.h index 38f23faa..bcf4c89c 100644 --- a/storage/Utils/Udev.h +++ b/storage/Utils/Udev.h @@ -44,7 +44,11 @@ namespace storage public: + /** + * Settle iff flag is set. + */ void settle(); + void set_settle_needed(); private: From 2837f67ae6c501353ddfbf0dae3b3bc238e765dc Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Thu, 23 Jan 2025 17:00:48 +0100 Subject: [PATCH 3/4] - mark snapper related functions as deprecated --- storage/Filesystems/Btrfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/Filesystems/Btrfs.h b/storage/Filesystems/Btrfs.h index 2be49f8a..9c759ad5 100644 --- a/storage/Filesystems/Btrfs.h +++ b/storage/Filesystems/Btrfs.h @@ -270,8 +270,8 @@ namespace storage */ static std::vector 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: From 25dd050f370e68b0445a9305d9b28f9889691e6f Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Thu, 23 Jan 2025 17:02:21 +0100 Subject: [PATCH 4/4] - avoid deprecated functions in testsuite --- integration-tests/bcache/delete.py | 6 +++--- .../filesystems/btrfs/multiple-devices/delete.py | 2 +- integration-tests/filesystems/delete-nfs.py | 2 +- integration-tests/filesystems/delete-tmpfs.py | 2 +- integration-tests/lvm/create-complete.py | 10 +++++----- integration-tests/lvm/create-vg.py | 6 +++--- integration-tests/lvm/delete-complete.py | 10 +++++----- integration-tests/lvm/resize-info-pv.py | 6 +++--- integration-tests/md/delete-named.py | 2 +- integration-tests/md/delete.py | 2 +- integration-tests/mount-points/delete.py | 2 +- integration-tests/partition-tables/create-dasd.py | 2 +- integration-tests/partition-tables/create-gpt.py | 2 +- integration-tests/partition-tables/create-implicit.py | 2 +- integration-tests/partition-tables/create-msdos.py | 2 +- integration-tests/partition-tables/delete.py | 2 +- integration-tests/plain-encryption/delete.py | 2 +- testsuite/CompoundAction/bcache-sentence.cc | 4 ++-- testsuite/bcache1.cc | 4 ++-- 19 files changed, 35 insertions(+), 35 deletions(-) diff --git a/integration-tests/bcache/delete.py b/integration-tests/bcache/delete.py index 91a0411a..ac1c9515 100755 --- a/integration-tests/bcache/delete.py +++ b/integration-tests/bcache/delete.py @@ -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) diff --git a/integration-tests/filesystems/btrfs/multiple-devices/delete.py b/integration-tests/filesystems/btrfs/multiple-devices/delete.py index 9394d819..df149da1 100755 --- a/integration-tests/filesystems/btrfs/multiple-devices/delete.py +++ b/integration-tests/filesystems/btrfs/multiple-devices/delete.py @@ -19,7 +19,7 @@ print(staging) sdc1 = Partition.find_by_name(staging, "/dev/sdc1") -sdc1.remove_descendants() +sdc1.remove_descendants(View_REMOVE) print(staging) diff --git a/integration-tests/filesystems/delete-nfs.py b/integration-tests/filesystems/delete-nfs.py index 0b41f6ca..ba0ce4fd 100755 --- a/integration-tests/filesystems/delete-nfs.py +++ b/integration-tests/filesystems/delete-nfs.py @@ -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) diff --git a/integration-tests/filesystems/delete-tmpfs.py b/integration-tests/filesystems/delete-tmpfs.py index 12eeff52..71786b9a 100755 --- a/integration-tests/filesystems/delete-tmpfs.py +++ b/integration-tests/filesystems/delete-tmpfs.py @@ -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) diff --git a/integration-tests/lvm/create-complete.py b/integration-tests/lvm/create-complete.py index 3d14dcc3..cded1fce 100755 --- a/integration-tests/lvm/create-complete.py +++ b/integration-tests/lvm/create-complete.py @@ -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 @@ -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) diff --git a/integration-tests/lvm/create-vg.py b/integration-tests/lvm/create-vg.py index 219e0bee..5aa72861 100755 --- a/integration-tests/lvm/create-vg.py +++ b/integration-tests/lvm/create-vg.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -# requirements: empty partitions sdb1 and sdc1 +# requirements: empty partitions sdc1 and sdd1 from sys import exit @@ -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) diff --git a/integration-tests/lvm/delete-complete.py b/integration-tests/lvm/delete-complete.py index 91d9cc36..1828223f 100755 --- a/integration-tests/lvm/delete-complete.py +++ b/integration-tests/lvm/delete-complete.py @@ -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 @@ -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) diff --git a/integration-tests/lvm/resize-info-pv.py b/integration-tests/lvm/resize-info-pv.py index d4f966c6..4ccb6938 100755 --- a/integration-tests/lvm/resize-info-pv.py +++ b/integration-tests/lvm/resize-info-pv.py @@ -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 @@ -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) diff --git a/integration-tests/md/delete-named.py b/integration-tests/md/delete-named.py index 2e860d4b..213c3520 100755 --- a/integration-tests/md/delete-named.py +++ b/integration-tests/md/delete-named.py @@ -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) diff --git a/integration-tests/md/delete.py b/integration-tests/md/delete.py index e83765ba..03b329f1 100755 --- a/integration-tests/md/delete.py +++ b/integration-tests/md/delete.py @@ -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) diff --git a/integration-tests/mount-points/delete.py b/integration-tests/mount-points/delete.py index e96bf905..4bac1531 100755 --- a/integration-tests/mount-points/delete.py +++ b/integration-tests/mount-points/delete.py @@ -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) diff --git a/integration-tests/partition-tables/create-dasd.py b/integration-tests/partition-tables/create-dasd.py index f4571d14..5662262b 100755 --- a/integration-tests/partition-tables/create-dasd.py +++ b/integration-tests/partition-tables/create-dasd.py @@ -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) diff --git a/integration-tests/partition-tables/create-gpt.py b/integration-tests/partition-tables/create-gpt.py index 1ed95ebb..c5d410d5 100755 --- a/integration-tests/partition-tables/create-gpt.py +++ b/integration-tests/partition-tables/create-gpt.py @@ -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) diff --git a/integration-tests/partition-tables/create-implicit.py b/integration-tests/partition-tables/create-implicit.py index adcf4dd5..eeefb1fe 100755 --- a/integration-tests/partition-tables/create-implicit.py +++ b/integration-tests/partition-tables/create-implicit.py @@ -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) diff --git a/integration-tests/partition-tables/create-msdos.py b/integration-tests/partition-tables/create-msdos.py index 1af01440..0dcf345a 100755 --- a/integration-tests/partition-tables/create-msdos.py +++ b/integration-tests/partition-tables/create-msdos.py @@ -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) diff --git a/integration-tests/partition-tables/delete.py b/integration-tests/partition-tables/delete.py index 982702d4..d3e00af1 100755 --- a/integration-tests/partition-tables/delete.py +++ b/integration-tests/partition-tables/delete.py @@ -20,7 +20,7 @@ partitionable = Partitionable.find_by_name(staging, "/dev/sdc") -partitionable.remove_descendants() +partitionable.remove_descendants(View_REMOVE) # print(staging) diff --git a/integration-tests/plain-encryption/delete.py b/integration-tests/plain-encryption/delete.py index 194e175e..a26bd27a 100755 --- a/integration-tests/plain-encryption/delete.py +++ b/integration-tests/plain-encryption/delete.py @@ -19,7 +19,7 @@ sdc1 = Partition.find_by_name(staging, "/dev/sdc1") -sdc1.remove_descendants() +sdc1.remove_descendants(View_REMOVE) print(staging) diff --git a/testsuite/CompoundAction/bcache-sentence.cc b/testsuite/CompoundAction/bcache-sentence.cc index 2de646dd..ae84d7b9 100644 --- a/testsuite/CompoundAction/bcache-sentence.cc +++ b/testsuite/CompoundAction/bcache-sentence.cc @@ -64,7 +64,7 @@ namespace storage bcache0 = disk0->create_bcache( "/dev/bcache0" ); if(cset) - bcache0->add_bcache_cset( cset0 ); + bcache0->attach_bcache_cset(cset0); } @@ -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; diff --git a/testsuite/bcache1.cc b/testsuite/bcache1.cc index 02dad534..cb617c1d 100644 --- a/testsuite/bcache1.cc +++ b/testsuite/bcache1.cc @@ -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"); @@ -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);