Revision 57d0151e

b/lib/cli.py
251 251
           "\n%(bin)s <command> --help to see details, or"
252 252
           " man %(bin)s\n" % {"bin": binary})
253 253
    # compute the max line length for cmd + usage
254
    mlen = max([len(" %s %s" % (cmd, commands[cmd][3])) for cmd in commands])
254
    mlen = max([len(" %s" % cmd) for cmd in commands])
255 255
    mlen = min(60, mlen) # should not get here...
256 256
    # and format a nice command list
257 257
    print "Commands:"
258 258
    for cmd in sortedcmds:
259
      cmdstr = " %s %s" % (cmd, commands[cmd][3])
260
      help_text = commands[cmd][4]
259
      cmdstr = " %s" % (cmd,)
260
      help_text = commands[cmd][3]
261 261
      help_lines = textwrap.wrap(help_text, 79-3-mlen)
262
      print "%-*s - %s" % (mlen, cmdstr,
263
                                          help_lines.pop(0))
262
      print "%-*s - %s" % (mlen, cmdstr, help_lines.pop(0))
264 263
      for line in help_lines:
265 264
        print "%-*s   %s" % (mlen, "", line)
266 265
    print
b/scripts/gnt-backup
177 177
                        help="List only backups stored on this node"
178 178
                             " (can be used multiple times)"),
179 179
            ],
180
           "", "Lists instance exports available in the ganeti cluster"),
180
           "Lists instance exports available in the ganeti cluster"),
181 181
  'export': (ExportInstance, ARGS_ONE,
182 182
             [DEBUG_OPT, FORCE_OPT,
183 183
              make_option("-n", "--node", dest="node", help="Target node",
......
185 185
              make_option("","--noshutdown", dest="shutdown",
186 186
                          action="store_false", default=True,
187 187
                          help="Don't shutdown the instance (unsafe)"), ],
188
             "-n <target_node> [opts...] <name>",
189 188
             "Exports an instance to an image"),
190
  'import': (ImportInstance, ARGS_ONE, import_opts, "[opts...] <name>",
189
  'import': (ImportInstance, ARGS_ONE, import_opts,
191 190
             "Imports an instance from an exported image"),
192 191
  'remove': (RemoveExport, ARGS_ONE,
193 192
             [DEBUG_OPT],
194
             "<name>",
195 193
             "Remove exports of named instance from the filesystem."),
196 194
  }
197 195

  
b/scripts/gnt-cluster
359 359
                             " (cluster-wide)",
360 360
                        action="store_false", default=True,),
361 361
            ],
362
           "[opts...] <cluster_name>",
363 362
           "Initialises a new cluster configuration"),
364 363
  'destroy': (DestroyCluster, ARGS_NONE,
365 364
              [DEBUG_OPT,
......
367 366
                           help="Destroy cluster",
368 367
                           action="store_true"),
369 368
              ],
370
              "", "Destroy cluster"),
369
              "Destroy cluster"),
371 370
  'rename': (RenameCluster, ARGS_ONE, [DEBUG_OPT, FORCE_OPT],
372
               "<new_name>",
373 371
               "Renames the cluster"),
374 372
  'verify': (VerifyCluster, ARGS_NONE, [DEBUG_OPT,
375 373
             make_option("--no-nplus1-mem", dest="skip_nplusone_mem",
......
377 375
                         action="store_true",
378 376
                         default=False,),
379 377
             ],
380
             "", "Does a check on the cluster configuration"),
378
             "Does a check on the cluster configuration"),
381 379
  'verify-disks': (VerifyDisks, ARGS_NONE, [DEBUG_OPT],
382
                   "", "Does a check on the cluster disk status"),
380
                   "Does a check on the cluster disk status"),
383 381
  'masterfailover': (MasterFailover, ARGS_NONE, [DEBUG_OPT],
384
                     "", "Makes the current node the master"),
382
                     "Makes the current node the master"),
385 383
  'version': (ShowClusterVersion, ARGS_NONE, [DEBUG_OPT],
386
              "", "Shows the cluster version"),
384
              "Shows the cluster version"),
387 385
  'getmaster': (ShowClusterMaster, ARGS_NONE, [DEBUG_OPT],
388
                "", "Shows the cluster master"),
386
                "Shows the cluster master"),
389 387
  'copyfile': (ClusterCopyFile, ARGS_ONE, [DEBUG_OPT, node_option],
390
               "[-n node...] <filename>",
391 388
               "Copies a file to all (or only some) nodes"),
392 389
  'command': (RunClusterCommand, ARGS_ATLEAST(1), [DEBUG_OPT, node_option],
393
              "[-n node...] <command>",
394 390
              "Runs a command on all (or only some) nodes"),
395 391
  'info': (ShowClusterConfig, ARGS_NONE, [DEBUG_OPT],
396
                 "", "Show cluster configuration"),
392
                 "Show cluster configuration"),
397 393
  'list-tags': (ListTags, ARGS_NONE,
398
                [DEBUG_OPT], "", "List the tags of the cluster"),
394
                [DEBUG_OPT], "List the tags of the cluster"),
399 395
  'add-tags': (AddTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT],
400
               "tag...", "Add tags to the cluster"),
396
               "Add tags to the cluster"),
401 397
  'remove-tags': (RemoveTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT],
402
                  "tag...", "Remove tags from the cluster"),
398
                  "Remove tags from the cluster"),
403 399
  'search-tags': (SearchTags, ARGS_ONE,
404
                  [DEBUG_OPT], "", "Searches the tags on all objects on"
400
                  [DEBUG_OPT], "Searches the tags on all objects on"
405 401
                  " the cluster for a given pattern (regex)"),
406 402
  'modify': (SetClusterParams, ARGS_NONE,
407 403
             [DEBUG_OPT,
b/scripts/gnt-debug
148 148
                         action="append",
149 149
                         help="Select nodes to sleep on"),
150 150
             ],
151
            "[opts...] <duration>", "Executes a TestDelay OpCode"),
151
            "Executes a TestDelay OpCode"),
152 152
  'submit-job': (GenericOpCodes, ARGS_ONE,
153 153
                 [DEBUG_OPT,
154 154
                  ],
155
                 "<op_list_file>", "Submits a job built from a json-file"
155
                 "Submits a job built from a json-file"
156 156
                 " with a list of serialized opcodes"),
157 157
  'allocator': (TestAllocator, ARGS_ONE,
158 158
                [DEBUG_OPT,
......
184 184
                 make_option("--tags", default=None,
185 185
                             help="Comma separated list of tags"),
186 186
                 ],
187
                "{opts...} <instance>", "Executes a TestAllocator OpCode"),
187
                "Executes a TestAllocator OpCode"),
188 188
  }
189 189

  
190 190

  
b/scripts/gnt-instance
795 795

  
796 796
commands = {
797 797
  'add': (AddInstance, ARGS_ONE, add_opts,
798
          "[opts...] <name>",
799 798
          "Creates and adds a new instance to the cluster"),
800 799
  'console': (ConnectToInstanceConsole, ARGS_ONE,
801 800
              [DEBUG_OPT,
802 801
               make_option("--show-cmd", dest="show_command",
803 802
                           action="store_true", default=False,
804 803
                           help=("Show command instead of executing it"))],
805
              "[--show-cmd] <instance>",
806 804
              "Opens a console on the specified instance"),
807 805
  'failover': (FailoverInstance, ARGS_ONE,
808 806
               [DEBUG_OPT, FORCE_OPT,
......
811 809
                            help="Ignore the consistency of the disks on"
812 810
                            " the secondary"),
813 811
                ],
814
               "[-f] <instance>",
815 812
               "Stops the instance and starts it on the backup node, using"
816 813
               " the remote mirror (only for instances of type drbd)"),
817
  'info': (ShowInstanceConfig, ARGS_ANY, [DEBUG_OPT], "[<instance>...]",
814
  'info': (ShowInstanceConfig, ARGS_ANY, [DEBUG_OPT],
818 815
           "Show information on the specified instance"),
819 816
  'list': (ListInstances, ARGS_NONE,
820
           [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], "",
817
           [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
821 818
           "Lists the instances and their status. The available fields are"
822 819
           " (see the man page for details): status, oper_state, oper_ram,"
823 820
           " name, os, pnode, snodes, admin_state, admin_ram, disk_template,"
......
825 822
           " list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
826 823
           ),
827 824
  'reinstall': (ReinstallInstance, ARGS_ONE, [DEBUG_OPT, FORCE_OPT, os_opt],
828
                "[-f] <instance>", "Reinstall a stopped instance"),
825
                "Reinstall a stopped instance"),
829 826
  'remove': (RemoveInstance, ARGS_ONE,
830 827
             [DEBUG_OPT, FORCE_OPT,
831 828
              make_option("--ignore-failures", dest="ignore_failures",
......
834 831
                                " if there are failures during the removal"
835 832
                                " process (shutdown, disk removal, etc.)")),
836 833
              ],
837
             "[-f] <instance>", "Shuts down the instance and removes it"),
834
             "Shuts down the instance and removes it"),
838 835
  'rename': (RenameInstance, ARGS_FIXED(2),
839 836
             [DEBUG_OPT,
840 837
              make_option("--no-ip-check", dest="ignore_ip",
......
842 839
                          " is alive",
843 840
                          default=False, action="store_true"),
844 841
              ],
845
             "<instance> <new_name>", "Rename the instance"),
842
             "Rename the instance"),
846 843
  'replace-disks': (ReplaceDisks, ARGS_ONE,
847 844
                    [DEBUG_OPT,
848 845
                     make_option("-n", "--new-secondary", dest="new_secondary",
......
867 864
                                 " secondary node replacement)",
868 865
                                 default=None, type="string"),
869 866
                     ],
870
                    "[-s|-p|-n NODE] <instance>",
871 867
                    "Replaces all disks for the instance"),
872 868
  'modify': (SetInstanceParams, ARGS_ONE,
873 869
             [DEBUG_OPT, FORCE_OPT,
......
899 895
                          "(either one or more of [acdn] or 'default')",
900 896
                          default=None, type="string", metavar="<BOOTORDER>"),
901 897
              ],
902
             "<instance>", "Alters the parameters of an instance"),
898
             "Alters the parameters of an instance"),
903 899
  'shutdown': (ShutdownInstance, ARGS_ANY,
904 900
               [DEBUG_OPT, m_node_opt, m_pri_node_opt, m_sec_node_opt,
905 901
                m_clust_opt, m_inst_opt, m_force_multi],
906
               "<instance>", "Stops an instance"),
902
               "Stops an instance"),
907 903
  'startup': (StartupInstance, ARGS_ANY,
908 904
              [DEBUG_OPT, FORCE_OPT, m_force_multi,
909 905
               make_option("-e", "--extra", dest="extra_args",
......
912 908
               m_node_opt, m_pri_node_opt, m_sec_node_opt,
913 909
               m_clust_opt, m_inst_opt,
914 910
               ],
915
            "<instance>", "Starts an instance"),
911
              "Starts an instance"),
916 912

  
917 913
  'reboot': (RebootInstance, ARGS_ANY,
918 914
              [DEBUG_OPT, m_force_multi,
......
929 925
               m_node_opt, m_pri_node_opt, m_sec_node_opt,
930 926
               m_clust_opt, m_inst_opt,
931 927
               ],
932
            "<instance>", "Reboots an instance"),
928
             "Reboots an instance"),
933 929
  'activate-disks': (ActivateDisks, ARGS_ONE, [DEBUG_OPT],
934
                     "<instance>",
935 930
                     "Activate an instance's disks"),
936 931
  'deactivate-disks': (DeactivateDisks, ARGS_ONE, [DEBUG_OPT],
937
                       "<instance>",
938 932
                       "Deactivate an instance's disks"),
939 933
  'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT],
940
                "<node_name>", "List the tags of the given instance"),
934
                "List the tags of the given instance"),
941 935
  'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
942
               "<node_name> tag...", "Add tags to the given instance"),
936
               "Add tags to the given instance"),
943 937
  'remove-tags': (RemoveTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
944
                  "<node_name> tag...", "Remove tags from given instance"),
938
                  "Remove tags from given instance"),
945 939
  }
946 940

  
947 941
aliases = {
b/scripts/gnt-job
95 95

  
96 96
commands = {
97 97
  'list': (ListJobs, ARGS_NONE,
98
            [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
99
            "", "List the jobs and their status. The available fields are"
98
           [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
99
           "List the jobs and their status. The available fields are"
100 100
           " (see the man page for details): id, status, op_list,"
101 101
           " op_status, op_result."
102 102
           " The default field"
b/scripts/gnt-node
295 295
                       default=False, action="store_true",
296 296
                       help="Readd old node after replacing it"),
297 297
           ],
298
          "[-s ip] <node_name>", "Add a node to the cluster"),
298
          "Add a node to the cluster"),
299 299
  'evacuate': (EvacuateNode, ARGS_FIXED(2),
300 300
               [DEBUG_OPT, FORCE_OPT],
301
               "[-f] <src> <dst>",
302 301
               "Relocate the secondary instances from the first node"
303 302
               " to the second one (only for instances of type remote_raid1"
304 303
               " drbd)"),
......
309 308
                            help="Ignore the consistency of the disks on"
310 309
                            " the secondary"),
311 310
                ],
312
               "[-f] <node>",
313 311
               "Stops the primary instances on a node and start them on their"
314 312
               " secondary node (only for instances of type remote_raid1)"),
315 313
  'info': (ShowNodeConfig, ARGS_ANY, [DEBUG_OPT],
316
           "[<node_name>...]", "Show information about the node(s)"),
314
           "Show information about the node(s)"),
317 315
  'list': (ListNodes, ARGS_NONE,
318 316
           [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
319
           "", "Lists the nodes in the cluster. The available fields"
317
           "Lists the nodes in the cluster. The available fields"
320 318
           " are (see the man page for details): name, pinst_cnt, pinst_list,"
321 319
           " sinst_cnt, sinst_list, pip, sip, dtotal, dfree, mtotal, mnode,"
322 320
           " mfree, bootid, cpu_count. The default field list is"
323 321
           " (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
324 322
           ),
325 323
  'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT],
326
             "<node_name>", "Removes a node from the cluster"),
324
             "Removes a node from the cluster"),
327 325
  'volumes': (ListVolumes, ARGS_ANY,
328 326
              [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT],
329
              "[<node_name>...]", "List logical volumes on node(s)"),
327
              "List logical volumes on node(s)"),
330 328
  'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT],
331
                "<node_name>", "List the tags of the given node"),
329
                "List the tags of the given node"),
332 330
  'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
333
               "<node_name> tag...", "Add tags to the given node"),
331
               "Add tags to the given node"),
334 332
  'remove-tags': (RemoveTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
335
                  "<node_name> tag...", "Remove tags from the given node"),
333
                  "Remove tags from the given node"),
336 334
  }
337 335

  
338 336

  
b/scripts/gnt-os
116 116

  
117 117

  
118 118
commands = {
119
  'list': (ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT], "",
119
  'list': (ListOS, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT],
120 120
           "Lists all valid OSes on the master"),
121
  'diagnose': (DiagnoseOS, ARGS_NONE, [DEBUG_OPT], "",
121
  'diagnose': (DiagnoseOS, ARGS_NONE, [DEBUG_OPT],
122 122
               "Diagnose all OSes"),
123 123
  }
124 124

  

Also available in: Unified diff