[Kimchi-devel] [PATCH] Supress error messages while checking vm metadata
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Fri Apr 24 18:04:19 UTC 2015
From: Ramon Medeiros <ramonn at jarvis.br.ibm.com>
The function FeatureTests.disable_libvirt_error_logging only removes the
error message that will be displayed on the console. Libvirt also logs
errors on messages log. To avoid flood messages log with metadata
errors, it will be verified manually if the xml has the tag.
Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
src/kimchi/model/utils.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/kimchi/model/utils.py b/src/kimchi/model/utils.py
index b2739b2..749be93 100644
--- a/src/kimchi/model/utils.py
+++ b/src/kimchi/model/utils.py
@@ -22,6 +22,7 @@ import socket
import urlparse
from lxml import etree, objectify
from lxml.builder import E, ElementMaker
+from xml.dom import minidom
from kimchi.exception import OperationFailed
from kimchi.model.featuretests import FeatureTests
@@ -95,6 +96,13 @@ def _kimchi_set_metadata_node(dom, node):
def libvirt_get_kimchi_metadata_node(dom, mode="current"):
+ # check xml for metadata tag
+ xml = minidom.parseString(dom.XMLDesc(0))
+
+ # no metadata: return
+ if not xml.getElementsByTagName('metadata'):
+ return None
+
FeatureTests.disable_libvirt_error_logging()
try:
xml = dom.metadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT,
--
2.1.0
More information about the Kimchi-devel
mailing list