Skip to content

Commit

Permalink
moved call to ceph.mount to it's own function
Browse files Browse the repository at this point in the history
  • Loading branch information
MadnessASAP committed Dec 10, 2024
1 parent 8c359e5 commit 8512318
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
7 changes: 1 addition & 6 deletions internal/server/device/device_utils_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ func DiskMount(srcPath string, dstPath string, recursive bool, propagation strin

// Mount the filesystem
if fsName == "ceph" {
// shell out to `mount.ceph` to do the work of
// determining monitor addresses and keyring
_, err = subprocess.RunCommand(
"mount.ceph", srcPath, dstPath,
"-o", mountOptionsStr,
)
storageDrivers.CephMount(srcPath, dstPath, mountOptionsStr)

Check failure on line 141 in internal/server/device/device_utils_disk.go

View workflow job for this annotation

GitHub Actions / Code (stable)

Error return value of `storageDrivers.CephMount` is not checked (errcheck)
} else {
err = unix.Mount(srcPath, dstPath, fsName, uintptr(flags), mountOptionsStr)
}
Expand Down
7 changes: 1 addition & 6 deletions internal/server/storage/drivers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,7 @@ func TryMount(src string, dst string, fs string, flags uintptr, options string)
var err error

if fs == "ceph" {
// shell out to `mount.ceph` to do the work of
// determining monitor addresses and keyring
_, err = subprocess.RunCommand(
"mount.ceph", src, dst,
"-o", options,
)
err = CephMount(src, dst, options)
} else {
// Attempt 20 mounts over 10s
for i := 0; i < 20; i++ {
Expand Down
15 changes: 15 additions & 0 deletions internal/server/storage/drivers/utils_ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,18 @@ func CephFSID(cluster string) (string, error) {
fsid = strings.TrimSpace(fsid)
return fsid, nil
}

// Attempts to mount Ceph via the `ceph.mount` helper.

Check failure on line 164 in internal/server/storage/drivers/utils_ceph.go

View workflow job for this annotation

GitHub Actions / Code (stable)

exported: comment on exported function CephMount should be of the form "CephMount ..." (revive)
func CephMount(src string, dst string, options string) error {
args := []string{
src,
dst,
}
if options != "" {
args = append(args, "-o", options)
}

_, err := subprocess.RunCommand("mount.ceph", args...)

return err
}

0 comments on commit 8512318

Please sign in to comment.