Revision 1fa6fcba lib/backend.py
b/lib/backend.py | ||
---|---|---|
1328 | 1328 |
return block_devices |
1329 | 1329 |
|
1330 | 1330 |
|
1331 |
def StartInstance(instance, startup_paused): |
|
1331 |
def StartInstance(instance, startup_paused, reason, store_reason=True):
|
|
1332 | 1332 |
"""Start an instance. |
1333 | 1333 |
|
1334 | 1334 |
@type instance: L{objects.Instance} |
1335 | 1335 |
@param instance: the instance object |
1336 | 1336 |
@type startup_paused: bool |
1337 | 1337 |
@param instance: pause instance at startup? |
1338 |
@type reason: list of reasons |
|
1339 |
@param reason: the reason trail for this startup |
|
1340 |
@type store_reason: boolean |
|
1341 |
@param store_reason: whether to store the shutdown reason trail on file |
|
1338 | 1342 |
@rtype: None |
1339 | 1343 |
|
1340 | 1344 |
""" |
... | ... | |
1348 | 1352 |
block_devices = _GatherAndLinkBlockDevs(instance) |
1349 | 1353 |
hyper = hypervisor.GetHypervisor(instance.hypervisor) |
1350 | 1354 |
hyper.StartInstance(instance, block_devices, startup_paused) |
1355 |
if store_reason: |
|
1356 |
_StoreInstReasonTrail(instance.name, reason) |
|
1351 | 1357 |
except errors.BlockDeviceError, err: |
1352 | 1358 |
_Fail("Block device error: %s", err, exc=True) |
1353 | 1359 |
except errors.HypervisorError, err: |
... | ... | |
1467 | 1473 |
elif reboot_type == constants.INSTANCE_REBOOT_HARD: |
1468 | 1474 |
try: |
1469 | 1475 |
InstanceShutdown(instance, shutdown_timeout, reason, store_reason=False) |
1470 |
result = StartInstance(instance, False) |
|
1476 |
result = StartInstance(instance, False, reason, store_reason=False)
|
|
1471 | 1477 |
_StoreInstReasonTrail(instance.name, reason) |
1472 | 1478 |
return result |
1473 | 1479 |
except errors.HypervisorError, err: |
Also available in: Unified diff