Skip to content

Commit

Permalink
Network mount name (#263)
Browse files Browse the repository at this point in the history
* added PID to server name on network share name

* get bucket-name from common config

* add space after colon for mount name

* removed ':' from string

* added conditional and logic for using azstorage.container in config

* added var for bucket or container in network mount name

* updated variable names for network mount names

* moved where bucket or container gets set for string value and removed initial values set on variable names.

* renamed variables to be more distinctive at a glance.

* replace string "Cloud Storage" to just "cloud" for kindStorage

* changed the error here to match the function

* added else cases to error checks on unmarshalKey() to set respective kindStorage name.

* Revert "added else cases to error checks on unmarshalKey() to set respective kindStorage name."

This reverts commit 881adb7.

* take two: added else cases to error checks on unmarshalKey() to set respective kindStorage name

* removed extra line
  • Loading branch information
Dabnsky authored Jul 9, 2024
1 parent fb3627c commit 07f28ae
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion component/libfuse/libfuse2_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"time"

"github.com/Seagate/cloudfuse/common"
"github.com/Seagate/cloudfuse/common/config"
"github.com/Seagate/cloudfuse/common/log"
"github.com/Seagate/cloudfuse/internal"
"github.com/Seagate/cloudfuse/internal/handlemap"
Expand Down Expand Up @@ -160,7 +161,32 @@ func (lf *Libfuse) initFuse() error {
if runtime.GOOS == "windows" && lf.networkShare && common.IsDriveLetter(lf.mountPath) {
// TODO: We can support any type of valid network share path so this path could
// be configurable for the config file. But this is a good default.
opts = append(opts, "--VolumePrefix=\\server\\share")

// by default nameStorage will be blank
nameStorage := "default"
kindStorage := "cloud"
// Borrow bucket-name string from attribute cache
if config.IsSet("s3storage.bucket-name") {

err := config.UnmarshalKey("s3storage.bucket-name", &nameStorage)
if err != nil {
nameStorage = "default"
log.Err("initFuse : Failed to unmarshal s3storage.bucket-name")
} else {
kindStorage = "bucket"
}
} else if config.IsSet("azstorage.container") {
err := config.UnmarshalKey("azstorage.container", &nameStorage)
if err != nil {
nameStorage = "default"
log.Err("initFuse : Failed to unmarshal s3storage.bucket-name")
} else {
kindStorage = "container"
}
}

volumePrefix := fmt.Sprintf("--VolumePrefix=\\%s\\%s", kindStorage, nameStorage)
opts = append(opts, volumePrefix)
}

// Enabling trace is done by using -d rather than setting an option in fuse
Expand Down

0 comments on commit 07f28ae

Please sign in to comment.