mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-11 14:28:33 +01:00
* weed/shell: support -noLock flag in volumeServer.evacuate (#12501) * shell: return flag parse errors from volumeServer.evacuate A typo such as -noLock=invalid printed the parse error but the command still succeeded, so a piped script treated the evacuation as done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: volumeServer.evacuate -h prints usage without failing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2 files changed
+61
-2
No files matched your search
@@ -2,6 +2,7 @@ package shell
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -43,6 +44,7 @@ func (c *commandVolumeServerEvacuate) Help() string {
|
||||
good destination to meet the replication requirement.
|
||||
E.g. a volume replication 001 in a cluster with 2 volume servers can not be moved.
|
||||
You can use "-skipNonMoveable" to move the rest volumes.
|
||||
You can use "-noLock" to run without cluster-wide lock.
|
||||
|
||||
`
|
||||
}
|
||||
@@ -62,14 +64,20 @@ func (c *commandVolumeServerEvacuate) Do(args []string, commandEnv *CommandEnv,
|
||||
// TODO: remove this alias
|
||||
applyChangeAlias := vsEvacuateCommand.Bool("force", false, "actually apply the changes (alias for -apply)")
|
||||
retryCount := vsEvacuateCommand.Int("retry", 0, "how many times to retry")
|
||||
noLock := vsEvacuateCommand.Bool("noLock", false, "do not lock the admin shell at one's own risk")
|
||||
if err = vsEvacuateCommand.Parse(args); err != nil {
|
||||
return nil
|
||||
if errors.Is(err, flag.ErrHelp) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
handleDeprecatedForceFlag(writer, vsEvacuateCommand, applyChangeAlias, applyChange)
|
||||
infoAboutSimulationMode(writer, *applyChange, "-apply")
|
||||
|
||||
if err = commandEnv.confirmIsLocked(args); err != nil && *applyChange {
|
||||
if *noLock {
|
||||
commandEnv.SetNoLock(true)
|
||||
} else if err = commandEnv.confirmIsLocked(args); err != nil && *applyChange {
|
||||
return
|
||||
}
|
||||
if *volumeServer == "" && *c.volumeRack == "" {
|
||||
|
||||
Reference in new issue
Block a user