Revision cc27265e

b/lib/cmdlib.py
5231 5231
    ignore_secondaries = self.op.ignore_secondaries
5232 5232
    reboot_type = self.op.reboot_type
5233 5233

  
5234
    remote_info = self.rpc.call_instance_info(instance.primary_node,
5235
                                              instance.name,
5236
                                              instance.hypervisor)
5237
    remote_info.Raise("Error checking node %s" % instance.primary_node)
5238
    instance_running = bool(remote_info.payload)
5239

  
5234 5240
    node_current = instance.primary_node
5235 5241

  
5236
    if reboot_type in [constants.INSTANCE_REBOOT_SOFT,
5237
                       constants.INSTANCE_REBOOT_HARD]:
5242
    if instance_running and reboot_type in [constants.INSTANCE_REBOOT_SOFT,
5243
                                            constants.INSTANCE_REBOOT_HARD]:
5238 5244
      for disk in instance.disks:
5239 5245
        self.cfg.SetDiskID(disk, node_current)
5240 5246
      result = self.rpc.call_instance_reboot(node_current, instance,
......
5242 5248
                                             self.op.shutdown_timeout)
5243 5249
      result.Raise("Could not reboot instance")
5244 5250
    else:
5245
      result = self.rpc.call_instance_shutdown(node_current, instance,
5246
                                               self.op.shutdown_timeout)
5247
      result.Raise("Could not shutdown instance for full reboot")
5248
      _ShutdownInstanceDisks(self, instance)
5251
      if instance_running:
5252
        result = self.rpc.call_instance_shutdown(node_current, instance,
5253
                                                 self.op.shutdown_timeout)
5254
        result.Raise("Could not shutdown instance for full reboot")
5255
        _ShutdownInstanceDisks(self, instance)
5256
      else:
5257
        self.LogInfo("Instance %s was already stopped, starting now",
5258
                     instance.name)
5249 5259
      _StartInstanceDisks(self, instance, ignore_secondaries)
5250 5260
      result = self.rpc.call_instance_start(node_current, instance, None, None)
5251 5261
      msg = result.fail_msg
b/qa/qa_instance.py
34 34
import qa_utils
35 35
import qa_error
36 36

  
37
from qa_utils import AssertIn, AssertCommand
37
from qa_utils import AssertIn, AssertCommand, AssertEqual
38 38

  
39 39

  
40 40
def _GetDiskStatePath(disk):
......
104 104
  for rtype in reboot_types:
105 105
    AssertCommand(["gnt-instance", "reboot", "--type=%s" % rtype, name])
106 106

  
107
  AssertCommand(["gnt-instance", "shutdown", name])
108
  AssertCommand(["gnt-instance", "reboot", name])
109

  
110
  master = qa_config.GetMasterNode()
111
  cmd = ["gnt-instance", "list", "--no-header", "-o", "status", name]
112
  result_output = qa_utils.GetCommandOutput(master["primary"],
113
                                            utils.ShellQuoteArgs(cmd))
114
  AssertEqual(result_output.strip(), constants.INSTST_RUNNING)
115

  
107 116

  
108 117
def TestInstanceReinstall(instance):
109 118
  """gnt-instance reinstall"""

Also available in: Unified diff