From 8449cd173de5311c987b7a76e0acae68ef1a0c71 Mon Sep 17 00:00:00 2001 From: Antoine Millet Date: Wed, 17 Jun 2015 12:24:21 +0200 Subject: [PATCH] Implemented rescue tag on VM --- cloudcontrol/node/hypervisor/domains/vm_tags.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cloudcontrol/node/hypervisor/domains/vm_tags.py b/cloudcontrol/node/hypervisor/domains/vm_tags.py index 3a52b6c..b6f1c91 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 -- GitLab