Revision 51c6e7b5

b/man/gnt-instance.sgml
797 797
        <title>CONSOLE</title>
798 798
        <cmdsynopsis>
799 799
          <command>console</command>
800
          <arg choice="opt">--show-cmd</arg>
800 801
          <arg choice="req"><replaceable>instance</replaceable></arg>
801 802
        </cmdsynopsis>
802 803

  
803 804
        <para>
804 805
          Connects to the console of the given instance. If the instance
805
          is not up, an error is returned.
806
          is not up, an error is returned. Use the <option>--show-cmd</option>
807
          option to display the command instead of executing it.
806 808
        </para>
807 809

  
808 810
        <para>
b/scripts/gnt-instance
506 506

  
507 507
  op = opcodes.OpConnectConsole(instance_name=instance_name)
508 508
  cmd = SubmitOpCode(op)
509
  # drop lock and exec so other commands can run while we have console
510
  utils.Unlock("cmd")
511
  try:
512
    os.execvp(cmd[0], cmd)
513
  finally:
514
    sys.stderr.write("Can't run console command %s with arguments:\n'%s'" %
515
                     (cmd, " ".join(argv)))
516
    os._exit(1)
509

  
510
  if opts.show_command:
511
    print utils.ShellQuoteArgs(cmd)
512
  else:
513
    # drop lock and exec so other commands can run while we have console
514
    utils.Unlock("cmd")
515
    try:
516
      os.execvp(cmd[0], cmd)
517
    finally:
518
      sys.stderr.write("Can't run console command %s with arguments:\n'%s'" %
519
                       (cmd, " ".join(argv)))
520
      os._exit(1)
517 521

  
518 522

  
519 523
def _FormatBlockDevInfo(buf, dev, indent_level):
......
762 766
  'add': (AddInstance, ARGS_ONE, add_opts,
763 767
          "[opts...] <name>",
764 768
          "Creates and adds a new instance to the cluster"),
765
  'console': (ConnectToInstanceConsole, ARGS_ONE, [DEBUG_OPT],
766
              "<instance>",
769
  'console': (ConnectToInstanceConsole, ARGS_ONE,
770
              [DEBUG_OPT,
771
               make_option("--show-cmd", dest="show_command",
772
                           action="store_true", default=False,
773
                           help=("Show command instead of executing it"))],
774
              "[--show-cmd] <instance>",
767 775
              "Opens a console on the specified instance"),
768 776
  'failover': (FailoverInstance, ARGS_ONE,
769 777
               [DEBUG_OPT, FORCE_OPT,

Also available in: Unified diff