From f231357bc5f2fdacaef1beedab9950b6c1b1d794 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Mon, 13 Nov 2023 17:46:23 -0500 Subject: [PATCH 01/26] Update to nix 0.27.1 --- Cargo.lock | 25 +++++++++++++++++++-- Cargo.toml | 3 ++- src/engine/shared.rs | 4 ++-- src/engine/strat_engine/tests/loopbacked.rs | 7 +----- src/jsonrpc/server/server.rs | 17 +++++++------- src/stratis/udev_monitor.rs | 10 ++++----- 6 files changed, 42 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1406bc0aea..4f62fbe849 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -861,6 +861,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -900,11 +909,23 @@ dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", "libc", - "memoffset", + "memoffset 0.7.1", "pin-utils", "static_assertions", ] +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.0", + "cfg-if 1.0.0", + "libc", + "memoffset 0.9.0", +] + [[package]] name = "nom" version = "7.1.3" @@ -1297,7 +1318,7 @@ dependencies = [ "libudev", "log", "loopdev", - "nix 0.26.2", + "nix 0.27.1", "pkg-config", "predicates", "pretty-hex", diff --git a/Cargo.toml b/Cargo.toml index 57ac93887c..e3eab05b83 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -155,8 +155,9 @@ version = "0.4.19" optional = true [dependencies.nix] -version = "0.26.0" +version = "0.27.1" optional = true +features = ["fs", "ioctl", "mount", "poll", "process", "sched", "signal", "socket"] [dependencies.pretty-hex] version = "0.3.0" diff --git a/src/engine/shared.rs b/src/engine/shared.rs index 10be45abfa..c52686393c 100644 --- a/src/engine/shared.rs +++ b/src/engine/shared.rs @@ -6,7 +6,7 @@ use std::{ collections::{hash_map::RandomState, HashMap, HashSet}, fs::File, io::Read, - os::unix::io::{AsRawFd, FromRawFd, RawFd}, + os::unix::io::{FromRawFd, RawFd}, path::{Path, PathBuf}, }; @@ -118,7 +118,7 @@ pub fn set_key_shared(key_fd: RawFd, memory: &mut [u8]) -> StratisResult let bytes_read = key_file.read(memory)?; if bytes_read == MAX_STRATIS_PASS_SIZE { - let mut pollers = [PollFd::new(key_file.as_raw_fd(), PollFlags::POLLIN)]; + let mut pollers = [PollFd::new(&key_file, PollFlags::POLLIN)]; let num_events = poll(&mut pollers, 0)?; if num_events > 0 { return Err(StratisError::Msg(format!( diff --git a/src/engine/strat_engine/tests/loopbacked.rs b/src/engine/strat_engine/tests/loopbacked.rs index 6070134846..ae6229874e 100644 --- a/src/engine/strat_engine/tests/loopbacked.rs +++ b/src/engine/strat_engine/tests/loopbacked.rs @@ -6,7 +6,6 @@ use std::{ env, fs::{File, OpenOptions}, mem::forget, - os::unix::io::AsRawFd, panic, path::{Path, PathBuf}, sync::Once, @@ -58,11 +57,7 @@ impl LoopTestDev { .open(path) .unwrap(); - nix::unistd::ftruncate( - f.as_raw_fd(), - convert_test!(*size.bytes(), u128, nix::libc::off_t), - ) - .unwrap(); + nix::unistd::ftruncate(&f, convert_test!(*size.bytes(), u128, nix::libc::off_t)).unwrap(); f.sync_all().unwrap(); let ld = lc.next_free().unwrap(); diff --git a/src/jsonrpc/server/server.rs b/src/jsonrpc/server/server.rs index c0f4c89085..c13ff90f90 100644 --- a/src/jsonrpc/server/server.rs +++ b/src/jsonrpc/server/server.rs @@ -8,7 +8,7 @@ use std::{ fs::{create_dir_all, remove_file}, future::Future, io::{IoSlice, IoSliceMut}, - os::unix::io::{AsRawFd, RawFd}, + os::unix::io::{AsRawFd, OwnedFd, RawFd}, path::Path, pin::Pin, sync::Arc, @@ -418,7 +418,7 @@ impl Future for StratisUnixResponse { } pub struct StratisUnixListener { - fd: AsyncFd, + fd: AsyncFd, } impl StratisUnixListener { @@ -438,12 +438,13 @@ impl StratisUnixListener { SockFlag::empty(), None, )?; - let flags = OFlag::from_bits(fcntl(fd, FcntlArg::F_GETFL)?).ok_or_else(|| { - StratisError::Msg("Unrecognized flag types returned from fcntl".to_string()) - })?; - fcntl(fd, FcntlArg::F_SETFL(flags | OFlag::O_NONBLOCK))?; - bind(fd, &UnixAddr::new(path.as_ref())?)?; - listen(fd, 0)?; + let flags = + OFlag::from_bits(fcntl(fd.as_raw_fd(), FcntlArg::F_GETFL)?).ok_or_else(|| { + StratisError::Msg("Unrecognized flag types returned from fcntl".to_string()) + })?; + fcntl(fd.as_raw_fd(), FcntlArg::F_SETFL(flags | OFlag::O_NONBLOCK))?; + bind(fd.as_raw_fd(), &UnixAddr::new(path.as_ref())?)?; + listen(&fd, 0)?; Ok(StratisUnixListener { fd: AsyncFd::new(fd)?, }) diff --git a/src/stratis/udev_monitor.rs b/src/stratis/udev_monitor.rs index 4d29cf0837..a840e9631e 100644 --- a/src/stratis/udev_monitor.rs +++ b/src/stratis/udev_monitor.rs @@ -4,7 +4,7 @@ //! Support for monitoring udev events. -use std::os::unix::io::{AsRawFd, RawFd}; +use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd}; use libudev::Event; use nix::poll::{poll, PollFd, PollFlags}; @@ -32,8 +32,8 @@ pub async fn udev_thread( let mut udev = UdevMonitor::create(&context)?; - let mut pollers = [PollFd::new(udev.as_raw_fd(), PollFlags::POLLIN)]; loop { + let mut pollers = [PollFd::new(&udev, PollFlags::POLLIN)]; match poll(&mut pollers, 100)? { 0 => { match should_exit.try_recv() { @@ -88,8 +88,8 @@ impl UdevMonitor { } } -impl AsRawFd for UdevMonitor { - fn as_raw_fd(&self) -> RawFd { - self.socket.as_raw_fd() +impl AsFd for UdevMonitor { + fn as_fd(&self) -> BorrowedFd<'_> { + unsafe { BorrowedFd::borrow_raw(self.socket.as_raw_fd()) } } } From 4a47dcf32abc972e342ed6f0bd753d256a3f2a91 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Thu, 2 Nov 2023 17:05:15 -0400 Subject: [PATCH 02/26] github actions: update FEDORA_RELEASE to F39, F38 Signed-off-by: Bryan Gurney --- .github/workflows/cargo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 2d55b06a7a..0551df4920 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -58,5 +58,5 @@ jobs: # yamllint disable rule:line-length run: | COMPARE_FEDORA_VERSIONS=./ci/dependency_management/compare_fedora_versions FEDORA_RELEASE=rawhide IGNORE_ARGS="--ignore-category low --ignore-high=libcryptsetup-rs --ignore-high=libcryptsetup-rs-sys --ignore-high=devicemapper" make -f Makefile_dependencies check-fedora-versions + COMPARE_FEDORA_VERSIONS=./ci/dependency_management/compare_fedora_versions FEDORA_RELEASE=f39 IGNORE_ARGS="--ignore-category low --ignore-high=libcryptsetup-rs --ignore-high=libcryptsetup-rs-sys --ignore-high=devicemapper" make -f Makefile_dependencies check-fedora-versions COMPARE_FEDORA_VERSIONS=./ci/dependency_management/compare_fedora_versions FEDORA_RELEASE=f38 IGNORE_ARGS="--ignore-category low --ignore-high=libcryptsetup-rs --ignore-high=libcryptsetup-rs-sys --ignore-high=devicemapper" make -f Makefile_dependencies check-fedora-versions - COMPARE_FEDORA_VERSIONS=./ci/dependency_management/compare_fedora_versions FEDORA_RELEASE=f37 IGNORE_ARGS="--ignore-category low --ignore-high=libcryptsetup-rs --ignore-high=libcryptsetup-rs-sys --ignore-high=devicemapper" make -f Makefile_dependencies check-fedora-versions From 8f9996400af78d70b9c18482538c594bd151bc76 Mon Sep 17 00:00:00 2001 From: mulhern Date: Sun, 3 Dec 2023 21:28:38 -0500 Subject: [PATCH 03/26] Parameterize /usr/libexec everywhere This step was done partially in a prior PR, this just completes that. See: https://github.com/stratis-storage/stratisd/pull/3064 Signed-off-by: mulhern --- Makefile | 4 ++-- dracut/90stratis/{module-setup.sh => module-setup.sh.in} | 4 ++-- .../{stratisd-min.service => stratisd-min.service.in} | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename dracut/90stratis/{module-setup.sh => module-setup.sh.in} (94%) rename dracut/90stratis/{stratisd-min.service => stratisd-min.service.in} (82%) diff --git a/Makefile b/Makefile index a9f4d05510..2e257b7830 100644 --- a/Makefile +++ b/Makefile @@ -294,9 +294,9 @@ install-dbus-cfg: install-dracut-cfg: mkdir -p $(DESTDIR)$(DRACUTDIR)/modules.d $(INSTALL) -Dpm0755 -d $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis - $(INSTALL) -Dpm0755 -t $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis dracut/90stratis/module-setup.sh + sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/stratisd-min.service.in > $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/stratisd-min.service + sed 's|@LIBEXECDIR@|$(LIBEXECDIR)|' dracut/90stratis/module-setup.sh.in > $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis/module-setup.sh $(INSTALL) -Dpm0755 -t $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis dracut/90stratis/stratis-rootfs-setup - $(INSTALL) -Dpm0644 -t $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis dracut/90stratis/stratisd-min.service $(INSTALL) -Dpm0644 -t $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis dracut/90stratis/61-stratisd.rules $(INSTALL) -Dpm0755 -d $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis-clevis $(INSTALL) -Dpm0755 -t $(DESTDIR)$(DRACUTDIR)/modules.d/90stratis-clevis dracut/90stratis-clevis/module-setup.sh diff --git a/dracut/90stratis/module-setup.sh b/dracut/90stratis/module-setup.sh.in similarity index 94% rename from dracut/90stratis/module-setup.sh rename to dracut/90stratis/module-setup.sh.in index ac1ea37194..898709285f 100755 --- a/dracut/90stratis/module-setup.sh +++ b/dracut/90stratis/module-setup.sh.in @@ -3,7 +3,7 @@ # called by dracut check() { require_binaries stratis-min \ - /usr/libexec/stratisd-min \ + @LIBEXECDIR@/stratisd-min \ $systemdutildir/system-generators/stratis-setup-generator \ thin_check \ thin_repair \ @@ -34,7 +34,7 @@ installkernel() { install() { # Stratis dependencies inst_multiple stratis-min \ - /usr/libexec/stratisd-min \ + @LIBEXECDIR@/stratisd-min \ thin_check \ thin_repair \ mkfs.xfs \ diff --git a/dracut/90stratis/stratisd-min.service b/dracut/90stratis/stratisd-min.service.in similarity index 82% rename from dracut/90stratis/stratisd-min.service rename to dracut/90stratis/stratisd-min.service.in index 1a0b8d2892..0aa0a5f477 100644 --- a/dracut/90stratis/stratisd-min.service +++ b/dracut/90stratis/stratisd-min.service.in @@ -8,7 +8,7 @@ After=sysinit.target Type=notify Environment="RUST_BACKTRACE=1" ExecStartPre=-mkdir -p /run/cryptsetup -ExecStart=/usr/libexec/stratisd-min --log-level debug +ExecStart=@LIBEXECDIR@/stratisd-min --log-level debug KillSignal=SIGINT KillMode=process Restart=on-abort From f24b3e11002e142e6dea12e710a293679bd3b0cf Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Wed, 13 Dec 2023 11:59:50 -0500 Subject: [PATCH 04/26] github actions: update recommended Rust to 1.74.1 Signed-off-by: Bryan Gurney --- .github/workflows/cargo.yml | 2 +- .github/workflows/fedora.yml | 24 ++++++++++++------------ .github/workflows/main.yml | 10 +++++----- .github/workflows/ubuntu.yml | 22 +++++++++++----------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 0551df4920..87562af3ce 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.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # 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 99bc34ab7e..1519a03368 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -40,39 +40,39 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-no-ipc - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-ci - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: >- TANG_URL=localhost make -f Makefile test-clevis-loop-should-fail - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-no-ipc - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -107,7 +107,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # 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 392ae483a4..6fd56ab7c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,10 +40,10 @@ jobs: matrix: include: - task: make -f Makefile fmt-ci - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: rustfmt - task: make -f Makefile check-typos - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -83,7 +83,7 @@ jobs: TANG_URL=tang RUST_LOG=stratisd=debug make -f Makefile test-clevis-loop - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT runs-on: ubuntu-22.04 @@ -217,7 +217,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Run stratisd-min cli tests run: make test-stratisd-min - name: Run stratis-min cli tests @@ -267,7 +267,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # 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 20eacd3b44..7d74442626 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -40,34 +40,34 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-no-ipc - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-ci - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-no-ipc - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -105,7 +105,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.74.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: From f3a3d58573898108bd901aa0788885d879d06b7c Mon Sep 17 00:00:00 2001 From: mulhern Date: Tue, 26 Dec 2023 20:40:58 -0500 Subject: [PATCH 05/26] Increase itertools dependency lower bound to 0.12.0 Signed-off-by: mulhern --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f62fbe849..79e7cc7d88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -676,9 +676,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" dependencies = [ "either", ] @@ -1308,7 +1308,7 @@ dependencies = [ "env_logger", "futures", "iocuddle", - "itertools 0.11.0", + "itertools 0.12.0", "lazy_static", "libblkid-rs", "libc", diff --git a/Cargo.toml b/Cargo.toml index e3eab05b83..3a362fb2b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -118,7 +118,7 @@ version = "0.1.0" optional = true [dependencies.itertools] -version = "0.11.0" +version = "0.12.0" optional = true [dependencies.lazy_static] From c5f6b06cbf971ac06d4bbfe6becfe8d6d1dbafa1 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Tue, 2 Jan 2024 10:10:52 -0500 Subject: [PATCH 06/26] Replace get(0) with first() Signed-off-by: Bryan Gurney --- src/engine/strat_engine/backstore/backstore.rs | 4 ++-- src/engine/strat_engine/backstore/blockdevmgr.rs | 4 ++-- src/engine/strat_engine/backstore/crypt/mod.rs | 8 ++++---- src/engine/strat_engine/liminal/liminal.rs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/engine/strat_engine/backstore/backstore.rs b/src/engine/strat_engine/backstore/backstore.rs index eaa802713b..29b311c56c 100644 --- a/src/engine/strat_engine/backstore/backstore.rs +++ b/src/engine/strat_engine/backstore/backstore.rs @@ -736,7 +736,7 @@ impl Backstore { if (existing_pin.as_str(), &config_to_check) == (pin, &parsed_config) && CryptHandle::can_unlock( self.blockdevs() - .get(0) + .first() .expect("Must have at least one blockdev") .2 .physical_path(), @@ -810,7 +810,7 @@ impl Backstore { if kd == key_desc { if CryptHandle::can_unlock( self.blockdevs() - .get(0) + .first() .expect("Must have at least one blockdev") .2 .physical_path(), diff --git a/src/engine/strat_engine/backstore/blockdevmgr.rs b/src/engine/strat_engine/backstore/blockdevmgr.rs index ce38284d32..489c6a2ef1 100644 --- a/src/engine/strat_engine/backstore/blockdevmgr.rs +++ b/src/engine/strat_engine/backstore/blockdevmgr.rs @@ -107,7 +107,7 @@ impl BlockDevMgr { devices: UnownedDevices, sector_size: Option, ) -> StratisResult> { - let this_pool_uuid = self.block_devs.get(0).map(|bd| bd.pool_uuid()); + let this_pool_uuid = self.block_devs.first().map(|bd| bd.pool_uuid()); if this_pool_uuid.is_some() && this_pool_uuid != Some(pool_uuid) { return Err(StratisError::Msg( format!("block devices being managed have pool UUID {} but new devices are to be added with pool UUID {}", @@ -120,7 +120,7 @@ impl BlockDevMgr { if let Some(ref ei) = encryption_info { if !CryptHandle::can_unlock( self.block_devs - .get(0) + .first() .expect("Must have at least one blockdev") .physical_path(), ei.key_description().is_some(), diff --git a/src/engine/strat_engine/backstore/crypt/mod.rs b/src/engine/strat_engine/backstore/crypt/mod.rs index 69443f91f6..19c81e4537 100644 --- a/src/engine/strat_engine/backstore/crypt/mod.rs +++ b/src/engine/strat_engine/backstore/crypt/mod.rs @@ -59,7 +59,7 @@ mod tests { fn test_failed_init(paths: &[&Path]) { assert_eq!(paths.len(), 1); - let path = paths.get(0).expect("There must be exactly one path"); + let path = paths.first().expect("There must be exactly one path"); let key_description = KeyDescription::try_from("I am not a key".to_string()).expect("no semi-colons"); @@ -185,7 +185,7 @@ mod tests { fn test_crypt_device_ops(paths: &[&Path]) { fn crypt_test(paths: &[&Path], key_desc: &KeyDescription) { let path = paths - .get(0) + .first() .expect("This test only accepts a single device"); let pool_uuid = PoolUuid::new_v4(); @@ -357,7 +357,7 @@ mod tests { fn both_initialize(paths: &[&Path], key_desc: &KeyDescription) { unshare_mount_namespace().unwrap(); let _memfs = MemoryFilesystem::new().unwrap(); - let path = paths.get(0).copied().expect("Expected exactly one path"); + let path = paths.first().copied().expect("Expected exactly one path"); let pool_name = Name::new("pool_name".to_string()); let handle = CryptHandle::initialize( path, @@ -384,7 +384,7 @@ mod tests { } fn unlock_clevis(paths: &[&Path]) { - let path = paths.get(0).copied().expect("Expected exactly one path"); + let path = paths.first().copied().expect("Expected exactly one path"); CryptHandle::setup(path, Some(UnlockMethod::Clevis)) .unwrap() .unwrap(); diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs index 5599881072..650d675fbf 100644 --- a/src/engine/strat_engine/liminal/liminal.rs +++ b/src/engine/strat_engine/liminal/liminal.rs @@ -1015,7 +1015,7 @@ fn setup_pool( Ok((datadevs, cachedevs)) => (datadevs, cachedevs), }; - if datadevs.get(0).is_none() { + if datadevs.first().is_none() { return Err(( StratisError::Msg(format!( "There do not appear to be any data devices in the set with pool UUID {pool_uuid}" From 4607defb20e9a0d2a7f35dc135357299dd10af8d Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Tue, 2 Jan 2024 10:55:13 -0500 Subject: [PATCH 07/26] Remove unused imports Signed-off-by: Bryan Gurney --- src/engine/strat_engine/backstore/mod.rs | 2 +- src/engine/strat_engine/liminal/mod.rs | 6 +----- src/engine/strat_engine/metadata/sizes.rs | 2 +- src/engine/strat_engine/tests/mod.rs | 2 +- src/engine/strat_engine/thinpool/mod.rs | 2 +- src/engine/types/mod.rs | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/engine/strat_engine/backstore/mod.rs b/src/engine/strat_engine/backstore/mod.rs index b88af56959..8828125b80 100644 --- a/src/engine/strat_engine/backstore/mod.rs +++ b/src/engine/strat_engine/backstore/mod.rs @@ -16,7 +16,7 @@ mod transaction; pub use self::{ backstore::Backstore, - blockdev::{StratBlockDev, StratSectorSizes, UnderlyingDevice}, + blockdev::{StratBlockDev, UnderlyingDevice}, crypt::{ crypt_metadata_size, register_clevis_token, set_up_crypt_logging, CryptHandle, CLEVIS_TANG_TRUST_URL, diff --git a/src/engine/strat_engine/liminal/mod.rs b/src/engine/strat_engine/liminal/mod.rs index ef101767f9..11d3bef34e 100644 --- a/src/engine/strat_engine/liminal/mod.rs +++ b/src/engine/strat_engine/liminal/mod.rs @@ -8,8 +8,4 @@ mod identify; mod liminal; mod setup; -pub use self::{ - device_info::{DeviceSet, LInfo}, - identify::{find_all, DeviceInfo}, - liminal::LiminalDevices, -}; +pub use self::{device_info::DeviceSet, identify::find_all, liminal::LiminalDevices}; diff --git a/src/engine/strat_engine/metadata/sizes.rs b/src/engine/strat_engine/metadata/sizes.rs index cf57e6e280..843a30f746 100644 --- a/src/engine/strat_engine/metadata/sizes.rs +++ b/src/engine/strat_engine/metadata/sizes.rs @@ -6,7 +6,7 @@ pub use self::{ bda_size::{BDAExtendedSize, ReservedSize}, blkdev_size::BlockdevSize, mda_size::{MDADataSize, MDARegionSize, MDASize}, - static_header_size::{StaticHeaderSize, STATIC_HEADER_SIZE}, + static_header_size::STATIC_HEADER_SIZE, }; /// A module which defines constants and types related to static header sizes. diff --git a/src/engine/strat_engine/tests/mod.rs b/src/engine/strat_engine/tests/mod.rs index 7a31df905c..986a409a71 100644 --- a/src/engine/strat_engine/tests/mod.rs +++ b/src/engine/strat_engine/tests/mod.rs @@ -8,4 +8,4 @@ pub mod loopbacked; pub mod real; mod util; -pub use util::{dm_stratis_devices_remove, FailDevice}; +pub use util::FailDevice; diff --git a/src/engine/strat_engine/thinpool/mod.rs b/src/engine/strat_engine/thinpool/mod.rs index f76f79bf24..19eb834f4f 100644 --- a/src/engine/strat_engine/thinpool/mod.rs +++ b/src/engine/strat_engine/thinpool/mod.rs @@ -12,5 +12,5 @@ mod thinpool; pub use self::thinpool::ThinPoolStatusDigest; pub use self::{ filesystem::StratFilesystem, - thinpool::{ThinPool, ThinPoolSizeParams, ThinPoolState, DATA_BLOCK_SIZE}, + thinpool::{ThinPool, ThinPoolSizeParams, DATA_BLOCK_SIZE}, }; diff --git a/src/engine/types/mod.rs b/src/engine/types/mod.rs index 23e5031816..4fd9643511 100644 --- a/src/engine/types/mod.rs +++ b/src/engine/types/mod.rs @@ -19,7 +19,7 @@ use serde_json::Value; use uuid::Uuid; pub use crate::engine::{ - engine::{Engine, StateDiff}, + engine::StateDiff, structures::Lockable, types::{ actions::{ From 76ffec2a2477e89b59f22c59aa26dd93b493201a Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Tue, 2 Jan 2024 11:36:05 -0500 Subject: [PATCH 08/26] Move initialize_devices import to cfg(test) Clippy 1.75.0 is showing initialize_devices as an unused import, but it is used in a test in strat_engine/liminal/identify.rs. Signed-off-by: Bryan Gurney --- src/engine/strat_engine/backstore/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/engine/strat_engine/backstore/mod.rs b/src/engine/strat_engine/backstore/mod.rs index 8828125b80..89bf09e103 100644 --- a/src/engine/strat_engine/backstore/mod.rs +++ b/src/engine/strat_engine/backstore/mod.rs @@ -21,5 +21,8 @@ pub use self::{ crypt_metadata_size, register_clevis_token, set_up_crypt_logging, CryptHandle, CLEVIS_TANG_TRUST_URL, }, - devices::{find_stratis_devs_by_uuid, initialize_devices, ProcessedPathInfos, UnownedDevices}, + devices::{find_stratis_devs_by_uuid, ProcessedPathInfos, UnownedDevices}, }; + +#[cfg(test)] +pub use self::devices::initialize_devices; From da8bd6e861019a60cad6bb2c5a40856626e0ef59 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Tue, 2 Jan 2024 12:31:44 -0500 Subject: [PATCH 09/26] should_wake: replace get(0) with front() Signed-off-by: Bryan Gurney --- src/engine/structures/lock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/structures/lock.rs b/src/engine/structures/lock.rs index 6eded0d26e..7a63bf473e 100644 --- a/src/engine/structures/lock.rs +++ b/src/engine/structures/lock.rs @@ -371,7 +371,7 @@ where /// * The waiting task does not conflict with any already woken tasks. /// * The waiting task does not conflict with any locks currently held. fn should_wake(&self) -> bool { - if let Some(w) = self.waiting.get(0) { + if let Some(w) = self.waiting.front() { !self.conflicts_with_woken(&w.ty) && !self.already_acquired(&w.ty) } else { false From b4346d088340980516cc4b159e271de4a027fb49 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Wed, 3 Jan 2024 13:29:51 -0500 Subject: [PATCH 10/26] github actions: update recommended Rust to 1.75.0 Signed-off-by: Bryan Gurney --- .github/workflows/cargo.yml | 2 +- .github/workflows/fedora.yml | 24 ++++++++++++------------ .github/workflows/main.yml | 10 +++++----- .github/workflows/ubuntu.yml | 22 +++++++++++----------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 87562af3ce..2ed735901f 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.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.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 1519a03368..0ace1ee934 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -40,39 +40,39 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-no-ipc - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-ci - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: >- TANG_URL=localhost make -f Makefile test-clevis-loop-should-fail - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-no-ipc - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -107,7 +107,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.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 6fd56ab7c1..5d1295fd21 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,10 +40,10 @@ jobs: matrix: include: - task: make -f Makefile fmt-ci - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: rustfmt - task: make -f Makefile check-typos - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -83,7 +83,7 @@ jobs: TANG_URL=tang RUST_LOG=stratisd=debug make -f Makefile test-clevis-loop - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT runs-on: ubuntu-22.04 @@ -217,7 +217,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN - name: Run stratisd-min cli tests run: make test-stratisd-min - name: Run stratis-min cli tests @@ -267,7 +267,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: components: cargo - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.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 7d74442626..875f215f18 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -40,34 +40,34 @@ jobs: matrix: include: - task: make -f Makefile clippy - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: clippy - task: PROFILEDIR=debug make -f Makefile build - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-min - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile build-no-ipc - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-ci - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile test - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-min - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile build-no-ipc - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: @@ -105,7 +105,7 @@ jobs: matrix: include: - task: RUST_LOG=stratisd=debug make -f Makefile test-loop - toolchain: 1.74.1 # CURRENT DEVELOPMENT RUST TOOLCHAIN + toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo runs-on: ubuntu-22.04 container: From 45d602781757955d020d2227f0a74ae1c2b5a23d Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 3 Jan 2024 12:31:59 -0500 Subject: [PATCH 11/26] Fix up prediction tests to match new filesystem interface Signed-off-by: mulhern --- tests/client-dbus/tests/udev/test_predict.py | 25 +++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/client-dbus/tests/udev/test_predict.py b/tests/client-dbus/tests/udev/test_predict.py index be8227447a..87dab41b59 100644 --- a/tests/client-dbus/tests/udev/test_predict.py +++ b/tests/client-dbus/tests/udev/test_predict.py @@ -57,7 +57,7 @@ def _call_predict_usage(encrypted, device_sizes, *, fs_specs=None, overprovision :param device_sizes: list of sizes of devices for pool :type device_sizes: list of str :param fs_specs: list of filesystem specs - :type fs_specs: list of str * Range + :type fs_specs: list of str * (Range or NoneType) * (Range or NoneType) :param bool overprovision: whether it is allowed to overprovision the pool """ with subprocess.Popen( @@ -66,7 +66,11 @@ def _call_predict_usage(encrypted, device_sizes, *, fs_specs=None, overprovision + ( [] if fs_specs is None - else [f"--filesystem-size={size.magnitude}" for _, size in fs_specs] + else [ + f"--filesystem-size={size.magnitude}" + for _, size, _ in fs_specs + if size is not None + ] ) + (["--encrypted"] if encrypted else []) + ([] if overprovision else ["--no-overprovision"]), @@ -105,7 +109,7 @@ def _possibly_add_filesystems(pool_object_path, *, fs_specs=None): :param str pool_object_path: the D-Bus object path :param fs_specs: the filesystem specs - :type fs_specs: list of str * Range or NoneType + :type fs_specs: list of str * (Range or NoneType) * (Range or NoneType) :returns: the change in size of pool's TotalPhysicalUsed value :rtype: Range @@ -123,7 +127,16 @@ def _possibly_add_filesystems(pool_object_path, *, fs_specs=None): message, ) = Pool.Methods.CreateFilesystems( pool_proxy, - {"specs": map(lambda x: (x[0], (True, str(x[1].magnitude))), fs_specs)}, + { + "specs": map( + lambda x: ( + x[0], + (False, "") if x[1] is None else (True, str(x[1].magnitude)), + (False, "") if x[2] is None else (True, str(x[2].magnitude)), + ), + fs_specs, + ) + }, ) if return_code != 0: @@ -302,7 +315,7 @@ def test_prediction_filesystems(self): pool_name = random_string(5) create_pool(pool_name, devnodes) self.wait_for_pools(1) - self._test_prediction(pool_name, fs_specs=[("fs1", Range(1, TiB))]) + self._test_prediction(pool_name, fs_specs=[("fs1", Range(1, TiB), None)]) def test_prediction_no_overprov(self): """ @@ -317,5 +330,5 @@ def test_prediction_no_overprov(self): create_pool(pool_name, devnodes, overprovision=False) self.wait_for_pools(1) self._test_prediction( - pool_name, fs_specs=[("fs1", Range(2, GiB))], overprovision=False + pool_name, fs_specs=[("fs1", Range(2, GiB), None)], overprovision=False ) From 9aed65770df7713555f28ee2e1871de29cd94e0a Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 5 Jan 2024 21:40:19 -0500 Subject: [PATCH 12/26] Start running clippy on stratis-dumpmetadata Fix a few clippy errors that crept in. Signed-off-by: mulhern --- Makefile | 1 + src/bin/stratis-dumpmetadata.rs | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 2e257b7830..d0bb1d7806 100644 --- a/Makefile +++ b/Makefile @@ -458,6 +458,7 @@ clippy-macros: clippy-min: RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} ${MIN_FEATURES} -- ${CLIPPY_DENY} ${CLIPPY_PEDANTIC} ${CLIPPY_PEDANTIC_USELESS} RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} ${SYSTEMD_FEATURES} -- ${CLIPPY_DENY} ${CLIPPY_PEDANTIC} ${CLIPPY_PEDANTIC_USELESS} + RUSTFLAGS="${DENY}" cargo clippy ${CLIPPY_OPTS} ${EXTRAS_FEATURES} -- ${CLIPPY_DENY} ${CLIPPY_PEDANTIC} ${CLIPPY_PEDANTIC_USELESS} ## Run clippy on the udev utils clippy-udev-utils: diff --git a/src/bin/stratis-dumpmetadata.rs b/src/bin/stratis-dumpmetadata.rs index d34c446173..4bb29a728d 100644 --- a/src/bin/stratis-dumpmetadata.rs +++ b/src/bin/stratis-dumpmetadata.rs @@ -100,15 +100,13 @@ fn print_pool_metadata(pool_metadata: &Option>, only_pool: bool) -> Resu println!("\nPool metadata:"); } if let Some(loaded_state) = pool_metadata { - let state_json: Value = serde_json::from_slice(&loaded_state) + let state_json: Value = serde_json::from_slice(loaded_state) .map_err(|extract_err| format!("Error during state JSON extract: {}", extract_err))?; let state_json_pretty: String = serde_json::to_string_pretty(&state_json) .map_err(|parse_err| format!("Error during state JSON parse: {}", parse_err))?; println!("{}", state_json_pretty); - } else { - if !only_pool { - println!("None found"); - } + } else if !only_pool { + println!("None found"); } Ok(()) @@ -136,7 +134,7 @@ fn initialize_log() { fn run(devpath: &str, print_bytes: bool, pool_only: bool) -> Result<(), String> { let mut devfile = OpenOptions::new() .read(true) - .open(&devpath) + .open(devpath) .map_err(|the_io_error| format!("Error opening device: {}", the_io_error))?; let read_results = StaticHeader::read_sigblocks(&mut devfile); From c6629d5a5d54edf2bb9e42843747307a2829e671 Mon Sep 17 00:00:00 2001 From: mulhern Date: Sun, 7 Jan 2024 22:23:46 -0500 Subject: [PATCH 13/26] Remove unwrap() in stratis-dumpmetadata The unwrap() should always succeed; make it an expect. Signed-off-by: mulhern --- src/bin/stratis-dumpmetadata.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/stratis-dumpmetadata.rs b/src/bin/stratis-dumpmetadata.rs index 4bb29a728d..ea146bad46 100644 --- a/src/bin/stratis-dumpmetadata.rs +++ b/src/bin/stratis-dumpmetadata.rs @@ -195,7 +195,7 @@ fn main() { let devpath = matches .get_one::("dev") .map(|s| s.as_str()) - .unwrap(); + .expect("'dev' is a mandatory argument"); initialize_log(); From 3b4cba64d5bdc25a1aca48d1fbf7b1c399edfa4b Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 3 Jan 2024 23:47:47 -0500 Subject: [PATCH 14/26] Run thin_check in loud mode stratisd does not need to suppress output via -q option to thin_check because the cmd module captures stderr and stdout streams and only reads them if the command returns an error. Signed-off-by: mulhern --- src/engine/strat_engine/cmd.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/engine/strat_engine/cmd.rs b/src/engine/strat_engine/cmd.rs index 5a5e6241ae..91f8df7c2a 100644 --- a/src/engine/strat_engine/cmd.rs +++ b/src/engine/strat_engine/cmd.rs @@ -342,11 +342,7 @@ pub fn set_uuid(devnode: &Path, uuid: FilesystemUuid) -> StratisResult<()> { /// Call thin_check on a thinpool pub fn thin_check(devnode: &Path) -> StratisResult<()> { - execute_cmd( - Command::new(get_executable(THIN_CHECK).as_os_str()) - .arg("-q") - .arg(devnode), - ) + execute_cmd(Command::new(get_executable(THIN_CHECK).as_os_str()).arg(devnode)) } /// Call thin_repair on a thinpool From 13279d5cc1a930227735cd595dfe6a0172b0bd41 Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 3 Jan 2024 23:52:52 -0500 Subject: [PATCH 15/26] Do not pass -q option to xfs.mkfs stratisd captures stdout and stderr and will only report the output on a failure of the command. No need to make xfs.mkfs quiet via a command-line option. Signed-off-by: mulhern --- src/engine/strat_engine/cmd.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/engine/strat_engine/cmd.rs b/src/engine/strat_engine/cmd.rs index 91f8df7c2a..68ed6fa7fe 100644 --- a/src/engine/strat_engine/cmd.rs +++ b/src/engine/strat_engine/cmd.rs @@ -299,7 +299,6 @@ pub fn create_fs(devnode: &Path, uuid: Option) -> StratisResult<()> let mut command = Command::new(get_executable(MKFS_XFS).as_os_str()); command.arg("-f"); - command.arg("-q"); command.arg(devnode); if let Some(uuid) = uuid { From 255f37f4a5fe4ba6cc110fea8832d912e8a1c3c2 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Thu, 4 Jan 2024 15:37:00 -0500 Subject: [PATCH 16/26] Try both Clevis and passphrase in /etc/fstab setup --- systemd/stratis-fstab-setup | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/systemd/stratis-fstab-setup b/systemd/stratis-fstab-setup index 1390ed5f58..f4619b92b8 100755 --- a/systemd/stratis-fstab-setup +++ b/systemd/stratis-fstab-setup @@ -19,23 +19,29 @@ done if $(stratis-min pool is-stopped "$POOL_UUID"); then if $(stratis-min pool is-bound "$POOL_UUID"); then - if ! stratis-min pool start --unlock-method=clevis "$POOL_UUID"; then + if stratis-min pool start --unlock-method=clevis "$POOL_UUID"; then + exit 0 + else echo Failed to start pool with UUID $POOL_UUID using Clevis. >&2 - exit 1 fi - elif $(stratis-min pool is-encrypted "$POOL_UUID"); then - if ! systemd-ask-password \ + fi + if $(stratis-min pool has-passphrase "$POOL_UUID"); then + if systemd-ask-password \ "Enter password for pool with UUID $POOL_UUID" | stratis-min pool start --unlock-method=keyring --prompt "$POOL_UUID"; then + exit 0 + else echo Failed to start pool with UUID $POOL_UUID using passphrase. >&2 - exit 1 fi - else - if ! stratis-min pool start "$POOL_UUID"; then + fi + if ! $(stratis-min pool is-encrypted); then + if stratis-min pool start "$POOL_UUID"; then + exit 0 + else echo Failed to start pool with UUID $POOL_UUID. >&2 - exit 1 fi fi + exit 1 fi udevadm settle From c6a27b1a7e24f2f4e981caf8d0d9415e52b063f8 Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 5 Jan 2024 21:07:47 -0500 Subject: [PATCH 17/26] Put dump-metadata code in separate file Signed-off-by: mulhern --- src/bin/stratis-dumpmetadata.rs | 148 ++------------------------------ src/bin/tools/dump_metadata.rs | 145 +++++++++++++++++++++++++++++++ src/bin/tools/mod.rs | 5 ++ 3 files changed, 155 insertions(+), 143 deletions(-) create mode 100644 src/bin/tools/dump_metadata.rs create mode 100644 src/bin/tools/mod.rs diff --git a/src/bin/stratis-dumpmetadata.rs b/src/bin/stratis-dumpmetadata.rs index ea146bad46..cd855fb8ae 100644 --- a/src/bin/stratis-dumpmetadata.rs +++ b/src/bin/stratis-dumpmetadata.rs @@ -2,115 +2,15 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use std::{ - env, - fs::OpenOptions, - io::{Seek, SeekFrom}, - process, -}; +mod tools; + +use std::{env, process}; use env_logger::Builder; use clap::{Arg, ArgAction, Command}; -use pretty_hex::pretty_hex; - -use serde_json::Value; - -use stratisd::engine::{StaticHeader, StaticHeaderResult, BDA}; - -/// Format metadata on a given device -/// Returns StaticHeader fields -/// Returns an additional bytes buffer if print_bytes flag is True -fn fmt_metadata(shr: &StaticHeaderResult, print_bytes: bool) -> String { - let mut result = String::from("\nHeader:\n") - + shr - .header - .as_ref() - .map_or(String::from("Unreadable\n"), |h| { - h.as_ref().map_or_else( - |e| format!("Error: {}\n", e), - |s| { - s.as_ref() - .map_or(String::from("No signature buffer\n"), |sh| { - format!("{:#?}\n", sh) - }) - }, - ) - }) - .as_str(); - if print_bytes { - result += "\n\nBytes:\n\n"; - match &shr.bytes { - Ok(ref boxed) => { - result += pretty_hex(boxed.as_ref()).as_str(); - } - Err(e) => { - result += e.to_string().as_str(); - } - } - } - - result -} - -/// Prints signature block -/// Prints the sigblock bytes if print_bytes is true. -/// Skips if only_pool is true. -fn print_signature_block( - read_results: &(StaticHeaderResult, StaticHeaderResult), - print_bytes: bool, - only_pool: bool, -) { - if only_pool { - return; - } - - if read_results.0 == read_results.1 { - println!( - "Signature block: \n{}", - fmt_metadata(&read_results.0, print_bytes) - ); - } else { - println!( - "Signature block 1: \n{}", - fmt_metadata(&read_results.0, print_bytes) - ); - println!( - "Signature block 2: \n{}", - fmt_metadata(&read_results.1, print_bytes) - ); - }; -} - -/// Prints the bda. -/// Skips if only_pool is true. -fn print_bda(bda: &BDA, only_pool: bool) { - if only_pool { - return; - } - - println!("\n{:#?}", bda); -} - -/// Prints the pool level metadata. -/// Prints in machine-readable form if only_pool is true. -fn print_pool_metadata(pool_metadata: &Option>, only_pool: bool) -> Result<(), String> { - if !only_pool { - println!("\nPool metadata:"); - } - if let Some(loaded_state) = pool_metadata { - let state_json: Value = serde_json::from_slice(loaded_state) - .map_err(|extract_err| format!("Error during state JSON extract: {}", extract_err))?; - let state_json_pretty: String = serde_json::to_string_pretty(&state_json) - .map_err(|parse_err| format!("Error during state JSON parse: {}", parse_err))?; - println!("{}", state_json_pretty); - } else if !only_pool { - println!("None found"); - } - - Ok(()) -} +use tools::dump_metadata; /// Configure and initialize the logger. /// Read log configuration parameters from the environment if RUST_LOG @@ -126,44 +26,6 @@ fn initialize_log() { builder.init() } -// Print metadata, such as StaticHeaders, BDA, and Pool Metadata of given device. -// If sigblocks match, display the StaticHeader fields of a single sigblock, -// Otherwise display the StaticHeader fields of both sigblocks. -// If print_bytes flag is set to True, display the bytes buffer -// of the sigblock alongside the StaticHeader. -fn run(devpath: &str, print_bytes: bool, pool_only: bool) -> Result<(), String> { - let mut devfile = OpenOptions::new() - .read(true) - .open(devpath) - .map_err(|the_io_error| format!("Error opening device: {}", the_io_error))?; - - let read_results = StaticHeader::read_sigblocks(&mut devfile); - print_signature_block(&read_results, print_bytes, pool_only); - - let header = - StaticHeader::repair_sigblocks(&mut devfile, read_results, StaticHeader::do_nothing) - .map_err(|repair_error| format!("No valid StaticHeader found: {}", repair_error))? - .ok_or_else(|| "No valid Stratis signature found".to_string())?; - - let bda = BDA::load(header, &mut devfile) - .map_err(|bda_load_error| format!("BDA detected but error found: {}", bda_load_error))? - .ok_or_else(|| "No Stratis BDA metadata found".to_string())?; - - print_bda(&bda, pool_only); - - devfile - .seek(SeekFrom::Start(0)) - .map_err(|seek_err| format!("Error during seek: {}", seek_err))?; - - let loaded_state = bda - .load_state(&mut devfile) - .map_err(|stateload_err| format!("Error during load state: {}", stateload_err))?; - - print_pool_metadata(&loaded_state, pool_only)?; - - Ok(()) -} - fn parse_args() -> Command { Command::new("stratis-dumpmetadata") .next_line_help(true) @@ -199,7 +61,7 @@ fn main() { initialize_log(); - match run( + match dump_metadata::run( devpath, matches.get_flag("print_bytes"), matches diff --git a/src/bin/tools/dump_metadata.rs b/src/bin/tools/dump_metadata.rs new file mode 100644 index 0000000000..7fc2dfe70f --- /dev/null +++ b/src/bin/tools/dump_metadata.rs @@ -0,0 +1,145 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +use std::{ + fs::OpenOptions, + io::{Seek, SeekFrom}, +}; + +use pretty_hex::pretty_hex; + +use serde_json::Value; + +use stratisd::engine::{StaticHeader, StaticHeaderResult, BDA}; + +/// Format metadata on a given device +/// Returns StaticHeader fields +/// Returns an additional bytes buffer if print_bytes flag is True +fn fmt_metadata(shr: &StaticHeaderResult, print_bytes: bool) -> String { + let mut result = String::from("\nHeader:\n") + + shr + .header + .as_ref() + .map_or(String::from("Unreadable\n"), |h| { + h.as_ref().map_or_else( + |e| format!("Error: {}\n", e), + |s| { + s.as_ref() + .map_or(String::from("No signature buffer\n"), |sh| { + format!("{:#?}\n", sh) + }) + }, + ) + }) + .as_str(); + if print_bytes { + result += "\n\nBytes:\n\n"; + match &shr.bytes { + Ok(ref boxed) => { + result += pretty_hex(boxed.as_ref()).as_str(); + } + Err(e) => { + result += e.to_string().as_str(); + } + } + } + + result +} + +/// Prints signature block +/// Prints the sigblock bytes if print_bytes is true. +/// Skips if only_pool is true. +fn print_signature_block( + read_results: &(StaticHeaderResult, StaticHeaderResult), + print_bytes: bool, + only_pool: bool, +) { + if only_pool { + return; + } + + if read_results.0 == read_results.1 { + println!( + "Signature block: \n{}", + fmt_metadata(&read_results.0, print_bytes) + ); + } else { + println!( + "Signature block 1: \n{}", + fmt_metadata(&read_results.0, print_bytes) + ); + println!( + "Signature block 2: \n{}", + fmt_metadata(&read_results.1, print_bytes) + ); + }; +} + +/// Prints the bda. +/// Skips if only_pool is true. +fn print_bda(bda: &BDA, only_pool: bool) { + if only_pool { + return; + } + + println!("\n{:#?}", bda); +} + +/// Prints the pool level metadata. +/// Prints in machine-readable form if only_pool is true. +fn print_pool_metadata(pool_metadata: &Option>, only_pool: bool) -> Result<(), String> { + if !only_pool { + println!("\nPool metadata:"); + } + if let Some(loaded_state) = pool_metadata { + let state_json: Value = serde_json::from_slice(loaded_state) + .map_err(|extract_err| format!("Error during state JSON extract: {}", extract_err))?; + let state_json_pretty: String = serde_json::to_string_pretty(&state_json) + .map_err(|parse_err| format!("Error during state JSON parse: {}", parse_err))?; + println!("{}", state_json_pretty); + } else if !only_pool { + println!("None found"); + } + + Ok(()) +} + +// Print metadata, such as StaticHeaders, BDA, and Pool Metadata of given device. +// If sigblocks match, display the StaticHeader fields of a single sigblock, +// Otherwise display the StaticHeader fields of both sigblocks. +// If print_bytes flag is set to True, display the bytes buffer +// of the sigblock alongside the StaticHeader. +pub fn run(devpath: &str, print_bytes: bool, pool_only: bool) -> Result<(), String> { + let mut devfile = OpenOptions::new() + .read(true) + .open(devpath) + .map_err(|the_io_error| format!("Error opening device: {}", the_io_error))?; + + let read_results = StaticHeader::read_sigblocks(&mut devfile); + print_signature_block(&read_results, print_bytes, pool_only); + + let header = + StaticHeader::repair_sigblocks(&mut devfile, read_results, StaticHeader::do_nothing) + .map_err(|repair_error| format!("No valid StaticHeader found: {}", repair_error))? + .ok_or_else(|| "No valid Stratis signature found".to_string())?; + + let bda = BDA::load(header, &mut devfile) + .map_err(|bda_load_error| format!("BDA detected but error found: {}", bda_load_error))? + .ok_or_else(|| "No Stratis BDA metadata found".to_string())?; + + print_bda(&bda, pool_only); + + devfile + .seek(SeekFrom::Start(0)) + .map_err(|seek_err| format!("Error during seek: {}", seek_err))?; + + let loaded_state = bda + .load_state(&mut devfile) + .map_err(|stateload_err| format!("Error during load state: {}", stateload_err))?; + + print_pool_metadata(&loaded_state, pool_only)?; + + Ok(()) +} diff --git a/src/bin/tools/mod.rs b/src/bin/tools/mod.rs new file mode 100644 index 0000000000..a2c434ec00 --- /dev/null +++ b/src/bin/tools/mod.rs @@ -0,0 +1,5 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +pub mod dump_metadata; From f8f6f672077ba49eb1f09ea4379c65d2abbdfa0b Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 5 Jan 2024 21:24:10 -0500 Subject: [PATCH 18/26] Improve dispatch for tools in tools package * Change name of primary binary to stratisd-tools * Update CI * Add struct based dispatch * Allow invoking stratisd-tools directly with name as subcommand Signed-off-by: mulhern --- .github/workflows/fedora.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- Cargo.toml | 2 +- Makefile | 16 +++--- src/bin/stratis-dumpmetadata.rs | 88 --------------------------------- src/bin/stratisd-tools.rs | 84 +++++++++++++++++++++++++++++++ src/bin/tools/cmds.rs | 80 ++++++++++++++++++++++++++++++ src/bin/tools/mod.rs | 3 ++ 8 files changed, 180 insertions(+), 97 deletions(-) delete mode 100644 src/bin/stratis-dumpmetadata.rs create mode 100644 src/bin/stratisd-tools.rs create mode 100644 src/bin/tools/cmds.rs diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 0ace1ee934..569064fef4 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -51,7 +51,7 @@ jobs: - task: PROFILEDIR=debug make -f Makefile build-no-ipc toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata + - task: PROFILEDIR=debug make -f Makefile stratisd-tools toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-ci diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 875f215f18..e27c0c056e 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -51,7 +51,7 @@ jobs: - task: PROFILEDIR=debug make -f Makefile build-no-ipc toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - - task: PROFILEDIR=debug make -f Makefile stratis-dumpmetadata + - task: PROFILEDIR=debug make -f Makefile stratisd-tools toolchain: 1.75.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN components: cargo - task: make -f Makefile docs-ci diff --git a/Cargo.toml b/Cargo.toml index 3a362fb2b5..8adfe86dcd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ name = "stratisd" required-features = ["engine"] [[bin]] -name = "stratis-dumpmetadata" +name = "stratisd-tools" required-features = ["engine", "extras", "min"] [[bin]] diff --git a/Makefile b/Makefile index d0bb1d7806..0269ede4c1 100644 --- a/Makefile +++ b/Makefile @@ -165,7 +165,7 @@ audit-all-rust: build-all-rust ./target/${PROFILEDIR}/stratis-utils \ ./target/${PROFILEDIR}/stratis-str-cmp \ ./target/${PROFILEDIR}/stratis-base32-decode \ - ./target/${PROFILEDIR}/stratis-dumpmetadata + ./target/${PROFILEDIR}/stratisd-tools ## Check for spelling errors check-typos: @@ -253,12 +253,12 @@ build-stratis-base32-decode: # so we use two distinct targets to build the two binaries build-udev-utils: build-stratis-str-cmp build-stratis-base32-decode -## Build the stratis-dumpmetadata program -stratis-dumpmetadata: +## Build the stratisd-tools program +stratisd-tools: PKG_CONFIG_ALLOW_CROSS=1 \ RUSTFLAGS="${DENY}" \ cargo ${BUILD} ${RELEASE_FLAG} \ - --bin=stratis-dumpmetadata ${EXTRAS_FEATURES} ${TARGET_ARGS} + --bin=stratisd-tools ${EXTRAS_FEATURES} ${TARGET_ARGS} ## Build stratis-min for early userspace stratis-min: @@ -314,8 +314,11 @@ install-binaries: mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(UNITGENDIR) $(INSTALL) -Dpm0755 -t $(DESTDIR)$(BINDIR) target/$(PROFILEDIR)/stratis-min + + $(INSTALL) -Dpm0755 -t $(DESTDIR)$(BINDIR) target/$(PROFILEDIR)/stratisd-tools + ln --force --verbose $(DESTDIR)$(BINDIR)/stratisd-tools $(DESTDIR)$(BINDIR)/stratis-dumpmetadata + $(INSTALL) -Dpm0755 -t $(DESTDIR)$(BINDIR) target/$(PROFILEDIR)/stratis-utils - $(INSTALL) -Dpm0755 -t $(DESTDIR)$(BINDIR) target/$(PROFILEDIR)/stratis-dumpmetadata mv --force --verbose $(DESTDIR)$(BINDIR)/stratis-utils $(DESTDIR)$(BINDIR)/stratis-predict-usage ln --force --verbose $(DESTDIR)$(BINDIR)/stratis-predict-usage $(DESTDIR)$(UNITGENDIR)/stratis-clevis-setup-generator ln --force --verbose $(DESTDIR)$(BINDIR)/stratis-predict-usage $(DESTDIR)$(UNITGENDIR)/stratis-setup-generator @@ -341,7 +344,7 @@ install-daemons: install: install-udev-cfg install-man-cfg install-dbus-cfg install-dracut-cfg install-systemd-cfg install-binaries install-udev-binaries install-fstab-script install-daemons ## Build all Rust artifacts -build-all-rust: build build-min build-udev-utils stratis-dumpmetadata +build-all-rust: build build-min build-udev-utils stratisd-tools ## Build all man pages build-all-man: docs/stratisd.8 docs/stratis-dumpmetadata.8 @@ -366,6 +369,7 @@ clean-ancillary: rm -fv $(DESTDIR)$(UDEVDIR)/stratis-str-cmp rm -fv $(DESTDIR)$(UDEVDIR)/stratis-base32-decode rm -fv $(DESTDIR)$(BINDIR)/stratis-predict-usage + rm -fv $(DESTDIR)$(BINDIR)/stratisd-tools rm -fv $(DESTDIR)$(BINDIR)/stratis-dumpmetadata rm -fv $(DESTDIR)$(UNITGENDIR)/stratis-setup-generator rm -fv $(DESTDIR)$(UNITGENDIR)/stratis-clevis-setup-generator diff --git a/src/bin/stratis-dumpmetadata.rs b/src/bin/stratis-dumpmetadata.rs deleted file mode 100644 index cd855fb8ae..0000000000 --- a/src/bin/stratis-dumpmetadata.rs +++ /dev/null @@ -1,88 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -mod tools; - -use std::{env, process}; - -use env_logger::Builder; - -use clap::{Arg, ArgAction, Command}; - -use tools::dump_metadata; - -/// Configure and initialize the logger. -/// Read log configuration parameters from the environment if RUST_LOG -/// is set. Otherwise, just accept the default configuration, which is -/// to log at the severity of error only. -fn initialize_log() { - let mut builder = Builder::new(); - - if let Ok(s) = env::var("RUST_LOG") { - builder.parse_filters(&s); - } - - builder.init() -} - -fn parse_args() -> Command { - Command::new("stratis-dumpmetadata") - .next_line_help(true) - .arg( - Arg::new("dev") - .required(true) - .help("Print metadata of given device"), - ) - .arg( - Arg::new("print_bytes") - .long("print-bytes") - .action(ArgAction::SetTrue) - .num_args(0) - .short('b') - .help("Print byte buffer of signature block"), - ) - .arg( - Arg::new("only") - .long("only") - .action(ArgAction::Set) - .value_name("PORTION") - .value_parser(["pool"]) - .help("Only print specified portion of the metadata"), - ) -} - -fn main() { - let matches = parse_args().get_matches(); - let devpath = matches - .get_one::("dev") - .map(|s| s.as_str()) - .expect("'dev' is a mandatory argument"); - - initialize_log(); - - match dump_metadata::run( - devpath, - matches.get_flag("print_bytes"), - matches - .get_one::("only") - .map(|v| v == "pool") - .unwrap_or(false), - ) { - Ok(()) => {} - Err(e) => { - eprintln!("Error encountered: {}", e); - process::exit(1); - } - } -} - -#[cfg(test)] -mod tests { - use super::parse_args; - - #[test] - fn test_dumpmetadata_parse_args() { - parse_args().debug_assert(); - } -} diff --git a/src/bin/stratisd-tools.rs b/src/bin/stratisd-tools.rs new file mode 100644 index 0000000000..281b5a6360 --- /dev/null +++ b/src/bin/stratisd-tools.rs @@ -0,0 +1,84 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +mod tools; + +use std::{env, path::Path, process}; + +use clap::{Arg, Command}; +use env_logger::Builder; + +use crate::tools::cmds; + +fn basename(path: &str) -> Option<&Path> { + Path::new(path).file_name().map(Path::new) +} + +/// Configure and initialize the logger. +/// Read log configuration parameters from the environment if RUST_LOG +/// is set. Otherwise, just accept the default configuration, which is +/// to log at the severity of error only. +fn initialize_log() { + let mut builder = Builder::new(); + + if let Ok(s) = env::var("RUST_LOG") { + builder.parse_filters(&s); + } + + builder.init() +} + +fn main() { + initialize_log(); + + let executable_name = "stratisd-tools"; + + let args = env::args().collect::>(); + let argv1 = &args[0]; + + let stripped_args = if basename(argv1.as_str()) + .map(|n| n == Path::new(executable_name)) + .unwrap_or(false) + { + let command = Command::new(executable_name) + .arg( + Arg::new("executable") + .required(true) + .value_name("EXECUTABLE") + .value_parser(cmds().iter().map(|x| x.name()).collect::>()), + ) + .arg_required_else_help(true); + + let truncated_args = if args.len() > 1 { + vec![argv1, &args[1]] + } else { + vec![argv1] + }; + + command.get_matches_from(truncated_args); + args[1..].to_vec() + } else { + args + }; + + let command_name = match basename(&stripped_args[0]).and_then(|n| n.to_str()) { + Some(name) => name, + None => { + process::exit(1); + } + }; + + if let Some(c) = cmds().iter().find(|x| command_name == x.name()) { + match c.run(stripped_args) { + Ok(()) => {} + Err(e) => { + eprintln!("Error encountered: {e}"); + process::exit(1); + } + } + } else { + eprintln!("Unknown executable name {command_name}"); + process::exit(2); + } +} diff --git a/src/bin/tools/cmds.rs b/src/bin/tools/cmds.rs new file mode 100644 index 0000000000..8f6384a1a7 --- /dev/null +++ b/src/bin/tools/cmds.rs @@ -0,0 +1,80 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +use clap::{Arg, ArgAction, Command}; + +use crate::tools::dump_metadata; + +pub trait ToolCommand<'a> { + fn name(&self) -> &'a str; + fn run(&self, command_line_args: Vec) -> Result<(), String>; +} + +struct StratisDumpMetadata; + +impl StratisDumpMetadata { + fn cmd() -> Command { + Command::new("stratis-dumpmetadata") + .next_line_help(true) + .arg( + Arg::new("dev") + .required(true) + .help("Print metadata of given device"), + ) + .arg( + Arg::new("print_bytes") + .long("print-bytes") + .action(ArgAction::SetTrue) + .num_args(0) + .short('b') + .help("Print byte buffer of signature block"), + ) + .arg( + Arg::new("only") + .long("only") + .action(ArgAction::Set) + .value_name("PORTION") + .value_parser(["pool"]) + .help("Only print specified portion of the metadata"), + ) + } +} + +impl<'a> ToolCommand<'a> for StratisDumpMetadata { + fn name(&self) -> &'a str { + "stratis-dumpmetadata" + } + + fn run(&self, command_line_args: Vec) -> Result<(), String> { + let matches = StratisDumpMetadata::cmd().get_matches_from(command_line_args); + let devpath = matches + .get_one::("dev") + .map(|s| s.as_str()) + .expect("'dev' is a mandatory argument"); + + dump_metadata::run( + devpath, + matches.get_flag("print_bytes"), + matches + .get_one::("only") + .map(|v| v == "pool") + .unwrap_or(false), + ) + } +} + +pub fn cmds<'a>() -> Vec>> { + vec![Box::new(StratisDumpMetadata)] +} + +#[cfg(test)] +mod tests { + + use super::StratisDumpMetadata; + + #[test] + fn test_dumpmetadata_parse_args() { + StratisDumpMetadata::cmd().debug_assert(); + } +} diff --git a/src/bin/tools/mod.rs b/src/bin/tools/mod.rs index a2c434ec00..b7d2ac52d2 100644 --- a/src/bin/tools/mod.rs +++ b/src/bin/tools/mod.rs @@ -2,4 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +mod cmds; pub mod dump_metadata; + +pub use cmds::cmds; From da382db714efdbcb38a99f3d43b7771203c267d8 Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 20 Dec 2023 13:48:57 -0500 Subject: [PATCH 19/26] Use loopdev-3 instead of loopdev crate Signed-off-by: mulhern --- Cargo.lock | 24 +++++++----------------- Cargo.toml | 7 +------ 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79e7cc7d88..e8d51cea00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -411,17 +411,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - [[package]] name = "errno" version = "0.3.1" @@ -837,12 +826,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] -name = "loopdev" -version = "0.4.0" -source = "git+https://github.com/mulkieran/loopdev?branch=bump-bindgen-reduce-version-0.68.1#63e6105d5599d9df00041de873d7fc91f53b9f20" +name = "loopdev-3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "378e7ca4e85e592564e6a96c362303972b5c7860367014383aadc10a8704fc38" dependencies = [ "bindgen", - "errno 0.2.8", + "errno", "libc", ] @@ -1175,7 +1165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4eb579851244c2c03e7c24f501c3432bed80b8f720af1d6e5b0e0f01555a035" dependencies = [ "bitflags 1.3.2", - "errno 0.3.1", + "errno", "io-lifetimes", "libc", "linux-raw-sys", @@ -1317,7 +1307,7 @@ dependencies = [ "libmount", "libudev", "log", - "loopdev", + "loopdev-3", "nix 0.27.1", "pkg-config", "predicates", diff --git a/Cargo.toml b/Cargo.toml index 8adfe86dcd..3391335886 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -231,7 +231,7 @@ optional = true [dev-dependencies] assert_cmd = "2.0.8" assert_matches = "1.5.0" -loopdev = "0.4.0" +loopdev-3 = "0.5.0" predicates = "3.0.0" proptest = "1.0.0" @@ -278,11 +278,6 @@ min = ["termios"] systemd_compat = ["bindgen"] udev_scripts = ["data-encoding"] -# FIXME: remove when loopdev dependency lower bound is increased from 0.4.0 -[patch.crates-io.loopdev] -git = "https://github.com/mulkieran/loopdev" -branch = "bump-bindgen-reduce-version-0.68.1" - [package.metadata.vendor-filter] platforms = ["*-unknown-linux-gnu"] tier = "2" From 853526259429e95cc846f3c3d461201a87d3e3d0 Mon Sep 17 00:00:00 2001 From: Bryan Gurney Date: Wed, 17 Jan 2024 13:58:11 -0500 Subject: [PATCH 20/26] Use checkout@v4 Signed-off-by: Bryan Gurney --- .github/workflows/cargo.yml | 2 +- .github/workflows/fedora.yml | 4 ++-- .github/workflows/main.yml | 14 +++++++------- .github/workflows/support.yml | 2 +- .github/workflows/ubuntu.yml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 2ed735901f..3d99812940 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -31,7 +31,7 @@ jobs: container: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Fedora run: > dnf install -y diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 569064fef4..850f0f957a 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -79,7 +79,7 @@ jobs: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT options: --privileged -v /dev:/dev -v /run/udev:/run/udev -v /usr/lib/udev:/usr/lib/udev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Fedora run: > dnf install -y @@ -114,7 +114,7 @@ jobs: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT options: --privileged -v /dev:/dev -v /run/udev:/run/udev -v /usr/lib/udev:/usr/lib/udev --ipc=host steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Fedora run: > dnf install -y diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d1295fd21..4ebf9f2aba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,7 +50,7 @@ jobs: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT options: --privileged -v /dev:/dev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Fedora run: > dnf install -y @@ -99,7 +99,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} options: --privileged -p 80:80 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Fedora # cracklib-dicts: https://github.com/stratis-storage/project/issues/581 run: > @@ -133,7 +133,7 @@ jobs: image: fedora:34 # LOWEST 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 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: > dnf install -y @@ -187,7 +187,7 @@ jobs: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT 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 + - uses: actions/checkout@v4 - name: Install dependencies run: > dnf install -y @@ -228,7 +228,7 @@ jobs: container: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: > dnf install -y @@ -244,7 +244,7 @@ jobs: image: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT options: --privileged -v /dev:/dev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Fedora run: > dnf install -y @@ -287,7 +287,7 @@ jobs: args: --log-level=debug stratisd_cert --verify-devices --monitor-dbus --highest-revision-number=6 runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run apt-get update run: sudo apt-get -q update - name: Install dependencies diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml index 19cbcaaa1d..dae5b9eef6 100644 --- a/.github/workflows/support.yml +++ b/.github/workflows/support.yml @@ -57,7 +57,7 @@ jobs: runs-on: ubuntu-22.04 container: fedora:39 # CURRENT DEVELOPMENT ENVIRONMENT steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: > dnf install -y diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e27c0c056e..392c3c8e6a 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -74,7 +74,7 @@ jobs: image: ubuntu:jammy options: --privileged -v /dev:/dev steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Ubuntu run: apt-get -q update - name: Install dependencies for Ubuntu @@ -112,7 +112,7 @@ jobs: image: ubuntu:jammy options: --privileged -v /dev:/dev -v /run/udev:/run/udev -v /usr/lib/udev:/usr/lib/udev --ipc=host steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies for Ubuntu run: apt-get -q update - name: Install dependencies for Ubuntu From f01a68d717c2bedaba1257f3d22888b89d0f8264 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Mon, 22 Jan 2024 11:33:12 -0500 Subject: [PATCH 21/26] Fix bug where unencrypted pools can't be started in stratisd-min --- src/jsonrpc/server/key.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/jsonrpc/server/key.rs b/src/jsonrpc/server/key.rs index 3741427a71..97f3f90c92 100644 --- a/src/jsonrpc/server/key.rs +++ b/src/jsonrpc/server/key.rs @@ -43,21 +43,25 @@ pub async fn key_get_desc( engine: Arc, id: PoolIdentifier, ) -> StratisResult> { - let locked = engine.locked_pools().await; + let stopped = engine.stopped_pools().await; let guard = engine.get_pool(id.clone()).await; if let Some((_, _, pool)) = guard.as_ref().map(|guard| guard.as_tuple()) { match pool.encryption_info() { Some(ei) => ei.key_description().map(|opt| opt.cloned()), None => Ok(None), } - } else if let Some(info) = locked.locked.get(match id { + } else if let Some(info) = stopped.stopped.get(match id { PoolIdentifier::Uuid(ref u) => u, - PoolIdentifier::Name(ref n) => locked + PoolIdentifier::Name(ref n) => stopped .name_to_uuid .get(n) .ok_or_else(|| StratisError::Msg(format!("Pool with name {n} not found")))?, }) { - info.info.key_description().map(|opt| opt.cloned()) + if let Some(ref i) = info.info { + i.key_description().map(|opt| opt.cloned()) + } else { + Ok(None) + } } else { Err(StratisError::Msg(format!("Pool with {id} not found"))) } From 29f2f5fb37b3fc872c48e736d61f857254ffd4f9 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 22 Jan 2024 17:42:43 -0500 Subject: [PATCH 22/26] Increase shlex version in Cargo.lock to 1.3.0 To avoid including a CVEd version of shlex in the next vendor tarfile. See: https://rustsec.org/advisories/RUSTSEC-2024-0006. Note that shlex is a dev dependency; bindgen depends on it. Signed-off-by: mulhern --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8d51cea00..306a650d42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1240,9 +1240,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" From 37ee867fcabcbf07f1f9143c062ad07516221b56 Mon Sep 17 00:00:00 2001 From: John Baublitz Date: Mon, 22 Jan 2024 11:35:23 -0500 Subject: [PATCH 23/26] Fix for githooks --- .githooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 2aead09c10..910791057c 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -4,7 +4,7 @@ export PROFILEDIR=debug make fmt-ci && make build && - make stratis-dumpmetadata && + make stratisd-tools && make build-min && make build-no-ipc && make test && From d1c25846a8da46e55fec56c593c865e628c62a92 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 15 Jan 2024 23:31:29 -0500 Subject: [PATCH 24/26] Increase pretty-hex dependency lower bound to 0.4.1 Signed-off-by: mulhern --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 306a650d42..943abf9d78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1021,9 +1021,9 @@ dependencies = [ [[package]] name = "pretty-hex" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" +checksum = "bbc83ee4a840062f368f9096d80077a9841ec117e17e7f700df81958f1451254" [[package]] name = "proc-macro2" diff --git a/Cargo.toml b/Cargo.toml index 3391335886..7ca9295f3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -160,7 +160,7 @@ optional = true features = ["fs", "ioctl", "mount", "poll", "process", "sched", "signal", "socket"] [dependencies.pretty-hex] -version = "0.3.0" +version = "0.4.1" optional = true [dependencies.rand] From 5c8ff85f750265d9f6b681f593126220ac772b26 Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 24 Jan 2024 09:43:37 -0500 Subject: [PATCH 25/26] Makefile_dependencies: fix verify-dependency-bounds target It got out of date now that stratis-dumpmetadata is not a target in the main Makefile. Signed-off-by: mulhern --- Makefile_dependencies | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile_dependencies b/Makefile_dependencies index d42950eb18..ca599d81a8 100644 --- a/Makefile_dependencies +++ b/Makefile_dependencies @@ -15,7 +15,7 @@ test-set-lower-bounds: echo "Testing that SET_LOWER_BOUNDS environment variable is set to a valid path" test -e "${SET_LOWER_BOUNDS}" -verify-dependency-bounds: test-set-lower-bounds vdb-build vdb-min vdb-tests vdb-stratis-dumpmetadata +verify-dependency-bounds: test-set-lower-bounds vdb-build vdb-min vdb-tests vdb-stratisd-tools vdb-build: cargo clean @@ -35,11 +35,11 @@ vdb-tests: ${SET_LOWER_BOUNDS} ${MANIFEST_PATH_ARGS} make -f Makefile build-tests -vdb-stratis-dumpmetadata: +vdb-stratisd-tools: cargo clean - make -f Makefile stratis-dumpmetadata + make -f Makefile stratisd-tools ${SET_LOWER_BOUNDS} ${MANIFEST_PATH_ARGS} - make -f Makefile stratis-dumpmetadata + make -f Makefile stratisd-tools COMPARE_FEDORA_VERSIONS ?= From 3f70c64814b8a624b18fc33c5d9e330dc56f66ae Mon Sep 17 00:00:00 2001 From: mulhern Date: Wed, 24 Jan 2024 09:15:26 -0500 Subject: [PATCH 26/26] version 3.6.4 Signed-off-by: mulhern --- CHANGES.txt | 33 +++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 26a4c867a5..1076121f45 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,36 @@ +stratisd 3.6.4 +============== +Recommended Rust toolchain version: 1.75.0 +Recommended development platform for Python development: Fedora 39 + +- Cherry-picked commits: + * Update to nix 0.27.1 + * github actions: update FEDORA_RELEASE to F39, F38 + * Parameterize /usr/libexec everywhere + * github actions: update recommended Rust to 1.74.1 + * Increase itertools dependency lower bound to 0.12.0 + * Replace get(0) with first() + * Remove unused imports + * Move initialize_devices import to cfg(test) + * should_wake: replace get(0) with front() + * github actions: update recommended Rust to 1.75.0 + * Fix up prediction tests to match new filesystem interface + * Start running clippy on stratis-dumpmetadata + * Remove unwrap() in stratis-dumpmetadata + * Run thin_check in loud mode + * Do not pass -q option to xfs.mkfs + * Try both Clevis and passphrase in /etc/fstab setup + * Put dump-metadata code in separate file + * Improve dispatch for tools in tools package + * Use loopdev-3 instead of loopdev crate + * Use checkout@v4 + * Fix bug where unencrypted pools can't be started in stratisd-min + * Increase shlex version in Cargo.lock to 1.3.0 + * Fix for githooks + * Increase pretty-hex dependency lower bound to 0.4.1 + * Makefile_dependencies: fix verify-dependency-bounds target + + stratisd 3.6.3 ============== Recommended Rust toolchain version: 1.74.0 diff --git a/Cargo.lock b/Cargo.lock index 943abf9d78..ddca983aa1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1280,7 +1280,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stratisd" -version = "3.6.3" +version = "3.6.4" dependencies = [ "assert_cmd", "assert_matches", diff --git a/Cargo.toml b/Cargo.toml index 7ca9295f3f..b39a90d2d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stratisd" -version = "3.6.3" +version = "3.6.4" authors = ["Stratis Developers "] edition = "2021" rust-version = "1.71.1" # LOWEST SUPPORTED RUST TOOLCHAIN