Revision 9c71582f lib/cmdlib/instance_operation.py
b/lib/cmdlib/instance_operation.py | ||
---|---|---|
42 | 42 |
ShutdownInstanceDisks |
43 | 43 |
from ganeti.cmdlib.instance_utils import BuildInstanceHookEnvByObject, \ |
44 | 44 |
CheckInstanceBridgesExist, CheckNodeFreeMemory, CheckNodeHasOS |
45 |
from ganeti.hypervisor import hv_base |
|
45 | 46 |
|
46 | 47 |
|
47 | 48 |
class LUInstanceStartup(LogicalUnit): |
... | ... | |
135 | 136 |
remote_info.Raise("Error checking node %s" % |
136 | 137 |
self.cfg.GetNodeName(self.instance.primary_node), |
137 | 138 |
prereq=True, ecode=errors.ECODE_ENVIRON) |
138 |
if not remote_info.payload: # not running already |
|
139 |
if remote_info.payload: |
|
140 |
if hv_base.HvInstanceState.IsShutdown(remote_info.payload["state"]): |
|
141 |
raise errors.OpPrereqError("Instance '%s' was shutdown by the user," |
|
142 |
" please shutdown the instance before" |
|
143 |
" starting it again" % self.instance.name, |
|
144 |
errors.ECODE_INVAL) |
|
145 |
else: # not running already |
|
139 | 146 |
CheckNodeFreeMemory( |
140 | 147 |
self, self.instance.primary_node, |
141 | 148 |
"starting instance %s" % self.instance.name, |
Also available in: Unified diff