Skip to content

Commit 1100bb8

Browse files
author
Paul C
committed
fix: WolfDisk mount/unmount using wrong binary (wolfdiskctl → wolfdisk)
wolfdiskctl is the monitoring tool (status/stats only). The wolfdisk binary has the mount/unmount subcommands. Also fixed unmount to use wolfdisk unmount with fusermount fallback.
1 parent ba9b50a commit 1100bb8

2 files changed

Lines changed: 30 additions & 14 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wolfstack"
3-
version = "16.5.0"
3+
version = "16.5.1"
44
edition = "2024"
55
authors = ["Wolf Software Systems Ltd"]
66
description = "Server management platform for the Wolf software suite"

src/storage/mod.rs

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! - SSHFS mounts via sshfs
1111
//! - NFS storage via mount -t nfs
1212
//! - Local directory bind mounts
13-
//! - WolfDisk mounts via wolfdiskctl
13+
//! - WolfDisk mounts via wolfdisk CLI
1414
//! - Global mounts replicated across the cluster
1515
//! - Import of S3 configs from rclone.conf
1616
@@ -212,7 +212,7 @@ pub fn unmount_storage(id: &str) -> Result<String, String> {
212212
return Ok("Not mounted".to_string());
213213
}
214214

215-
// For S3 mounts, try fusermount first (for s3fs), then regular umount (for rust-s3 bind mounts)
215+
// Type-specific unmount handling
216216
let output = if config.mounts[idx].mount_type == MountType::S3 {
217217
// Try fusermount first (s3fs), fall back to regular umount (rust-s3 bind mount)
218218
let fuse_result = Command::new("fusermount")
@@ -224,6 +224,17 @@ pub fn unmount_storage(id: &str) -> Result<String, String> {
224224
.arg(&config.mounts[idx].mount_point)
225225
.output(),
226226
}
227+
} else if config.mounts[idx].mount_type == MountType::Wolfdisk {
228+
// WolfDisk uses FUSE — try wolfdisk unmount, fall back to fusermount
229+
let wd_result = Command::new("wolfdisk")
230+
.args(["unmount", "--mountpoint", &config.mounts[idx].mount_point])
231+
.output();
232+
match &wd_result {
233+
Ok(o) if o.status.success() => wd_result,
234+
_ => Command::new("fusermount")
235+
.args(["-u", &config.mounts[idx].mount_point])
236+
.output(),
237+
}
227238
} else {
228239
Command::new("umount")
229240
.arg(&config.mounts[idx].mount_point)
@@ -695,17 +706,22 @@ fn mount_directory(mount: &StorageMount) -> Result<String, String> {
695706
}
696707

697708
fn mount_wolfdisk(mount: &StorageMount) -> Result<String, String> {
698-
// Check if wolfdiskctl exists
699-
if !Path::new("/usr/local/bin/wolfdiskctl").exists()
700-
&& !Path::new("/opt/wolfdisk/wolfdiskctl").exists() {
709+
// Check if wolfdisk binary exists (wolfdisk has mount, wolfdiskctl is monitoring only)
710+
if !has_wolfdisk() {
701711
return Err("WolfDisk is not installed. Install it first via Components.".to_string());
702712
}
703-
704-
let output = Command::new("wolfdiskctl")
705-
.args(["mount", &mount.source, &mount.mount_point])
713+
714+
let mut args = vec!["mount", "--mountpoint", &mount.mount_point];
715+
// If source specifies a config path, use it (otherwise wolfdisk uses /etc/wolfdisk/config.toml)
716+
if !mount.source.is_empty() {
717+
args.extend(["--config", &mount.source]);
718+
}
719+
720+
let output = Command::new("wolfdisk")
721+
.args(&args)
706722
.output()
707-
.map_err(|e| format!("Failed to run wolfdiskctl: {}", e))?;
708-
723+
.map_err(|e| format!("Failed to run wolfdisk: {}", e))?;
724+
709725
if output.status.success() {
710726
Ok("WolfDisk storage mounted".to_string())
711727
} else {
@@ -796,9 +812,9 @@ fn has_nfs() -> bool {
796812
}
797813

798814
fn has_wolfdisk() -> bool {
799-
Path::new("/usr/local/bin/wolfdiskctl").exists()
800-
|| Path::new("/opt/wolfdisk/wolfdiskctl").exists()
801-
|| Command::new("which").arg("wolfdiskctl").output().map(|o| o.status.success()).unwrap_or(false)
815+
Path::new("/usr/local/bin/wolfdisk").exists()
816+
|| Path::new("/opt/wolfdisk/wolfdisk").exists()
817+
|| Command::new("which").arg("wolfdisk").output().map(|o| o.status.success()).unwrap_or(false)
802818
}
803819

804820
fn install_s3fs() -> Result<(), String> {

0 commit comments

Comments
 (0)