From 66fb5f44bf9adcdf6bcedd4810217686a5c8d74d Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Fri, 4 May 2018 12:30:45 -0700 Subject: [PATCH] Prefix commands with entire path When invoked via dbus activation, we don't have /usr/sbin in our path, so these commands are failing. Signed-off-by: Andy Grover --- src/engine/strat_engine/thinpool/thinpool.rs | 4 ++-- src/engine/strat_engine/thinpool/util.rs | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/engine/strat_engine/thinpool/thinpool.rs b/src/engine/strat_engine/thinpool/thinpool.rs index 15245f5..c153882 100644 --- a/src/engine/strat_engine/thinpool/thinpool.rs +++ b/src/engine/strat_engine/thinpool/thinpool.rs @@ -785,7 +785,7 @@ fn setup_metadev // TODO: Refine policy about failure to run thin_check. // If, e.g., thin_check is unavailable, that doesn't necessarily // mean that data is corrupted. - if execute_cmd(Command::new("thin_check") + if execute_cmd(Command::new("/usr/sbin/thin_check") .arg("-q") .arg(&meta_dev.devnode()), &format!("thin_check failed for pool {}", thinpool_name)) @@ -812,7 +812,7 @@ fn attempt_thin_repair(pool_uuid: PoolUuid, Some(&dm_uuid), segs_to_table(device, spare_segments))?; - execute_cmd(Command::new("thin_repair") + execute_cmd(Command::new("/usr/sbin/thin_repair") .arg("-i") .arg(&meta_dev.devnode()) .arg("-o") diff --git a/src/engine/strat_engine/thinpool/util.rs b/src/engine/strat_engine/thinpool/util.rs index 2c1447d..245e6fd 100644 --- a/src/engine/strat_engine/thinpool/util.rs +++ b/src/engine/strat_engine/thinpool/util.rs @@ -30,7 +30,7 @@ pub fn execute_cmd(cmd: &mut Command, error_msg: &str) -> StratisResult<()> { /// Create a filesystem on devnode. pub fn create_fs(devnode: &Path, uuid: Uuid) -> StratisResult<()> { - execute_cmd(Command::new("mkfs.xfs") + execute_cmd(Command::new("/usr/sbin/mkfs.xfs") .arg("-f") .arg("-q") .arg(&devnode) @@ -42,13 +42,15 @@ pub fn create_fs(devnode: &Path, uuid: Uuid) -> StratisResult<()> { /// Use the xfs_growfs command to expand a filesystem mounted at the given /// mount point. pub fn xfs_growfs(mount_point: &Path) -> StratisResult<()> { - execute_cmd(Command::new("xfs_growfs").arg(mount_point).arg("-d"), + execute_cmd(Command::new("/usr/sbin/xfs_growfs") + .arg(mount_point) + .arg("-d"), &format!("Failed to expand filesystem {:?}", mount_point)) } /// Set a new UUID for filesystem on the devnode. pub fn set_uuid(devnode: &Path, uuid: Uuid) -> StratisResult<()> { - execute_cmd(Command::new("xfs_admin") + execute_cmd(Command::new("/usr/sbin/xfs_admin") .arg("-U") .arg(format!("{}", uuid)) .arg(&devnode), -- 2.14.3