Revision 51c6e7b5 scripts/gnt-instance

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