[Kimchi-devel] [PATCH] Disable metadata log output in every guest refresh

Sheldon shaohef at linux.vnet.ibm.com
Wed May 14 05:06:04 UTC 2014


Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>


On 05/14/2014 08:22 AM, Crístian Viana wrote:
> The libvirt function "metadata" always displays an error message when
> the VM does not have a metadata section in its XML descriptor. Kimchi
> refreshes the VM information every few seconds and a lot of error output
> is printed on the console. The real exception can still be logged by the
> "try/except" block, so the error itself is not being silenced, only its
> output.
>
> Even though this patch has no relation to feature tests, the functions which
> enable/disable the libvirt error messages are located inside the class
> FeatureTests so we need to import them.
>
> Silence the metadata error output when trying to read the metadata
> information from a VM.
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
>   src/kimchi/model/utils.py | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/kimchi/model/utils.py b/src/kimchi/model/utils.py
> index a94c7f8..c9ab1d4 100644
> --- a/src/kimchi/model/utils.py
> +++ b/src/kimchi/model/utils.py
> @@ -19,6 +19,7 @@
>   
>   import re
>   from kimchi.exception import OperationFailed
> +from kimchi.featuretests import FeatureTests
>   from kimchi.model.config import CapabilitiesModel
>   import libvirt
>   from lxml import etree
> @@ -84,6 +85,7 @@ def _kimchi_set_metadata_node(dom, node):
>   
>   
>   def libvirt_get_kimchi_metadata_node(dom, mode="current"):
> +    FeatureTests.disable_screen_error_logging()
>       try:
>           xml = dom.metadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT,
>                              KIMCHI_META_URL,
> @@ -91,6 +93,8 @@ def libvirt_get_kimchi_metadata_node(dom, mode="current"):
>           return etree.fromstring(xml)
>       except libvirt.libvirtError:
>           return None
> +    finally:
> +        FeatureTests.enable_screen_error_logging()
>   
>   
>   def set_metadata_node(dom, node, mode="all"):


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list