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
|