diff --git a/cloudcontrol/node/hypervisor/domains/vm_tags.py b/cloudcontrol/node/hypervisor/domains/vm_tags.py index 3a52b6cf8552792bec66babfcdf327bb3be9a7cd..b6f1c91c9af5a24bf4287a0c66787c17212cadc8 100644 --- a/cloudcontrol/node/hypervisor/domains/vm_tags.py +++ b/cloudcontrol/node/hypervisor/domains/vm_tags.py @@ -20,7 +20,10 @@ from xml.etree import cElementTree as et from StringIO import StringIO import libvirt -from cloudcontrol.common.client.tags import ttl, refresh + +from cloudcontrol.node.utils import execute + +from cloudcontrol.common.client.tags import ttl, refresh, background logger = logging.getLogger(__name__) @@ -55,6 +58,17 @@ def uuid(dom): return dom.uuid.lower() +@background +def rescue(dom): + """Is rescue mode enabled or not""" + rescue_path = dom.hypervisor.handler.main.config.rescue_script + rcode, output = execute(dom.hypervisor.handler.main, [rescue_path, '-s', dom.name]) + if rcode == 0: + return output.strip() + else: + return 'error' + + def status(dom): return dom.state