From 9982d05240a982b95de72d039dffd82daf10a052 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 12 Jun 2023 16:50:24 -0400 Subject: [PATCH 01/33] Fix a source code typo Signed-off-by: mulhern --- src/engine/strat_engine/pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/strat_engine/pool.rs b/src/engine/strat_engine/pool.rs index a078d232a0..9aff161bd6 100644 --- a/src/engine/strat_engine/pool.rs +++ b/src/engine/strat_engine/pool.rs @@ -1551,7 +1551,7 @@ mod tests { } #[test] - fn real_test_mainenance_mode() { + fn real_test_maintenance_mode() { real::test_with_spec( &real::DeviceLimits::AtLeast( 2, From 169af1fa9a204111e34a6fa3d953fe1da6e477d4 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 12 Jun 2023 17:28:37 -0400 Subject: [PATCH 02/33] Do not use undefined matrix field toolchain Signed-off-by: mulhern --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85db948c5f..ff2d7f959c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -353,7 +353,7 @@ jobs: - name: Use testing 3.5.2 run: git checkout tags/v3.5.2 -b version-3.5.2 working-directory: ./testing - - name: Run stratisd_cert.py using Rust ${{ matrix.toolchain }} + - name: Run stratisd_cert.py run: > sudo RUST_LOG=stratisd=debug From 6f74e07ffb6a8c48c69ad0c3f25aec75f7c5f6f3 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Thu, 15 Jun 2023 11:32:39 +0200 Subject: [PATCH 03/33] Improve error message for unlock check --- src/engine/strat_engine/backstore/blockdevmgr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/strat_engine/backstore/blockdevmgr.rs b/src/engine/strat_engine/backstore/blockdevmgr.rs index 659d35dab6..654aaf04ee 100644 --- a/src/engine/strat_engine/backstore/blockdevmgr.rs +++ b/src/engine/strat_engine/backstore/blockdevmgr.rs @@ -127,7 +127,7 @@ impl BlockDevMgr { ei.clevis_info().is_some(), ) { return Err(StratisError::Msg( - "Neither the key in the kernel keyring nor Clevis could be used to perform encryption operations on the devices in the pool; check that either the appropriate key in the keyring is set or that the Clevis key storage method is available".to_string(), + "Either the key in the kernel keyring, Clevis, or both could not be used to perform encryption operations on the devices in the pool; check that the appropriate key in the keyring is set and that the Clevis key storage method is available depending on your provided unlock methods".to_string(), )); } } From a8ed4d22e379b1380fd158b7948594374a2f30aa Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Wed, 21 Jun 2023 10:36:48 -0400 Subject: [PATCH 04/33] Update lowest supported Rust to 1.69.0 Signed-off-by: Bryan Gurney --- .github/workflows/main.yml | 4 ++-- .github/workflows/python.yml | 2 +- Cargo.toml | 2 +- stratisd_proc_macros/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ff2d7f959c..5752c59b2b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -152,7 +152,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.66.1 # LOWEST SUPPORTED RUST TOOLCHAIN + toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd @@ -339,7 +339,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.66.1 # LOWEST SUPPORTED RUST TOOLCHAIN + toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 8f43ffe33b..b6bacfdd1c 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -35,7 +35,7 @@ jobs: # MANDATORY CHECKS USING CURRENT DEVELOPMENT ENVIRONMENT - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN # MANDATORY CHECKS USING LOWEST SUPPORTED ENVIRONMENT PROXY - - toolchain: 1.66.1 # LOWEST SUPPORTED RUST TOOLCHAIN + - toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 diff --git a/Cargo.toml b/Cargo.toml index 058978be18..30c8d744a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "stratisd" version = "3.5.7" authors = ["Stratis Developers "] edition = "2021" -rust-version = "1.66.1" # LOWEST SUPPORTED RUST TOOLCHAIN +rust-version = "1.69.0" # LOWEST SUPPORTED RUST TOOLCHAIN build = "build.rs" description = "Stratis daemon" license = "MPL-2.0" diff --git a/stratisd_proc_macros/Cargo.toml b/stratisd_proc_macros/Cargo.toml index dc6ca457c1..6a41291a98 100644 --- a/stratisd_proc_macros/Cargo.toml +++ b/stratisd_proc_macros/Cargo.toml @@ -3,7 +3,7 @@ name = "stratisd_proc_macros" version = "0.2.0" authors = ["Stratis Developers "] edition = "2021" -rust-version = "1.66.1" # LOWEST SUPPORTED RUST TOOLCHAIN +rust-version = "1.69.0" # LOWEST SUPPORTED RUST TOOLCHAIN description = "Stratis daemon procedural macros" license = "MPL-2.0" repository = "https://github.com/stratis-storage/stratisd/" From 9cc5acc89fa1995f81de380cc40ebd4c1c1146c1 Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 22 Jun 2023 10:08:30 -0400 Subject: [PATCH 05/33] Require udev support in container stratis-min-cli checks Signed-off-by: mulhern --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5752c59b2b..d1dfaa548a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -176,7 +176,7 @@ jobs: runs-on: ubuntu-22.04 container: image: fedora:38 # CURRENT DEVELOPMENT ENVIRONMENT - options: --privileged --userns=host --ipc=host -v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro -v /usr/share/dbus-1:/usr/share/dbus-1 + options: --privileged --userns=host --ipc=host -v /dev:/dev -v /run/udev:/run/udev -v /usr/lib/udev:/usr/lib/udev -v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro -v /usr/share/dbus-1:/usr/share/dbus-1 steps: - uses: actions/checkout@v3 - name: Install dependencies From 5dd7e9fa7402fc8bbd85ed446d805bfabfc94277 Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 22 Jun 2023 10:09:34 -0400 Subject: [PATCH 06/33] Increase devicemapper dependency lower bound to 0.33.5 Also increase libc dependency lower bound to 0.2.144 Signed-off-by: mulhern --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0a30c77dd..01c6043d57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -341,9 +341,9 @@ dependencies = [ [[package]] name = "devicemapper" -version = "0.33.4" +version = "0.33.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792cb2154d0e257d330b13f820e424d91de0a149050f2f478d97202926ce28a" +checksum = "75a9fd602a98d192f7662a1f4c4cf6920a1b454c3a9e724f6490cf8e30910114" dependencies = [ "bitflags", "devicemapper-sys", diff --git a/Cargo.toml b/Cargo.toml index 30c8d744a7..d1a46317b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -86,7 +86,7 @@ version = "2.3.0" optional = true [dependencies.devicemapper] -version = "0.33.4" +version = "0.33.5" optional = true [dependencies.dbus] @@ -127,7 +127,7 @@ version = "0.3.0" optional = true [dependencies.libc] -version = "0.2.143" +version = "0.2.144" optional = true [dependencies.libcryptsetup-rs] From 4abeb0d7c53dfba8cf981e0e5c13d842e7281c8f Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Wed, 21 Jun 2023 17:00:33 +0100 Subject: [PATCH 07/33] Add comment to DM version check in setup_dm() Add a comment noting that the DM version check also implicitly checks for the presence of a working udevd. --- src/stratis/dm.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/stratis/dm.rs b/src/stratis/dm.rs index 59e5b4a003..dc523962ad 100644 --- a/src/stratis/dm.rs +++ b/src/stratis/dm.rs @@ -115,6 +115,9 @@ where /// context for polling for events. fn setup_dm() -> StratisResult> { let dm = get_dm_init()?; + // This version check also implicitly checks for the presence of a working udevd; + // if udev us not running this function should return an error to prevent + // stratisd from starting up. let minor_dm_version = dm.version()?.1; if minor_dm_version < REQUIRED_DM_MINOR_VERSION { let err_msg = format!( From 1814ec351655bae532ab3fa1ead185af06799385 Mon Sep 17 00:00:00 2001 From: Matthias Berndt Date: Thu, 4 May 2023 23:41:40 +0200 Subject: [PATCH 08/33] dracut: remove dependency on plymouth use systemd-ask-password instead --- dracut/90stratis/module-setup.sh | 3 +-- dracut/90stratis/stratis-rootfs-setup | 12 ++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dracut/90stratis/module-setup.sh b/dracut/90stratis/module-setup.sh index 5389728095..0319934ae3 100755 --- a/dracut/90stratis/module-setup.sh +++ b/dracut/90stratis/module-setup.sh @@ -12,8 +12,7 @@ check() { xfs_growfs \ xfs_db \ udevadm \ - plymouth \ - /usr/sbin/plymouthd \ + /usr/bin/systemd-ask-password \ /usr/sbin/thin_metadata_size \ /usr/lib/udev/stratis-str-cmp \ /usr/lib/udev/stratis-base32-decode || diff --git a/dracut/90stratis/stratis-rootfs-setup b/dracut/90stratis/stratis-rootfs-setup index e14509dd6e..443508a93f 100755 --- a/dracut/90stratis/stratis-rootfs-setup +++ b/dracut/90stratis/stratis-rootfs-setup @@ -17,10 +17,14 @@ done if $(stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID"); then if $(stratis-min pool is-encrypted "$STRATIS_ROOTFS_UUID"); then - if ! plymouth ask-for-password \ - --command="stratis-min pool start --prompt --unlock-method=keyring $STRATIS_ROOTFS_UUID" \ - --prompt="Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" \ - --number-of-tries=3; then + ATTEMPTS_REMAINING=3 + if + ! while [ $((ATTEMPTS_REMAINING--)) -gt 0 ] + do + systemd-ask-password --id="stratis:$STRATIS_ROOTFS_UUID" "Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" | + stratis-min pool start --prompt --unlock-method=keyring "$STRATIS_ROOTFS_UUID" && break + done + then echo Failed to start pool with UUID $STRATIS_ROOTFS_UUID using a passphrase >&2 exit 1 fi From 7f1e089577cf74037a3a8dee556f31433fa4d1c9 Mon Sep 17 00:00:00 2001 From: Matthias Berndt Date: Tue, 9 May 2023 19:01:12 +0200 Subject: [PATCH 09/33] remove plymouth remnants, add dependency on systemd-ask-password dracut module --- dracut/90stratis/module-setup.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/dracut/90stratis/module-setup.sh b/dracut/90stratis/module-setup.sh index 0319934ae3..ac1ea37194 100755 --- a/dracut/90stratis/module-setup.sh +++ b/dracut/90stratis/module-setup.sh @@ -12,7 +12,6 @@ check() { xfs_growfs \ xfs_db \ udevadm \ - /usr/bin/systemd-ask-password \ /usr/sbin/thin_metadata_size \ /usr/lib/udev/stratis-str-cmp \ /usr/lib/udev/stratis-base32-decode || @@ -22,7 +21,7 @@ check() { # called by dracut depends() { - echo dm + echo dm systemd-ask-password return 0 } @@ -43,16 +42,12 @@ install() { xfs_growfs \ xfs_db \ udevadm \ - plymouth \ - /usr/sbin/plymouthd \ /usr/sbin/thin_metadata_size \ /usr/lib/udev/stratis-base32-decode \ /usr/lib/udev/stratis-str-cmp # Dracut dependencies - inst_multiple $systemdutildir/system-generators/stratis-setup-generator \ - $systemdutildir/system/plymouth-start.service \ - plymouth + inst_multiple $systemdutildir/system-generators/stratis-setup-generator inst_rules "$moddir/61-stratisd.rules" inst_simple "$moddir/stratisd-min.service" $systemdutildir/system/stratisd-min.service From fd993ae753b0324371d244acdbd2a15938ae7a3d Mon Sep 17 00:00:00 2001 From: Matthias Berndt Date: Tue, 30 May 2023 08:52:58 +0200 Subject: [PATCH 10/33] formatting --- dracut/90stratis/stratis-rootfs-setup | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dracut/90stratis/stratis-rootfs-setup b/dracut/90stratis/stratis-rootfs-setup index 443508a93f..aa9af1ca57 100755 --- a/dracut/90stratis/stratis-rootfs-setup +++ b/dracut/90stratis/stratis-rootfs-setup @@ -19,10 +19,9 @@ if $(stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID"); then if $(stratis-min pool is-encrypted "$STRATIS_ROOTFS_UUID"); then ATTEMPTS_REMAINING=3 if - ! while [ $((ATTEMPTS_REMAINING--)) -gt 0 ] - do + ! while [ $((ATTEMPTS_REMAINING--)) -gt 0 ]; do systemd-ask-password --id="stratis:$STRATIS_ROOTFS_UUID" "Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" | - stratis-min pool start --prompt --unlock-method=keyring "$STRATIS_ROOTFS_UUID" && break + stratis-min pool start --prompt --unlock-method=keyring "$STRATIS_ROOTFS_UUID" && break done then echo Failed to start pool with UUID $STRATIS_ROOTFS_UUID using a passphrase >&2 From 025068d07dde98371eecea80b61ada5bef3e662b Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 6 Jul 2023 15:50:13 -0400 Subject: [PATCH 11/33] Specify blockdev interfaces for blockdev UserInfo Signed-off-by: mulhern --- src/dbus_api/tree.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dbus_api/tree.rs b/src/dbus_api/tree.rs index 17149c89ed..f60e585503 100644 --- a/src/dbus_api/tree.rs +++ b/src/dbus_api/tree.rs @@ -755,27 +755,27 @@ where if let Err(e) = self.property_changed_invalidated_signal( &path, prop_hashmap!( - consts::POOL_INTERFACE_NAME_3_1 => { + consts::BLOCKDEV_INTERFACE_NAME_3_1 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => box_variant!(user_info_prop.clone()) }, - consts::POOL_INTERFACE_NAME_3_2 => { + consts::BLOCKDEV_INTERFACE_NAME_3_2 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => box_variant!(user_info_prop.clone()) }, - consts::POOL_INTERFACE_NAME_3_3 => { + consts::BLOCKDEV_INTERFACE_NAME_3_3 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => box_variant!(user_info_prop.clone()) }, - consts::POOL_INTERFACE_NAME_3_4 => { + consts::BLOCKDEV_INTERFACE_NAME_3_4 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => box_variant!(user_info_prop.clone()) }, - consts::POOL_INTERFACE_NAME_3_5 => { + consts::BLOCKDEV_INTERFACE_NAME_3_5 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => box_variant!(user_info_prop) From ae30b29f0608dfa56599f27e47ebfe0321050155 Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 7 Jul 2023 20:20:41 -0400 Subject: [PATCH 12/33] Specify revision 0 blockdev interface for UserInfo signal Signed-off-by: mulhern --- src/dbus_api/tree.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dbus_api/tree.rs b/src/dbus_api/tree.rs index f60e585503..7bacb10af4 100644 --- a/src/dbus_api/tree.rs +++ b/src/dbus_api/tree.rs @@ -755,6 +755,11 @@ where if let Err(e) = self.property_changed_invalidated_signal( &path, prop_hashmap!( + consts::BLOCKDEV_INTERFACE_NAME_3_0 => { + Vec::new(), + consts::BLOCKDEV_USER_INFO_PROP.to_string() => + box_variant!(user_info_prop.clone()) + }, consts::BLOCKDEV_INTERFACE_NAME_3_1 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => From 4c8df62b97354715651fd6e26a19347a07a5186b Mon Sep 17 00:00:00 2001 From: mulhern Date: Sun, 9 Jul 2023 21:33:40 -0400 Subject: [PATCH 13/33] No longer ignore RUSTSEC-2021-0145 in audit target stratisd no longer depends on the atty crate. Signed-off-by: mulhern --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2aa25fee30..4cf7c03766 100644 --- a/Makefile +++ b/Makefile @@ -166,7 +166,7 @@ bloat: ${HOME}/.cargo/bin/cargo-bloat ## Run cargo audit audit: ${HOME}/.cargo/bin/cargo-audit - PATH=${HOME}/.cargo/bin:${PATH} cargo audit -D warnings --ignore=RUSTSEC-2021-0145 + PATH=${HOME}/.cargo/bin:${PATH} cargo audit -D warnings ## Run cargo expand expand: ${HOME}/.cargo/bin/cargo-expand From 7d81d03eac5d0de0a7e8d3bb0772b63c7e570ebd Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 10 Jul 2023 11:22:47 -0400 Subject: [PATCH 14/33] Do not send out signal on UserInfo change before r3 Before then it had EmitsChangedSignal property set to false. Signed-off-by: mulhern --- src/dbus_api/tree.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/dbus_api/tree.rs b/src/dbus_api/tree.rs index 7bacb10af4..0e6c13142e 100644 --- a/src/dbus_api/tree.rs +++ b/src/dbus_api/tree.rs @@ -755,21 +755,6 @@ where if let Err(e) = self.property_changed_invalidated_signal( &path, prop_hashmap!( - consts::BLOCKDEV_INTERFACE_NAME_3_0 => { - Vec::new(), - consts::BLOCKDEV_USER_INFO_PROP.to_string() => - box_variant!(user_info_prop.clone()) - }, - consts::BLOCKDEV_INTERFACE_NAME_3_1 => { - Vec::new(), - consts::BLOCKDEV_USER_INFO_PROP.to_string() => - box_variant!(user_info_prop.clone()) - }, - consts::BLOCKDEV_INTERFACE_NAME_3_2 => { - Vec::new(), - consts::BLOCKDEV_USER_INFO_PROP.to_string() => - box_variant!(user_info_prop.clone()) - }, consts::BLOCKDEV_INTERFACE_NAME_3_3 => { Vec::new(), consts::BLOCKDEV_USER_INFO_PROP.to_string() => From 94e63719ccb4c41da04bd9a29a3b8847da389d34 Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 6 Jul 2023 15:23:43 -0400 Subject: [PATCH 15/33] Send blockdev and pool change signal on grow physical Signed-off-by: mulhern --- src/dbus_api/blockdev/prop_conv.rs | 6 +++ src/dbus_api/pool/pool_3_3/methods.rs | 52 +++++++++++++++++++++-- src/dbus_api/tree.rs | 60 ++++++++++++++++++++++++++- src/dbus_api/types.rs | 22 +++++++++- src/engine/engine.rs | 3 +- src/engine/sim_engine/pool.rs | 4 +- src/engine/strat_engine/pool.rs | 15 +++++-- 7 files changed, 151 insertions(+), 11 deletions(-) diff --git a/src/dbus_api/blockdev/prop_conv.rs b/src/dbus_api/blockdev/prop_conv.rs index 494ab4b148..ef712ac8c4 100644 --- a/src/dbus_api/blockdev/prop_conv.rs +++ b/src/dbus_api/blockdev/prop_conv.rs @@ -17,3 +17,9 @@ pub fn blockdev_new_size_to_prop(new_size: Option) -> (bool, String) { pub fn blockdev_user_info_to_prop(user_info: Option) -> (bool, String) { option_to_tuple(user_info, String::new()) } + +/// Generate D-Bus representation of block device total physical size property. +#[inline] +pub fn blockdev_total_physical_size_to_prop(total_physical_size: Sectors) -> String { + (*total_physical_size.bytes()).to_string() +} diff --git a/src/dbus_api/pool/pool_3_3/methods.rs b/src/dbus_api/pool/pool_3_3/methods.rs index 0334990b72..06cb71b138 100644 --- a/src/dbus_api/pool/pool_3_3/methods.rs +++ b/src/dbus_api/pool/pool_3_3/methods.rs @@ -7,10 +7,14 @@ use dbus_tree::{MTSync, MethodInfo, MethodResult}; use crate::{ dbus_api::{ + pool::Engine, types::{DbusErrorEnum, TData, OK_STRING}, util::{engine_to_dbus_err_tuple, get_next_arg}, }, - engine::{DevUuid, Engine, EngineAction, Pool}, + engine::{ + total_allocated, total_used, BlockDev, DevUuid, Diff, EngineAction, GrowAction, Pool, + StratisUuid, + }, }; pub fn grow_physical(m: &MethodInfo<'_, MTSync>, TData>) -> MethodResult @@ -50,13 +54,55 @@ where let (pool_name, _, pool) = guard.as_mut_tuple(); let result = handle_action!( - pool.grow_physical(&pool_name, pool_uuid, dev_uuid), + pool.grow_physical(&pool_name, pool_uuid, dev_uuid) + .map(|(act, diff)| { + if act.is_changed() { + if let Some(d) = diff { + dbus_context.push_pool_foreground_change( + pool_path.get_name(), + total_used(&d.thin_pool.used, &d.pool.metadata_size), + total_allocated(&d.thin_pool.allocated_size, &d.pool.metadata_size), + Diff::Changed(pool.total_physical_size().bytes()), + d.pool.out_of_alloc_space, + ) + } + } + act + }), dbus_context, pool_path.get_name() ); let ret = match result { - Ok(grown) => grown.is_changed(), + Ok(GrowAction::Identity) => false, + Ok(GrowAction::Grown((_, dev_uuid))) => { + match m.tree.iter().find(|op| { + op.get_data() + .as_ref() + .map(|data| match data.uuid { + StratisUuid::Dev(uuid) => uuid == dev_uuid, + _ => false, + }) + .unwrap_or(false) + }) { + Some(op) => { + let dev_total_physical_size = pool + .get_blockdev(dev_uuid) + .expect("dev_uuid is the UUID of the blockdev that was just expanded; it must be in pool") + .1 + .size(); + dbus_context.push_blockdev_total_physical_size_change( + op.get_name(), + dev_total_physical_size, + ); + } + None => { + warn!("Could not find object path for blockdev uuid {dev_uuid}; no property changed signal requested"); + } + } + + true + } Err(err) => { let (rc, rs) = engine_to_dbus_err_tuple(&err); return Ok(vec![return_message.append3(default_return, rc, rs)]); diff --git a/src/dbus_api/tree.rs b/src/dbus_api/tree.rs index 0e6c13142e..45fe242100 100644 --- a/src/dbus_api/tree.rs +++ b/src/dbus_api/tree.rs @@ -25,7 +25,10 @@ use devicemapper::{Bytes, Sectors}; use crate::{ dbus_api::{ api::prop_conv::{locked_pools_to_prop, stopped_pools_to_prop}, - blockdev::prop_conv::{blockdev_new_size_to_prop, blockdev_user_info_to_prop}, + blockdev::prop_conv::{ + blockdev_new_size_to_prop, blockdev_total_physical_size_to_prop, + blockdev_user_info_to_prop, + }, consts, filesystem::prop_conv::{fs_size_to_prop, fs_used_to_prop}, pool::prop_conv::{ @@ -779,6 +782,57 @@ where } } + /// Send a signal indicating that the blockdev total physical size has + /// changed. + fn handle_blockdev_total_physical_size_change( + &self, + path: Path<'static>, + new_total_physical_size: Sectors, + ) { + let total_physical_size_prop = + blockdev_total_physical_size_to_prop(new_total_physical_size); + if let Err(e) = self.property_changed_invalidated_signal( + &path, + prop_hashmap!( + consts::BLOCKDEV_INTERFACE_NAME_3_0 => { + Vec::new(), + consts::BLOCKDEV_TOTAL_SIZE_PROP.to_string() => + box_variant!(total_physical_size_prop.clone()) + }, + consts::BLOCKDEV_INTERFACE_NAME_3_1 => { + Vec::new(), + consts::BLOCKDEV_TOTAL_SIZE_PROP.to_string() => + box_variant!(total_physical_size_prop.clone()) + }, + consts::BLOCKDEV_INTERFACE_NAME_3_2 => { + Vec::new(), + consts::BLOCKDEV_TOTAL_SIZE_PROP.to_string() => + box_variant!(total_physical_size_prop.clone()) + }, + consts::BLOCKDEV_INTERFACE_NAME_3_3 => { + Vec::new(), + consts::BLOCKDEV_TOTAL_SIZE_PROP.to_string() => + box_variant!(total_physical_size_prop.clone()) + }, + consts::BLOCKDEV_INTERFACE_NAME_3_4 => { + Vec::new(), + consts::BLOCKDEV_TOTAL_SIZE_PROP.to_string() => + box_variant!(total_physical_size_prop.clone()) + }, + consts::BLOCKDEV_INTERFACE_NAME_3_5 => { + Vec::new(), + consts::BLOCKDEV_TOTAL_SIZE_PROP.to_string() => + box_variant!(total_physical_size_prop) + } + ), + ) { + warn!( + "Failed to send a signal over D-Bus indicating blockdev total physical size change: {}", + e + ); + } + } + /// Send a signal indicating that the pool overprovisioning mode has changed. fn handle_pool_overprov_mode_change(&self, path: Path<'static>, new_mode: bool) { if let Err(e) = self.property_changed_invalidated_signal( @@ -1023,6 +1077,10 @@ where self.handle_blockdev_user_info_change(path, new_user_info); Ok(true) } + DbusAction::BlockdevTotalPhysicalSizeChange(path, new_total_physical_size) => { + self.handle_blockdev_total_physical_size_change(path, new_total_physical_size); + Ok(true) + } DbusAction::PoolForegroundChange(item, new_used, new_alloc, new_size, new_no_space) => { self.handle_pool_foreground_change( item, diff --git a/src/dbus_api/types.rs b/src/dbus_api/types.rs index ec07968da3..af50a18749 100644 --- a/src/dbus_api/types.rs +++ b/src/dbus_api/types.rs @@ -116,7 +116,7 @@ pub enum DbusAction { LockedPoolsChange(LockedPoolsInfo), StoppedPoolsChange(StoppedPoolsInfo), BlockdevUserInfoChange(Path<'static>, Option), - + BlockdevTotalPhysicalSizeChange(Path<'static>, Sectors), FsBackgroundChange( FilesystemUuid, SignalChange>, @@ -461,6 +461,26 @@ where } } + /// Send changed signal for changed blockdev total size property. + pub fn push_blockdev_total_physical_size_change( + &self, + path: &Path<'static>, + total_physical_size: Sectors, + ) { + if let Err(e) = self + .sender + .send(DbusAction::BlockdevTotalPhysicalSizeChange( + path.clone(), + total_physical_size, + )) + { + warn!( + "Block device total physical size change event could not be sent to the processing thread; no signal will be sent out for the block device total physical size state change: {}", + e, + ) + } + } + /// Send changed signal for changed pool properties when blockdevs are /// added. pub fn push_pool_foreground_change( diff --git a/src/engine/engine.rs b/src/engine/engine.rs index e5db6b7a23..db4e847a68 100644 --- a/src/engine/engine.rs +++ b/src/engine/engine.rs @@ -329,12 +329,13 @@ pub trait Pool: Debug + Send + Sync { /// Grow either a specified device or all devices in a pool if the underlying /// physical device or devices have changed in size. + #[allow(clippy::type_complexity)] fn grow_physical( &mut self, pool_name: &Name, pool_uuid: PoolUuid, device: DevUuid, - ) -> StratisResult>; + ) -> StratisResult<(GrowAction<(PoolUuid, DevUuid)>, Option)>; } pub type HandleEvents

= ( diff --git a/src/engine/sim_engine/pool.rs b/src/engine/sim_engine/pool.rs index 45cceeeb74..863a2d3d6e 100644 --- a/src/engine/sim_engine/pool.rs +++ b/src/engine/sim_engine/pool.rs @@ -691,8 +691,8 @@ impl Pool for SimPool { _: &Name, _: PoolUuid, _: DevUuid, - ) -> StratisResult> { - Ok(GrowAction::Identity) + ) -> StratisResult<(GrowAction<(PoolUuid, DevUuid)>, Option)> { + Ok((GrowAction::Identity, None)) } } diff --git a/src/engine/strat_engine/pool.rs b/src/engine/strat_engine/pool.rs index 9aff161bd6..f0c1625d3d 100644 --- a/src/engine/strat_engine/pool.rs +++ b/src/engine/strat_engine/pool.rs @@ -1190,15 +1190,23 @@ impl Pool for StratPool { name: &Name, pool_uuid: PoolUuid, device: DevUuid, - ) -> StratisResult> { + ) -> StratisResult<(GrowAction<(PoolUuid, DevUuid)>, Option)> { + let cached = self.cached(); + let changed = self.backstore.grow(device)?; if changed { if self.thin_pool.set_queue_mode() { self.write_metadata(name)?; } - Ok(GrowAction::Grown((pool_uuid, device))) + Ok(( + GrowAction::Grown((pool_uuid, device)), + Some(PoolDiff { + thin_pool: self.thin_pool.cached().unchanged(), + pool: cached.diff(&self.dump(())), + }), + )) } else { - Ok(GrowAction::Identity) + Ok((GrowAction::Identity, None)) } } } @@ -1745,6 +1753,7 @@ mod tests { assert!(pool.out_of_alloc_space()); pool.grow_physical(pool_name, *pool_uuid, dev_uuid) .unwrap() + .0 .changed() .unwrap(); let (_, dev) = pool.get_blockdev(dev_uuid).unwrap(); From 74f71621afd3b12374f37d83fe1d7464b79ca50c Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 10 Jul 2023 19:26:51 -0400 Subject: [PATCH 16/33] Remove code for handling only pool size change From now on, if the pool size changes, then so will some other properties, so we will likely always need to go with the pool foreground change methods. Signed-off-by: mulhern --- src/dbus_api/tree.rs | 48 ------------------------------------------- src/dbus_api/types.rs | 15 -------------- 2 files changed, 63 deletions(-) diff --git a/src/dbus_api/tree.rs b/src/dbus_api/tree.rs index 45fe242100..f80c5a8b6b 100644 --- a/src/dbus_api/tree.rs +++ b/src/dbus_api/tree.rs @@ -669,50 +669,6 @@ where ); } - /// Send a signal indicating that the pool total size has changed. - fn handle_pool_size_change(&self, path: Path<'static>, new_size: Bytes) { - if let Err(e) = self.property_changed_invalidated_signal( - &path, - prop_hashmap! { - consts::POOL_INTERFACE_NAME_3_0 => { - Vec::new(), - consts::POOL_TOTAL_SIZE_PROP.to_string() => - box_variant!(pool_size_to_prop(new_size)) - }, - consts::POOL_INTERFACE_NAME_3_1 => { - Vec::new(), - consts::POOL_TOTAL_SIZE_PROP.to_string() => - box_variant!(pool_size_to_prop(new_size)) - }, - consts::POOL_INTERFACE_NAME_3_2 => { - Vec::new(), - consts::POOL_TOTAL_SIZE_PROP.to_string() => - box_variant!(pool_size_to_prop(new_size)) - }, - consts::POOL_INTERFACE_NAME_3_3 => { - Vec::new(), - consts::POOL_TOTAL_SIZE_PROP.to_string() => - box_variant!(pool_size_to_prop(new_size)) - }, - consts::POOL_INTERFACE_NAME_3_4 => { - Vec::new(), - consts::POOL_TOTAL_SIZE_PROP.to_string() => - box_variant!(pool_size_to_prop(new_size)) - }, - consts::POOL_INTERFACE_NAME_3_5 => { - Vec::new(), - consts::POOL_TOTAL_SIZE_PROP.to_string() => - box_variant!(pool_size_to_prop(new_size)) - } - }, - ) { - warn!( - "Failed to send a signal over D-Bus indicating pool size change: {}", - e - ); - } - } - /// Send a signal indicating that the pool filesystem limit has changed. fn handle_pool_fs_limit_change(&self, path: Path<'static>, new_fs_limit: u64) { if let Err(e) = self.property_changed_invalidated_signal( @@ -1053,10 +1009,6 @@ where self.handle_pool_cache_change(item, has_cache); Ok(true) } - DbusAction::PoolSizeChange(path, new_size) => { - self.handle_pool_size_change(path, new_size); - Ok(true) - } DbusAction::PoolFsLimitChange(path, new_limit) => { self.handle_pool_fs_limit_change(path, new_limit); Ok(true) diff --git a/src/dbus_api/types.rs b/src/dbus_api/types.rs index af50a18749..79874af541 100644 --- a/src/dbus_api/types.rs +++ b/src/dbus_api/types.rs @@ -110,7 +110,6 @@ pub enum DbusAction { PoolKeyDescChange(Path<'static>, Option), PoolClevisInfoChange(Path<'static>, Option), PoolCacheChange(Path<'static>, bool), - PoolSizeChange(Path<'static>, Bytes), PoolFsLimitChange(Path<'static>, u64), PoolOverprovModeChange(Path<'static>, bool), LockedPoolsChange(LockedPoolsInfo), @@ -369,20 +368,6 @@ where } } - /// Send changed signal for pool TotalPhysicalSize property. - pub fn push_pool_size_change(&self, item: &Path<'static>, new_size: Bytes) { - if let Err(e) = self - .sender - .send(DbusAction::PoolSizeChange(item.clone(), new_size)) - { - warn!( - "D-Bus pool size change event could not be sent to the processing thread; \ - no signal will be sent out for the size change of pool with path {}: {}", - item, e, - ) - } - } - /// Send changed signal for pool FsLimit property. pub fn push_pool_fs_limit_change(&self, item: &Path<'static>, new_fs_limit: u64) { if let Err(e) = self From a3f7398275b81549cb48e651a11e1d97bbce7670 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 10 Jul 2023 19:38:05 -0400 Subject: [PATCH 17/33] Use enriched return value in test Signed-off-by: mulhern --- src/engine/strat_engine/pool.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/engine/strat_engine/pool.rs b/src/engine/strat_engine/pool.rs index f0c1625d3d..3f2fa229f7 100644 --- a/src/engine/strat_engine/pool.rs +++ b/src/engine/strat_engine/pool.rs @@ -1751,14 +1751,17 @@ mod tests { }; assert!(pool.out_of_alloc_space()); - pool.grow_physical(pool_name, *pool_uuid, dev_uuid) - .unwrap() - .0 - .changed() - .unwrap(); + let (act, pool_diff) = pool.grow_physical(pool_name, *pool_uuid, dev_uuid).unwrap(); + assert!(act.is_changed()); let (_, dev) = pool.get_blockdev(dev_uuid).unwrap(); assert_eq!(dev.size(), 2u64 * size); assert!(!pool.out_of_alloc_space()); + assert!(!pool_diff + .unwrap() + .pool + .out_of_alloc_space + .changed() + .unwrap()); } #[test] From 1fc4cef2eadce385b802f2b86c43726e3aac3cc1 Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 11 Jul 2023 14:47:30 -0400 Subject: [PATCH 18/33] Remove tests target It is incomplete and fell out of use a long time ago. Signed-off-by: mulhern --- tests/client-dbus/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/client-dbus/Makefile b/tests/client-dbus/Makefile index b219384149..54d8c6c133 100644 --- a/tests/client-dbus/Makefile +++ b/tests/client-dbus/Makefile @@ -38,6 +38,3 @@ filesystem-predict-tests: .PHONY: dump-metadata-tests dump-metadata-tests: python3 -m unittest ${UNITTEST_OPTS} tests.udev.test_dump - -.PHONY: tests -tests: udev-tests misc-tests From 388d3aa5f638a88905077f91f67b1bbf63c948ad Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 11 Jul 2023 14:45:45 -0400 Subject: [PATCH 19/33] Start running startup test again, slightly modified Avoid endless loops and wait for stratis lock file to exist before trying to start next version of stratisd. Signed-off-by: mulhern --- .github/workflows/python.yml | 2 +- tests/client-dbus/Makefile | 2 +- tests/client-dbus/tests/misc/test_startup.py | 21 ++++++++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b6bacfdd1c..7927fd3082 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -85,7 +85,7 @@ jobs: STRATIS_DUMPMETADATA=/usr/bin/stratis-dumpmetadata STRATISD=/usr/libexec/stratisd PYTHONPATH=./src - udev-tests dump-metadata-tests + udev-tests dump-metadata-tests startup-tests working-directory: ./tests/client-dbus # PYTHON-BASED TESTS WITH TANG diff --git a/tests/client-dbus/Makefile b/tests/client-dbus/Makefile index 54d8c6c133..b1e48f3637 100644 --- a/tests/client-dbus/Makefile +++ b/tests/client-dbus/Makefile @@ -6,7 +6,7 @@ lint: pylint tests --disable=R0801 .PHONY: misc-tests -misc-tests: +startup-tests: python3 -m unittest ${UNITTEST_OPTS} tests.misc.test_startup .PHONY: fmt diff --git a/tests/client-dbus/tests/misc/test_startup.py b/tests/client-dbus/tests/misc/test_startup.py index b7860b43ca..fbe3690eab 100644 --- a/tests/client-dbus/tests/misc/test_startup.py +++ b/tests/client-dbus/tests/misc/test_startup.py @@ -20,6 +20,7 @@ # isort: STDLIB import os import subprocess +import time import unittest # isort: THIRDPARTY @@ -47,8 +48,12 @@ def setUp(self): env=os.environ, ) - while not psutil.pid_exists(process.pid): - pass + for _ in range(5): + if psutil.pid_exists(process.pid): + break + time.sleep(1) + else: + raise RuntimeError("Initial stratisd process was not started.") def cleanup(): process.terminate() @@ -60,6 +65,18 @@ def test_unique_instance(self): """ Verify that a second stratisd instance can not be started. """ + + stratisd_lock_file = "/run/stratisd.pid" + + for _ in range(5): + if os.path.exists(stratisd_lock_file): + break + time.sleep(1) + else: + raise RuntimeError( + f"Lock file {stratisd_lock_file} does not seem to exist." + ) + env = dict(os.environ) env["RUST_LOG"] = env.get("RUST_LOG", "") + ",nix::fcntl=debug" with subprocess.Popen( From bac1f91ee1fedbe6fc764372132b57514fe9b205 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Thu, 13 Jul 2023 12:04:06 -0400 Subject: [PATCH 20/33] Fix manual_next_back lint error Signed-off-by: Bryan Gurney --- src/engine/strat_engine/backstore/range_alloc.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/engine/strat_engine/backstore/range_alloc.rs b/src/engine/strat_engine/backstore/range_alloc.rs index 456ff0f8bc..da2bdf96b3 100644 --- a/src/engine/strat_engine/backstore/range_alloc.rs +++ b/src/engine/strat_engine/backstore/range_alloc.rs @@ -293,8 +293,7 @@ impl PerDevSegments { assert!(self .used .iter() - .rev() - .next() + .next_back() .map(|(s, l)| *s + *l <= self.limit) .unwrap_or(true)); // The complement really is the complement From a4f1ec88bb13085c6d707d692ab24993a7836f84 Mon Sep 17 00:00:00 2001 From: mulhern Date: Sun, 9 Jul 2023 22:05:45 -0400 Subject: [PATCH 21/33] Increase itertools dependency lower bound to 0.11.0 Signed-off-by: mulhern --- Cargo.lock | 13 +++++++++++-- Cargo.toml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 01c6043d57..c2aa61c96c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -671,6 +671,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.6" @@ -973,7 +982,7 @@ dependencies = [ "anstyle", "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -1284,7 +1293,7 @@ dependencies = [ "env_logger", "futures", "iocuddle", - "itertools", + "itertools 0.11.0", "lazy_static", "libblkid-rs", "libc", diff --git a/Cargo.toml b/Cargo.toml index d1a46317b0..59e486e816 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,7 +115,7 @@ version = "0.1.0" optional = true [dependencies.itertools] -version = "0.10.1" +version = "0.11.0" optional = true [dependencies.lazy_static] From ec54f38c6ee65c346c64d83056b6a45efe893364 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Thu, 13 Jul 2023 11:35:18 -0400 Subject: [PATCH 22/33] Fix bug in partially unlocked pool setup This resolves a bug where a panic could occur in a partially unlocked pool if it is started after failing the first time. --- .../strat_engine/backstore/crypt/shared.rs | 4 +- src/engine/strat_engine/liminal/liminal.rs | 135 +++--------------- src/engine/strat_engine/liminal/setup.rs | 7 +- tests/client-dbus/tests/udev/test_udev.py | 4 +- 4 files changed, 26 insertions(+), 124 deletions(-) diff --git a/src/engine/strat_engine/backstore/crypt/shared.rs b/src/engine/strat_engine/backstore/crypt/shared.rs index 1932b92748..1e947dd894 100644 --- a/src/engine/strat_engine/backstore/crypt/shared.rs +++ b/src/engine/strat_engine/backstore/crypt/shared.rs @@ -44,7 +44,7 @@ use crate::{ STRATIS_TOKEN_ID, STRATIS_TOKEN_POOLNAME_KEY, STRATIS_TOKEN_POOL_UUID_KEY, STRATIS_TOKEN_TYPE, TOKEN_KEYSLOTS_KEY, TOKEN_TYPE_KEY, }, - handle::CryptHandle, + handle::{CryptHandle, CryptMetadata}, }, devices::get_devno_from_path, }, @@ -62,8 +62,6 @@ use crate::{ stratis::{StratisError, StratisResult}, }; -use super::handle::CryptMetadata; - /// Set up crypt logging to log cryptsetup debug information at the trace level. pub fn set_up_crypt_logging() { fn logging_callback(level: CryptLogLevel, msg: &str, _: Option<&mut ()>) { diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs index a6d75c6b8d..5795123aac 100644 --- a/src/engine/strat_engine/liminal/liminal.rs +++ b/src/engine/strat_engine/liminal/liminal.rs @@ -18,10 +18,7 @@ use crate::{ engine::{DumpState, Pool, StateDiff}, strat_engine::{ backstore::{find_stratis_devs_by_uuid, CryptHandle, StratBlockDev}, - dm::{ - has_leftover_devices, list_of_crypt_devices, remove_optional_devices, - stop_partially_constructed_pool, - }, + dm::{has_leftover_devices, stop_partially_constructed_pool}, liminal::{ device_info::{ reconstruct_stratis_infos, split_stratis_infos, stratis_infos_ref, DeviceSet, @@ -92,13 +89,10 @@ impl LiminalDevices { pools: &Table, pool_uuid: PoolUuid, unlock_method: UnlockMethod, - ) -> StratisResult> { - fn handle_luks( - luks_info: &LLuksInfo, - unlock_method: UnlockMethod, - ) -> StratisResult { - if let Some(h) = CryptHandle::setup(&luks_info.dev_info.devnode, Some(unlock_method))? { - Ok(h) + ) -> StratisResult> { + fn handle_luks(luks_info: &LLuksInfo, unlock_method: UnlockMethod) -> StratisResult<()> { + if CryptHandle::setup(&luks_info.dev_info.devnode, Some(unlock_method))?.is_some() { + Ok(()) } else { Err(StratisError::Msg(format!( "Block device {} does not appear to be formatted with @@ -135,16 +129,8 @@ impl LiminalDevices { match info { LInfo::Stratis(_) => (), LInfo::Luks(ref luks_info) => match handle_luks(luks_info, unlock_method) { - Ok(handle) => unlocked.push((*dev_uuid, handle)), - Err(e) => { - return Err(handle_unlock_rollback( - e, - unlocked - .into_iter() - .map(|(dev_uuid, _)| dev_uuid) - .collect::>(), - )); - } + Ok(()) => unlocked.push(*dev_uuid), + Err(e) => return Err(e), }, } } @@ -216,24 +202,13 @@ impl LiminalDevices { (Err(e), _) => return Err(e), }; - let (uuids, handles) = unlocked_devices.into_iter().fold( - (Vec::new(), HashMap::new()), - |(mut uuids, mut handles), (uuid, handle)| { - uuids.push(uuid); - handles.insert(uuid, handle); - (uuids, handles) - }, - ); + let uuids = unlocked_devices.into_iter().collect::>(); let mut stopped_pool = self .stopped_pools .remove(&pool_uuid) .or_else(|| self.partially_constructed_pools.remove(&pool_uuid)) .expect("Checked above"); - let all_uuids = stopped_pool - .iter() - .map(|(dev_uuid, _)| *dev_uuid) - .collect::>(); match find_stratis_devs_by_uuid(pool_uuid, &uuids) { Ok(infos) => infos.into_iter().for_each(|(dev_uuid, (path, devno))| { if let Ok(Ok(Some(bda))) = bda_wrapper(&path) { @@ -256,15 +231,12 @@ impl LiminalDevices { }), Err(e) => { warn!("Failed to scan for newly unlocked Stratis devices: {}", e); - let err = handle_unlock_rollback(e, all_uuids); - return Err(err); + return Err(e); } }; - match self.try_setup_pool(pools, pool_uuid, stopped_pool, handles) { - Ok((name, pool)) => Ok((name, pool_uuid, pool, uuids)), - Err(e) => Err(handle_unlock_rollback(e, all_uuids)), - } + self.try_setup_pool(pools, pool_uuid, stopped_pool) + .map(|(name, pool)| (name, pool_uuid, pool, uuids)) } /// Stop a pool, tear down the devicemapper devices, and store the pool information @@ -540,7 +512,6 @@ impl LiminalDevices { pools: &Table, pool_uuid: PoolUuid, device_set: DeviceSet, - handles: HashMap, ) -> StratisResult<(Name, StratPool)> { fn try_setup_pool_failure( pools: &Table, @@ -548,7 +519,6 @@ impl LiminalDevices { luks_info: StratisResult<(Option, MaybeInconsistent>)>, infos: &HashMap, bdas: HashMap, - handles: HashMap, meta_res: StratisResult<(DateTime, PoolSave)>, ) -> BDARecordResult<(Name, StratPool)> { let (timestamp, metadata) = match meta_res { @@ -557,7 +527,7 @@ impl LiminalDevices { }; setup_pool( - pools, pool_uuid, luks_info, infos, bdas, handles, timestamp, metadata, + pools, pool_uuid, luks_info, infos, bdas, timestamp, metadata, ) } @@ -581,7 +551,7 @@ impl LiminalDevices { let res = load_stratis_metadata(pool_uuid, stratis_infos_ref(&infos)); let (infos, bdas) = split_stratis_infos(infos); - match try_setup_pool_failure(pools, pool_uuid, luks_info, &infos, bdas, handles, res) { + match try_setup_pool_failure(pools, pool_uuid, luks_info, &infos, bdas, res) { Ok((name, pool)) => { self.uuid_lookup = self .uuid_lookup @@ -638,22 +608,8 @@ impl LiminalDevices { Err(e) => return Err((e, bdas)), }; if let Some(true) | None = metadata.started { - let mut handles = HashMap::default(); - for (dev_uuid, info) in infos { - if let Some((dev_uuid, handle)) = match info.luks.as_ref() { - Some(l) => match CryptHandle::setup(&l.dev_info.devnode, None) { - Ok(Some(handle)) => Some((dev_uuid, handle)), - Ok(None) => None, - Err(e) => return Err((e, bdas)), - }, - None => None, - } { - handles.insert(*dev_uuid, handle); - } - } - setup_pool( - pools, pool_uuid, luks_info, infos, bdas, handles, timestamp, metadata, + pools, pool_uuid, luks_info, infos, bdas, timestamp, metadata, ) .map(Either::Left) } else { @@ -810,6 +766,7 @@ impl LiminalDevices { let mut devices = self .stopped_pools .remove(&pool_uuid) + .or_else(|| self.partially_constructed_pools.remove(&pool_uuid)) .unwrap_or_else(DeviceSet::new); self.uuid_lookup @@ -900,44 +857,8 @@ impl LiminalDevices { .map(|(dev_uuid, _)| *dev_uuid) .collect::>(); if has_leftover_devices(pool_uuid, &device_uuids) { - let dev_uuids = device_set - .iter() - .map(|(dev_uuid, _)| *dev_uuid) - .collect::>(); - let res = stop_partially_constructed_pool(pool_uuid, &dev_uuids); - let device_set = device_set - .into_iter() - .map(|(dev_uuid, info)| { - ( - dev_uuid, - match info { - LInfo::Luks(l) => LInfo::Luks(l), - LInfo::Stratis(mut s) => { - if let Some(l) = s.luks { - if !s.dev_info.devnode.exists() { - LInfo::Luks(l) - } else { - s.luks = Some(l); - LInfo::Stratis(s) - } - } else { - LInfo::Stratis(s) - } - } - }, - ) - }) - .collect::(); - match res { - Ok(_) => { - assert!(!has_leftover_devices(pool_uuid, &device_uuids)); - self.stopped_pools.insert(pool_uuid, device_set); - } - Err(_) => { - self.partially_constructed_pools - .insert(pool_uuid, device_set); - } - } + self.partially_constructed_pools + .insert(pool_uuid, device_set); } else { self.stopped_pools.insert(pool_uuid, device_set); } @@ -1042,14 +963,12 @@ fn load_stratis_metadata( /// /// If there is a name conflict between the set of devices in devices /// and some existing pool, return an error. -#[allow(clippy::too_many_arguments)] fn setup_pool( pools: &Table, pool_uuid: PoolUuid, luks_info: StratisResult<(Option, MaybeInconsistent>)>, infos: &HashMap, bdas: HashMap, - handles: HashMap, timestamp: DateTime, metadata: PoolSave, ) -> BDARecordResult<(Name, StratPool)> { @@ -1063,7 +982,7 @@ fn setup_pool( )), bdas)); } - let (datadevs, cachedevs) = match get_blockdevs(&metadata.backstore, infos, bdas, handles) { + let (datadevs, cachedevs) = match get_blockdevs(&metadata.backstore, infos, bdas) { Err((err, bdas)) => return Err( (StratisError::Chained( format!( @@ -1134,21 +1053,3 @@ fn setup_pool( ), bdas) }) } - -/// Rollback an unlock operation for some or all devices of a pool that have been -/// unlocked prior to the failure occurring. -fn handle_unlock_rollback(causal_error: StratisError, uuids: Vec) -> StratisError { - let devices = list_of_crypt_devices(&uuids); - if let Err(e) = remove_optional_devices(devices) { - warn!("Failed to roll back encrypted pool unlock; some previously locked encrypted devices may be left in an unlocked state"); - return StratisError::NoActionRollbackError { - causal_error: Box::new(causal_error), - rollback_error: Box::new(StratisError::Chained( - "Failed to roll back encrypted pool unlock; some previously locked encrypted devices may be left in an unlocked state".to_string(), - Box::new(e), - )), - }; - } - - causal_error -} diff --git a/src/engine/strat_engine/liminal/setup.rs b/src/engine/strat_engine/liminal/setup.rs index ac14d181f9..e92790537b 100644 --- a/src/engine/strat_engine/liminal/setup.rs +++ b/src/engine/strat_engine/liminal/setup.rs @@ -137,7 +137,6 @@ pub fn get_blockdevs( backstore_save: &BackstoreSave, infos: &HashMap, mut bdas: HashMap, - mut handles: HashMap, ) -> BDARecordResult<(Vec, Vec)> { let recorded_data_map: HashMap = backstore_save .data_tier @@ -185,7 +184,6 @@ pub fn get_blockdevs( fn get_blockdev( info: &LStratisDevInfo, bda: BDA, - handle: Option, data_map: &HashMap, cache_map: &HashMap, segment_table: &HashMap>, @@ -249,6 +247,10 @@ pub fn get_blockdevs( Some(luks) => &luks.dev_info.devnode, None => &info.dev_info.devnode, }; + let handle = match CryptHandle::setup(physical_path, None) { + Ok(h) => h, + Err(e) => return Err((e, bda)), + }; let underlying_device = match handle { Some(handle) => UnderlyingDevice::Encrypted(handle), None => UnderlyingDevice::Unencrypted(match DevicePath::new(physical_path) { @@ -275,7 +277,6 @@ pub fn get_blockdevs( match get_blockdev( infos.get(dev_uuid).expect("bdas.keys() == infos.keys()"), bdas.remove(dev_uuid).expect("bdas.keys() == infos.keys()"), - handles.remove(dev_uuid), &recorded_data_map, &recorded_cache_map, &segment_table, diff --git a/tests/client-dbus/tests/udev/test_udev.py b/tests/client-dbus/tests/udev/test_udev.py index 4a7e6ec3fc..00f26123f1 100644 --- a/tests/client-dbus/tests/udev/test_udev.py +++ b/tests/client-dbus/tests/udev/test_udev.py @@ -526,7 +526,9 @@ def test_duplicate_pool_name( if exit_code == StratisdErrors.OK and changed: blockdevs = blockdevs_tmp - wait_for_udev_count(len(blockdevs) + len(non_luks_tokens)) + wait_for_udev_count( + len(blockdevs) + len(non_luks_tokens) + len(luks_tokens) + ) # The number of pools should never exceed one, since all the pools # previously formed in the test have the same name. From 892305387b83a954b4bcd1f485165928d8231fe0 Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 25 Jul 2023 12:28:30 -0400 Subject: [PATCH 23/33] Remove dm::stop_partially_constructed_pool In stratisd 3.6.0 stop_partially_constructed_pool() is used via a D-Bus StopPool call which allows the user to explicitly request that a partially set up pool be stopped. In stratisd < 3.6.0 this can not be done, so, when the teardown of a partially constructed pool on setup is eliminated in liminal.rs, the method becomes dead. This change broke the D-Bus API, so we can not add it in in this branch. Signed-off-by: mulhern --- src/engine/strat_engine/dm.rs | 8 -------- src/engine/strat_engine/liminal/liminal.rs | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/engine/strat_engine/dm.rs b/src/engine/strat_engine/dm.rs index 960e978f56..2b71dbd2a3 100644 --- a/src/engine/strat_engine/dm.rs +++ b/src/engine/strat_engine/dm.rs @@ -61,14 +61,6 @@ pub fn remove_optional_devices(devs: Vec) -> StratisResult { Ok(did_something) } -pub fn stop_partially_constructed_pool( - pool_uuid: PoolUuid, - dev_uuids: &[DevUuid], -) -> StratisResult { - let devs = list_of_partial_pool_devices(pool_uuid, dev_uuids); - remove_optional_devices(devs) -} - pub fn thin_device(pool_uuid: PoolUuid, fs_uuid: FilesystemUuid) -> DmNameBuf { let (dm_name, _) = format_thin_ids(pool_uuid, ThinRole::Filesystem(fs_uuid)); dm_name diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs index 5795123aac..9402a6d453 100644 --- a/src/engine/strat_engine/liminal/liminal.rs +++ b/src/engine/strat_engine/liminal/liminal.rs @@ -18,7 +18,7 @@ use crate::{ engine::{DumpState, Pool, StateDiff}, strat_engine::{ backstore::{find_stratis_devs_by_uuid, CryptHandle, StratBlockDev}, - dm::{has_leftover_devices, stop_partially_constructed_pool}, + dm::has_leftover_devices, liminal::{ device_info::{ reconstruct_stratis_infos, split_stratis_infos, stratis_infos_ref, DeviceSet, From ac17c779a03d4e26fecd41ccd11a21c6a5a77563 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Fri, 21 Jul 2023 10:57:41 -0400 Subject: [PATCH 24/33] github actions: update recommended Rust to 1.71.0 Signed-off-by: Bryan Gurney --- .github/workflows/cargo.yml | 2 +- .github/workflows/fedora.yml | 20 ++++++++++---------- .github/workflows/main.yml | 12 ++++++------ .github/workflows/python.yml | 4 ++-- .github/workflows/ubuntu.yml | 18 +++++++++--------- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 24d10a0683..5ca3f76db4 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -51,7 +51,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Check out ci repo run: git clone https://github.com/stratis-storage/ci.git - name: Run comparisons of version specs with available Fedora packages diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 695b858fc0..85769e7a5d 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -34,33 +34,33 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-travis - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: >- TANG_URL=localhost make -f Makefile test-clevis-loop-should-fail - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -95,7 +95,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d1dfaa548a..4f054d558f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,10 +34,10 @@ jobs: matrix: include: - task: make -f Makefile fmt-travis - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: rustfmt - task: make -f Makefile check-typos - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -74,7 +74,7 @@ jobs: TANG_URL=tang RUST_LOG=stratisd=debug make -f Makefile test-clevis-loop - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo image: fedora:38 # CURRENT DEVELOPMENT ENVIRONMENT runs-on: ubuntu-22.04 @@ -208,7 +208,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Run stratisd-min cli tests run: make test-stratisd-min - name: Run stratis-min cli tests @@ -260,7 +260,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Check out ci repo run: git clone https://github.com/stratis-storage/ci.git - name: Run ${{ matrix.task }} @@ -295,7 +295,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 7927fd3082..740db7abfb 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -33,7 +33,7 @@ jobs: matrix: include: # MANDATORY CHECKS USING CURRENT DEVELOPMENT ENVIRONMENT - - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + - toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN # MANDATORY CHECKS USING LOWEST SUPPORTED ENVIRONMENT PROXY - toolchain: 1.69.0 # LOWEST SUPPORTED RUST TOOLCHAIN runs-on: ubuntu-22.04 @@ -134,7 +134,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Build stratisd run: PROFILEDIR=debug make -f Makefile build-all - name: Install stratisd diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 4333c246bc..2821de7630 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -34,28 +34,28 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-travis - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -93,7 +93,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.70.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.71.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: From 39fbe04ad27b6f9170361939cacc7709212c77be Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 24 Jul 2023 16:46:29 +0200 Subject: [PATCH 25/33] README: update IRC network Signed-off-by: Jelle van der Waa --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c1ab2fdba..6cbc2aaee3 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Development mailing list: stratis-devel@lists.fedorahosted.org, -- subscribe #### IRC -irc.freenode.net #stratis-storage. +irc.libera.chat #stratis-storage. ## For Developers From 81d5388f8e4d38a234eb8ba60e4d4c8f2d8c8358 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Tue, 11 Jul 2023 12:07:40 -0400 Subject: [PATCH 26/33] Bug fix for liminal device code The path where starting pools automatically if the metadata indicates that they should be started did not correctly handle placing the partially stopped pool in the designated part of liminal devices. --- src/engine/strat_engine/liminal/liminal.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs index 9402a6d453..e50a6ce630 100644 --- a/src/engine/strat_engine/liminal/liminal.rs +++ b/src/engine/strat_engine/liminal/liminal.rs @@ -669,9 +669,7 @@ impl LiminalDevices { Err((err, bdas)) => { info!("Attempt to set up pool failed, but it may be possible to set up the pool later, if the situation changes: {}", err); let device_set = reconstruct_stratis_infos(infos, bdas); - if !device_set.is_empty() { - self.stopped_pools.insert(pool_uuid, device_set); - } + self.handle_stopped_pool(pool_uuid, device_set); None } } From 0e680fbbf089f2f86e5d2ddfbd87d46aa0986d00 Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 20 Jul 2023 15:34:17 -0400 Subject: [PATCH 27/33] Add some comments to StopAction Signed-off-by: mulhern --- src/engine/types/actions.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/types/actions.rs b/src/engine/types/actions.rs index 42dbfe00ee..5df5cd258e 100644 --- a/src/engine/types/actions.rs +++ b/src/engine/types/actions.rs @@ -676,7 +676,9 @@ impl EngineAction for StartAction { /// Action indicating an operation for stopped a resource pub enum StopAction { + /// Was already stopped, so there was nothing to do. Identity, + /// Stopped and all devices torn down. Stopped(T), } From 78ffb1461e114dff54548735c61cf4f513313712 Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 20 Jul 2023 15:45:58 -0400 Subject: [PATCH 28/33] Add Partial to the constructors for StopActions Signed-off-by: mulhern --- src/dbus_api/api/manager_3_2/methods.rs | 2 +- src/engine/types/actions.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dbus_api/api/manager_3_2/methods.rs b/src/dbus_api/api/manager_3_2/methods.rs index a341e48c13..065d994331 100644 --- a/src/dbus_api/api/manager_3_2/methods.rs +++ b/src/dbus_api/api/manager_3_2/methods.rs @@ -170,7 +170,7 @@ where .unwrap_or(false); let msg = match handle_action!(block_on(dbus_context.engine.stop_pool(pool_uuid))) { - Ok(StopAction::Stopped(_)) => { + Ok(StopAction::Stopped(_) | StopAction::Partial(_)) => { dbus_context.push_remove(&pool_path, consts::pool_interface_list()); if send_locked_signal { dbus_context.push_locked_pools(block_on(dbus_context.engine.locked_pools())); diff --git a/src/engine/types/actions.rs b/src/engine/types/actions.rs index 5df5cd258e..d8e68d4574 100644 --- a/src/engine/types/actions.rs +++ b/src/engine/types/actions.rs @@ -680,6 +680,8 @@ pub enum StopAction { Identity, /// Stopped and all devices torn down. Stopped(T), + /// Stopped, but some devices not torn down. + Partial(T), } impl Display for StopAction { @@ -692,6 +694,9 @@ impl Display for StopAction { StopAction::Stopped(uuid) => { write!(f, "The pool with UUID {uuid} was successfully stopped") } + StopAction::Partial(uuid) => { + write!(f, "The pool with UUID {uuid} was stopped, but some component devices could not be removed") + } } } } From a5f9a9f060cd8e930cbb802295ca8a41308efcbd Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 20 Jul 2023 15:58:55 -0400 Subject: [PATCH 29/33] LiminalDevices::stop_pool() returns a bool Signed-off-by: mulhern --- src/engine/strat_engine/liminal/liminal.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs index e50a6ce630..42fc1568ff 100644 --- a/src/engine/strat_engine/liminal/liminal.rs +++ b/src/engine/strat_engine/liminal/liminal.rs @@ -241,13 +241,16 @@ impl LiminalDevices { /// Stop a pool, tear down the devicemapper devices, and store the pool information /// in an internal data structure for later starting. + /// Returns true if the pool was torn down entirely, false if the pool is + /// partially up. Returns an error if the pool has some untorndown + /// filesystems, as in that case the pool needs to be administered. pub fn stop_pool( &mut self, pools: &mut Table, pool_name: Name, pool_uuid: PoolUuid, mut pool: StratPool, - ) -> StratisResult<()> { + ) -> StratisResult { let (devices, err) = match pool.stop(&pool_name, pool_uuid) { Ok(devs) => (devs, None), Err((e, true)) => { @@ -292,11 +295,7 @@ impl LiminalDevices { self.name_to_uuid .insert(pool_name.clone(), UuidOrConflict::Uuid(pool_uuid)); } - if let Some(e) = err { - Err(e) - } else { - Ok(()) - } + Ok(err.is_none()) } /// Get a mapping of pool UUIDs from all of the LUKS2 devices that are currently From b5bc9d6ce3bfe5eaa3595226c45a1f39ff7580b5 Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 20 Jul 2023 16:01:56 -0400 Subject: [PATCH 30/33] Use stop_pool return value to decide StopAction Signed-off-by: mulhern --- src/engine/strat_engine/engine.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/engine/strat_engine/engine.rs b/src/engine/strat_engine/engine.rs index 215786230a..24a9a31dbc 100644 --- a/src/engine/strat_engine/engine.rs +++ b/src/engine/strat_engine/engine.rs @@ -660,11 +660,16 @@ impl Engine for StratEngine { async fn stop_pool(&self, pool_uuid: PoolUuid) -> StratisResult> { let mut pools = self.pools.write_all().await; if let Some((name, pool)) = pools.remove_by_uuid(pool_uuid) { - self.liminal_devices + if self + .liminal_devices .write() .await - .stop_pool(&mut pools, name, pool_uuid, pool)?; - return Ok(StopAction::Stopped(pool_uuid)); + .stop_pool(&mut pools, name, pool_uuid, pool)? + { + return Ok(StopAction::Stopped(pool_uuid)); + } else { + return Ok(StopAction::Partial(pool_uuid)); + } } drop(pools); From 4a8b27855e258fe797594ecc25038eb10d2543fb Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 20 Jul 2023 16:48:20 -0400 Subject: [PATCH 31/33] Revert to returning an error if pool was partially stopped Signed-off-by: mulhern --- src/dbus_api/api/manager_3_2/methods.rs | 34 +++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/dbus_api/api/manager_3_2/methods.rs b/src/dbus_api/api/manager_3_2/methods.rs index 065d994331..a80096f506 100644 --- a/src/dbus_api/api/manager_3_2/methods.rs +++ b/src/dbus_api/api/manager_3_2/methods.rs @@ -169,27 +169,35 @@ where }) .unwrap_or(false); - let msg = match handle_action!(block_on(dbus_context.engine.stop_pool(pool_uuid))) { - Ok(StopAction::Stopped(_) | StopAction::Partial(_)) => { - dbus_context.push_remove(&pool_path, consts::pool_interface_list()); - if send_locked_signal { - dbus_context.push_locked_pools(block_on(dbus_context.engine.locked_pools())); - } - dbus_context.push_stopped_pools(block_on(dbus_context.engine.stopped_pools())); - return_message.append3( - (true, uuid_to_string!(pool_uuid)), - DbusErrorEnum::OK as u16, - OK_STRING.to_string(), - ) + let action = handle_action!(block_on(dbus_context.engine.stop_pool(pool_uuid))); + + if let Ok(StopAction::Stopped(_) | StopAction::Partial(_)) = action { + dbus_context.push_remove(&pool_path, consts::pool_interface_list()); + if send_locked_signal { + dbus_context.push_locked_pools(block_on(dbus_context.engine.locked_pools())); } + dbus_context.push_stopped_pools(block_on(dbus_context.engine.stopped_pools())); + } + + let msg = match action { + Ok(StopAction::Stopped(_)) => return_message.append3( + (true, uuid_to_string!(pool_uuid)), + DbusErrorEnum::OK as u16, + OK_STRING.to_string(), + ), Ok(StopAction::Identity) => return_message.append3( default_return, DbusErrorEnum::OK as u16, OK_STRING.to_string(), ), + Ok(StopAction::Partial(_)) => { + let error_message = "Pool was stopped, but some component devices were not torn down"; + let (rc, rs) = (DbusErrorEnum::ERROR as u16, error_message); + return_message.append3(default_return, rc, rs) + } Err(e) => { let (rc, rs) = engine_to_dbus_err_tuple(&e); - return Ok(vec![return_message.append3(default_return, rc, rs)]); + return_message.append3(default_return, rc, rs) } }; From f7c12869a7dfa3754b799086c62482cff754fdac Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 25 Jul 2023 13:56:29 -0400 Subject: [PATCH 32/33] Run "cargo update" Increase itertools dependency lower bound to 0.11.0. Signed-off-by: mulhern --- Cargo.lock | 320 +++++++++++++++++++++++++++++------------------------ Cargo.toml | 2 +- 2 files changed, 179 insertions(+), 143 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c2aa61c96c..2243b662e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aho-corasick" version = "1.0.2" @@ -43,15 +58,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -77,9 +92,9 @@ dependencies = [ [[package]] name = "assert_cmd" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d6b683edf8d1119fe420a94f8a7e389239666aa72e65495d91c00462510151" +checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" dependencies = [ "anstyle", "bstr", @@ -98,13 +113,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -113,13 +128,28 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "bindgen" version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -154,6 +184,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "block-buffer" version = "0.10.4" @@ -165,12 +201,11 @@ dependencies = [ [[package]] name = "bstr" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "once_cell", "regex-automata", "serde", ] @@ -239,22 +274,21 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.2" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.1" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] @@ -279,9 +313,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -345,7 +379,7 @@ version = "0.33.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75a9fd602a98d192f7662a1f4c4cf6920a1b454c3a9e724f6490cf8e30910114" dependencies = [ - "bitflags", + "bitflags 1.3.2", "devicemapper-sys", "env_logger", "lazy_static", @@ -391,9 +425,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "env_logger" @@ -442,12 +476,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "float-cmp" @@ -520,7 +551,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -575,25 +606,22 @@ dependencies = [ ] [[package]] -name = "glob" -version = "0.3.1" +name = "gimli" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "glob" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "humantime" @@ -603,9 +631,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -624,26 +652,6 @@ dependencies = [ "cc", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys", -] - [[package]] name = "iocuddle" version = "0.1.1" @@ -652,12 +660,11 @@ checksum = "d8972d5be69940353d5347a1344cb375d9b457d6809b428b05bb1ca2fb9ce007" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", + "hermit-abi", "rustix", "windows-sys", ] @@ -682,15 +689,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -731,9 +738,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libcryptsetup-rs" @@ -741,7 +748,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54de25d80cf59c099a01fc9939251bbf8021c131adf97beb7d57c094b16ed474" dependencies = [ - "bitflags", + "bitflags 1.3.2", "either", "lazy_static", "libc", @@ -822,15 +829,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "loopdev" @@ -863,6 +870,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.8" @@ -880,7 +896,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cc", "cfg-if 0.1.10", "libc", @@ -893,7 +909,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libc", "memoffset", @@ -919,9 +935,9 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm", @@ -929,14 +945,23 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -951,9 +976,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -1012,9 +1037,9 @@ checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -1026,7 +1051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", @@ -1047,9 +1072,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -1099,25 +1124,31 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.8.4" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.2", + "regex-automata", + "regex-syntax 0.7.4", ] [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] [[package]] name = "regex-syntax" @@ -1127,9 +1158,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "retry" @@ -1150,6 +1181,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -1158,13 +1195,12 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.37.19" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ - "bitflags", + "bitflags 2.3.3", "errno 0.3.1", - "io-lifetimes", "libc", "linux-raw-sys", "windows-sys", @@ -1184,38 +1220,38 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -1224,9 +1260,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -1349,9 +1385,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", @@ -1360,11 +1396,10 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ - "autocfg", "cfg-if 1.0.0", "fastrand", "redox_syscall", @@ -1389,11 +1424,12 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "tokio" -version = "1.28.2" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "libc", "mio", "num_cpus", @@ -1412,7 +1448,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -1429,9 +1465,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "utf8parse" @@ -1441,9 +1477,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom", "serde", @@ -1478,9 +1514,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -1488,24 +1524,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1513,22 +1549,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "winapi" @@ -1581,9 +1617,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", diff --git a/Cargo.toml b/Cargo.toml index 59e486e816..af0bea58db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,7 +127,7 @@ version = "0.3.0" optional = true [dependencies.libc] -version = "0.2.144" +version = "0.2.147" optional = true [dependencies.libcryptsetup-rs] From 83d2af00b1ab563c1864193e4cedc65774aa66e1 Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 25 Jul 2023 15:34:50 -0400 Subject: [PATCH 33/33] version 3.5.8 Signed-off-by: mulhern --- CHANGES.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9c6b95ee36..817582835f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,46 @@ +stratisd 3.5.8 +============== +Recommended Rust toolchain version: 1.71.0 +Lowest supported Rust toolchain version: 1.69.0 + +Recommended development platform for Python development: Fedora 38 + +- Run "cargo update" + +- Cherry-picked commits: + * Revert to returning an error if pool was partially stopped + * Use stop_pool return value to decide StopAction + * LiminalDevices::stop_pool() returns a bool + * Add Partial to the constructors for StopActions + * Add some comments to StopAction + * Bug fix for liminal device code + * README: update IRC network + * github actions: update recommended Rust to 1.71.0 + * Remove dm::stop_partially_constructed_pool + * Fix bug in partially unlocked pool setup + * Increase itertools dependency lower bound to 0.11.0 + * Fix manual_next_back lint error + * Start running startup test again, slightly modified + * Remove tests target + * Use enriched return value in test + * Remove code for handling only pool size change + * Send blockdev and pool change signal on grow physical + * Do not send out signal on UserInfo change before r3 + * No longer ignore RUSTSEC-2021-0145 in audit target + * Specify revision 0 blockdev interface for UserInfo signal + * Specify blockdev interfaces for blockdev UserInfo + * formatting + * remove plymouth remnants + * dracut: remove dependency on plymouth + * Add comment to DM version check in setup_dm() + * Increase devicemapper dependency lower bound to 0.33.5 + * Require udev support in container stratis-min-cli checks in GitHub Actions + * Update lowest supported Rust to 1.69.0 + * Improve error message for unlock check + * Do not use undefined matrix field "toolchain" in GitHub Action + * Fix a source code typo in a test method + + stratisd 3.5.7 ============== Recommended Rust toolchain version: 1.70.0 diff --git a/Cargo.lock b/Cargo.lock index 2243b662e7..3cd26958ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1311,7 +1311,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stratisd" -version = "3.5.7" +version = "3.5.8" dependencies = [ "assert_cmd", "assert_matches", diff --git a/Cargo.toml b/Cargo.toml index af0bea58db..a5d379cff8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stratisd" -version = "3.5.7" +version = "3.5.8" authors = ["Stratis Developers "] edition = "2021" rust-version = "1.69.0" # LOWEST SUPPORTED RUST TOOLCHAIN