21189: Replace -commit-X with Balance{Pull,Trash}Limit configs.
[arvados.git] / services / keep-balance / main.go
index 6bc998958979fc41288cd051bb40eaae4a10de4e..f9a3e1701aa7a2ae40dafc926f99a7f3a27107a0 100644 (file)
@@ -32,10 +32,10 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
        flags := flag.NewFlagSet(prog, flag.ContinueOnError)
        flags.BoolVar(&options.Once, "once", false,
                "balance once and then exit")
-       flags.BoolVar(&options.CommitPulls, "commit-pulls", false,
-               "send pull requests (make more replicas of blocks that are underreplicated or are not in optimal rendezvous probe order)")
-       flags.BoolVar(&options.CommitTrash, "commit-trash", false,
-               "send trash requests (delete unreferenced old blocks, and excess replicas of overreplicated blocks)")
+       deprCommitPulls := flags.Bool("commit-pulls", true,
+               "send pull requests (must be true -- configure Collections.BalancePullLimit = 0 to disable.)")
+       deprCommitTrash := flags.Bool("commit-trash", true,
+               "send trash requests (must be true -- configure Collections.BalanceTrashLimit = 0 to disable.)")
        flags.BoolVar(&options.CommitConfirmedFields, "commit-confirmed-fields", true,
                "update collection fields (replicas_confirmed, storage_classes_confirmed, etc.)")
        flags.StringVar(&options.ChunkPrefix, "chunk-prefix", "",
@@ -55,6 +55,13 @@ func (command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
                return code
        }
 
+       if !*deprCommitPulls || !*deprCommitTrash {
+               fmt.Fprint(stderr,
+                       "Usage error: the -commit-pulls or -commit-trash command line flags are no longer supported.\n",
+                       "Use Collections.BalancePullLimit and Collections.BalanceTrashLimit instead.\n")
+               return cmd.EX_USAGE
+       }
+
        // Drop our custom args that would be rejected by the generic
        // service.Command
        args = nil