[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [libvirt-glib 4/4] Implement gvir_config_domain_get_devices



On Wed, Jan 04, 2012 at 10:50:18AM +0400, Christophe Fergeau wrote:
> On Tue, Jan 03, 2012 at 10:08:10PM +0000, Daniel P. Berrange wrote:
> > Agreed, the way we deal with the XML docs ensures we preserve
> > any parts of the DOM we don't know about. IMHO we should only
> > emit a warning if there is a bit of the DOM we don't expect
> > and we are loosing that data during the requested manipulation.
> 
> I'll change these warnings to g_debug then

I just squashed the diff below in this patch:


diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c b/libvirt-gconfig/libvirt-gconfig-domain-device.c
index a9ae8e8..8399da2 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
@@ -98,7 +98,7 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
     } else if (xmlStrEqual(tree->name, (xmlChar*)"memballoon")) {
         type = GVIR_TYPE_CONFIG_DOMAIN_MEMBALLOON;
     } else {
-        g_warning("Unknown device node: %s", tree->name);
+        g_debug("Unknown device node: %s", tree->name);
         return NULL;
     }
 
@@ -106,7 +106,6 @@ gvir_config_domain_device_new_from_tree(GVirConfigXmlDoc *doc,
 
     return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(type, doc, NULL, tree));
 unimplemented:
-    g_warning("Parsing of '%s' device nodes is unimplemented",
-            tree->name);
+    g_debug("Parsing of '%s' device nodes is unimplemented", tree->name);
     return NULL;
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
index 53d5e66..6caf7cf 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
@@ -67,16 +67,18 @@ gvir_config_domain_graphics_new_from_tree(GVirConfigXmlDoc *doc,
     } else if (xmlStrEqual(type, (xmlChar*)"spice")) {
         gtype = GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SPICE;
     } else if (xmlStrEqual(type, (xmlChar*)"rdp")) {
-        g_warning("Parsing of '%s' graphics nodes is unimplemented", type);
-        return NULL;
+        goto unimplemented;
     } else if (xmlStrEqual(type, (xmlChar*)"desktop")) {
-        g_warning("Parsing of '%s' graphics nodes is unimplemented", type);
-        return NULL;
+        goto unimplemented;
     } else {
-        g_warning("Unknown graphics node: %s", type);
+        g_debug("Unknown graphics node: %s", type);
         return NULL;
     }
     xmlFree(type);
 
     return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(gtype, doc, NULL, tree));
+
+unimplemented:
+    g_debug("Parsing of '%s' graphics nodes is unimplemented", type);
+    return NULL;
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
index 0f427ff..58e2dd9 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
@@ -122,7 +122,7 @@ gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
     } else if (xmlStrEqual(type, (xmlChar*)"ethernet")) {
         goto unimplemented;
     } else {
-        g_warning("Unknown domain interface node: %s", type);
+        g_debug("Unknown domain interface node: %s", type);
         return NULL;
     }
     xmlFree(type);
@@ -130,6 +130,6 @@ gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
     return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(gtype, doc, NULL, tree));
 
 unimplemented:
-    g_warning("Parsing of '%s' domain interface nodes is unimplemented", type);
+    g_debug("Parsing of '%s' domain interface nodes is unimplemented", type);
     return NULL;
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 26ffc87..d953826 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -374,9 +374,10 @@ static gboolean add_one_device(xmlNodePtr node, gpointer opaque)
     GVirConfigDomainDevice *device;
 
     device = gvir_config_domain_device_new_from_tree(data->doc, node);
-    g_warn_if_fail(device != NULL);
     if (device != NULL)
         data->devices = g_list_append(data->devices, device);
+    else
+        g_debug("Failed to parse %s node", node->name);
 
     return TRUE;
 }

Attachment: pgp2KuyvvXmJx.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]