Revision 48bba9de lib/hypervisor/hv_xen.py
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
414 | 414 |
""" |
415 | 415 |
utils.RemoveFile(self._ConfigFileName(instance_name)) |
416 | 416 |
|
417 |
def _StashConfigFile(self, instance_name): |
|
418 |
"""Move the Xen config file to the log directory and return its new path. |
|
419 |
|
|
420 |
""" |
|
421 |
old_filename = self._ConfigFileName(instance_name) |
|
422 |
base = ("%s-%s" % |
|
423 |
(instance_name, utils.TimestampForFilename())) |
|
424 |
new_filename = utils.PathJoin(pathutils.LOG_XEN_DIR, base) |
|
425 |
utils.RenameFile(old_filename, new_filename) |
|
426 |
return new_filename |
|
427 |
|
|
417 | 428 |
def _GetXmList(self, include_node): |
418 | 429 |
"""Wrapper around module level L{_GetXmList}. |
419 | 430 |
|
... | ... | |
482 | 493 |
|
483 | 494 |
result = self._RunXen(cmd) |
484 | 495 |
if result.failed: |
485 |
raise errors.HypervisorError("Failed to start instance %s: %s (%s)" % |
|
496 |
# Move the Xen configuration file to the log directory to avoid |
|
497 |
# leaving a stale config file behind. |
|
498 |
stashed_config = self._StashConfigFile(instance.name) |
|
499 |
raise errors.HypervisorError("Failed to start instance %s: %s (%s). Moved" |
|
500 |
" config file to %s" % |
|
486 | 501 |
(instance.name, result.fail_reason, |
487 |
result.output)) |
|
502 |
result.output, stashed_config))
|
|
488 | 503 |
|
489 | 504 |
def StopInstance(self, instance, force=False, retry=False, name=None): |
490 | 505 |
"""Stop an instance. |
Also available in: Unified diff