diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-07-27 01:16:28 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-07-27 01:16:28 -0700 |
| commit | 4b94b03d90a97dfd6fecc55e7091055bf5fc329c (patch) | |
| tree | ea449e802e467af46af16641a7c480b8add52f98 /weed/shell/command_remote_configure.go | |
| parent | 99b599aa8a674ccd584d612e8e871fdca7670620 (diff) | |
| download | seaweedfs-4b94b03d90a97dfd6fecc55e7091055bf5fc329c.tar.xz seaweedfs-4b94b03d90a97dfd6fecc55e7091055bf5fc329c.zip | |
directory to remote storage mapping
Diffstat (limited to 'weed/shell/command_remote_configure.go')
| -rw-r--r-- | weed/shell/command_remote_configure.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/shell/command_remote_configure.go b/weed/shell/command_remote_configure.go index 567143ce1..20ded5f5b 100644 --- a/weed/shell/command_remote_configure.go +++ b/weed/shell/command_remote_configure.go @@ -10,6 +10,7 @@ import ( "github.com/golang/protobuf/proto" "io" "regexp" + "strings" ) func init() { @@ -84,6 +85,9 @@ func (c *commandRemoteConfigure) listExistingRemoteStorages(commandEnv *CommandE fmt.Fprintf(writer, "skipping %s\n", entry.Name) return nil } + if !strings.HasSuffix(entry.Name, filer.REMOTE_STORAGE_CONF_SUFFIX) { + return nil + } conf := &filer_pb.RemoteConf{} if err := proto.Unmarshal(entry.Content, conf); err != nil { @@ -105,7 +109,7 @@ func (c *commandRemoteConfigure) deleteRemoteStorage(commandEnv *CommandEnv, wri request := &filer_pb.DeleteEntryRequest{ Directory: filer.DirectoryEtcRemote, - Name: storageName, + Name: storageName + filer.REMOTE_STORAGE_CONF_SUFFIX, IgnoreRecursiveError: false, IsDeleteData: true, IsRecursive: true, @@ -132,7 +136,7 @@ func (c *commandRemoteConfigure) saveRemoteStorage(commandEnv *CommandEnv, write } if err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { - return filer.SaveInsideFiler(client, filer.DirectoryEtcRemote, conf.Name, data) + return filer.SaveInsideFiler(client, filer.DirectoryEtcRemote, conf.Name+filer.REMOTE_STORAGE_CONF_SUFFIX, data) }); err != nil && err != filer_pb.ErrNotFound { return err } |
