[libvirt-glib 14/23] Remove xml parsing from gvir_config_*_new functions

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

 



These functions now create empty config objects to be consistent
with what gvir_config_domain_new does.
---
 libvirt-gconfig/libvirt-gconfig-capabilities.c    |   10 ++++++++--
 libvirt-gconfig/libvirt-gconfig-capabilities.h    |    2 +-
 libvirt-gconfig/libvirt-gconfig-domain-snapshot.c |    9 +++++++--
 libvirt-gconfig/libvirt-gconfig-domain-snapshot.h |    2 +-
 libvirt-gconfig/libvirt-gconfig-interface.c       |   12 ++++++++----
 libvirt-gconfig/libvirt-gconfig-interface.h       |    2 +-
 libvirt-gconfig/libvirt-gconfig-network-filter.c  |    8 ++++++--
 libvirt-gconfig/libvirt-gconfig-network-filter.h  |    2 +-
 libvirt-gconfig/libvirt-gconfig-network.c         |    8 ++++++--
 libvirt-gconfig/libvirt-gconfig-network.h         |    2 +-
 libvirt-gconfig/libvirt-gconfig-node-device.c     |    9 +++++++--
 libvirt-gconfig/libvirt-gconfig-node-device.h     |    2 +-
 libvirt-gconfig/libvirt-gconfig-secret.c          |    8 ++++++--
 libvirt-gconfig/libvirt-gconfig-secret.h          |    2 +-
 libvirt-gconfig/libvirt-gconfig-storage-pool.c    |    8 ++++++--
 libvirt-gconfig/libvirt-gconfig-storage-pool.h    |    2 +-
 libvirt-gconfig/libvirt-gconfig-storage-vol.c     |   12 ++++++++----
 libvirt-gconfig/libvirt-gconfig-storage-vol.h     |    2 +-
 libvirt-gobject/libvirt-gobject-domain-snapshot.c |    3 +++
 libvirt-gobject/libvirt-gobject-interface.c       |    3 +++
 libvirt-gobject/libvirt-gobject-network-filter.c  |    3 +++
 libvirt-gobject/libvirt-gobject-network.c         |    3 +++
 libvirt-gobject/libvirt-gobject-node-device.c     |    4 ++++
 libvirt-gobject/libvirt-gobject-secret.c          |    4 ++++
 libvirt-gobject/libvirt-gobject-storage-pool.c    |    3 +++
 libvirt-gobject/libvirt-gobject-storage-vol.c     |    3 +++
 26 files changed, 97 insertions(+), 31 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities.c b/libvirt-gconfig/libvirt-gconfig-capabilities.c
index b881a17..8ed0e2e 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities.c
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities.c
@@ -61,10 +61,16 @@ static void gvir_config_capabilities_init(GVirConfigCapabilities *conn)
 }
 
 
-GVirConfigCapabilities *gvir_config_capabilities_new(const gchar *xml)
+GVirConfigCapabilities *gvir_config_capabilities_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    /* FIXME: what is the XML root of the capability node? I suspect it is
+     * either 'guest' or 'host' */
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"capabilities", NULL);
     return GVIR_CONFIG_CAPABILITIES(g_object_new(GVIR_TYPE_CONFIG_CAPABILITIES,
-                                                 "doc", xml,
+                                                 "node", doc->children,
                                                  "schema", DATADIR "/libvirt/schemas/capability.rng",
                                                  NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities.h b/libvirt-gconfig/libvirt-gconfig-capabilities.h
index 5b79cab..b5660df 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities.h
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities.h
@@ -59,7 +59,7 @@ struct _GVirConfigCapabilitiesClass
 
 GType gvir_config_capabilities_get_type(void);
 
-GVirConfigCapabilities *gvir_config_capabilities_new(const gchar *xml);
+GVirConfigCapabilities *gvir_config_capabilities_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c b/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c
index 841f7af..35f63ec 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c
@@ -61,10 +61,15 @@ static void gvir_config_domain_snapshot_init(GVirConfigDomainSnapshot *conn)
 }
 
 
-GVirConfigDomainSnapshot *gvir_config_domain_snapshot_new(const gchar *xml)
+GVirConfigDomainSnapshot *gvir_config_domain_snapshot_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"domainsnapshot", NULL);
+
     return GVIR_CONFIG_DOMAIN_SNAPSHOT(g_object_new(GVIR_TYPE_CONFIG_DOMAIN_SNAPSHOT,
-                                                    "doc", xml,
+                                                    "node", doc->children,
                                                     "schema", DATADIR "/libvirt/schemas/domainsnapshot.rng",
                                                     NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot.h b/libvirt-gconfig/libvirt-gconfig-domain-snapshot.h
index c6598c2..1924903 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-snapshot.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot.h
@@ -59,7 +59,7 @@ struct _GVirConfigDomainSnapshotClass
 
 GType gvir_config_domain_snapshot_get_type(void);
 
-GVirConfigDomainSnapshot *gvir_config_domain_snapshot_new(const gchar *xml);
+GVirConfigDomainSnapshot *gvir_config_domain_snapshot_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-interface.c b/libvirt-gconfig/libvirt-gconfig-interface.c
index 181ae52..48cbcfb 100644
--- a/libvirt-gconfig/libvirt-gconfig-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-interface.c
@@ -61,10 +61,14 @@ static void gvir_config_interface_init(GVirConfigInterface *conn)
 }
 
 
-GVirConfigInterface *gvir_config_interface_new(const gchar *xml)
+GVirConfigInterface *gvir_config_interface_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"interface", NULL);
     return GVIR_CONFIG_INTERFACE(g_object_new(GVIR_TYPE_CONFIG_INTERFACE,
-                                           "doc", xml,
-                                           "schema", DATADIR "/libvirt/schemas/interface.rng",
-                                           NULL));
+                                              "node", doc->children,
+                                              "schema", DATADIR "/libvirt/schemas/interface.rng",
+                                              NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-interface.h b/libvirt-gconfig/libvirt-gconfig-interface.h
index ca5e6cf..abfcc4e 100644
--- a/libvirt-gconfig/libvirt-gconfig-interface.h
+++ b/libvirt-gconfig/libvirt-gconfig-interface.h
@@ -59,7 +59,7 @@ struct _GVirConfigInterfaceClass
 
 GType gvir_config_interface_get_type(void);
 
-GVirConfigInterface *gvir_config_interface_new(const gchar *xml);
+GVirConfigInterface *gvir_config_interface_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-network-filter.c b/libvirt-gconfig/libvirt-gconfig-network-filter.c
index 783a5ed..1b4c22d 100644
--- a/libvirt-gconfig/libvirt-gconfig-network-filter.c
+++ b/libvirt-gconfig/libvirt-gconfig-network-filter.c
@@ -61,10 +61,14 @@ static void gvir_config_network_filter_init(GVirConfigNetworkFilter *conn)
 }
 
 
-GVirConfigNetworkFilter *gvir_config_network_filter_new(const gchar *xml)
+GVirConfigNetworkFilter *gvir_config_network_filter_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"filter", NULL);
     return GVIR_CONFIG_NETWORK_FILTER(g_object_new(GVIR_TYPE_CONFIG_NETWORK_FILTER,
-                                                   "doc", xml,
+                                                   "node", doc->children,
                                                    "schema", DATADIR "/libvirt/schemas/nwfilter.rng",
                                                    NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-network-filter.h b/libvirt-gconfig/libvirt-gconfig-network-filter.h
index 0d50b2c..c3f87b7 100644
--- a/libvirt-gconfig/libvirt-gconfig-network-filter.h
+++ b/libvirt-gconfig/libvirt-gconfig-network-filter.h
@@ -59,7 +59,7 @@ struct _GVirConfigNetworkFilterClass
 
 GType gvir_config_network_filter_get_type(void);
 
-GVirConfigNetworkFilter *gvir_config_network_filter_new(const gchar *xml);
+GVirConfigNetworkFilter *gvir_config_network_filter_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-network.c b/libvirt-gconfig/libvirt-gconfig-network.c
index a6310e3..f2d19f7 100644
--- a/libvirt-gconfig/libvirt-gconfig-network.c
+++ b/libvirt-gconfig/libvirt-gconfig-network.c
@@ -61,10 +61,14 @@ static void gvir_config_network_init(GVirConfigNetwork *conn)
 }
 
 
-GVirConfigNetwork *gvir_config_network_new(const gchar *xml)
+GVirConfigNetwork *gvir_config_network_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"network", NULL);
     return GVIR_CONFIG_NETWORK(g_object_new(GVIR_TYPE_CONFIG_NETWORK,
-                                           "doc", xml,
+                                           "node", doc->children,
                                            "schema", DATADIR "/libvirt/schemas/network.rng",
                                            NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-network.h b/libvirt-gconfig/libvirt-gconfig-network.h
index 79b80d0..f156971 100644
--- a/libvirt-gconfig/libvirt-gconfig-network.h
+++ b/libvirt-gconfig/libvirt-gconfig-network.h
@@ -59,7 +59,7 @@ struct _GVirConfigNetworkClass
 
 GType gvir_config_network_get_type(void);
 
-GVirConfigNetwork *gvir_config_network_new(const gchar *xml);
+GVirConfigNetwork *gvir_config_network_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-node-device.c b/libvirt-gconfig/libvirt-gconfig-node-device.c
index 8f028ee..a6e6d9e 100644
--- a/libvirt-gconfig/libvirt-gconfig-node-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-node-device.c
@@ -61,10 +61,15 @@ static void gvir_config_node_device_init(GVirConfigNodeDevice *conn)
 }
 
 
-GVirConfigNodeDevice *gvir_config_node_device_new(const gchar *xml)
+GVirConfigNodeDevice *gvir_config_node_device_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    /* FIXME: correct node name ? */
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"device", NULL);
     return GVIR_CONFIG_NODE_DEVICE(g_object_new(GVIR_TYPE_CONFIG_NODE_DEVICE,
-                                                "doc", xml,
+                                                "node", doc->children,
                                                 "schema", DATADIR "/libvirt/schemas/nodedev.rng",
                                                 NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-node-device.h b/libvirt-gconfig/libvirt-gconfig-node-device.h
index d9ddacf..720b580 100644
--- a/libvirt-gconfig/libvirt-gconfig-node-device.h
+++ b/libvirt-gconfig/libvirt-gconfig-node-device.h
@@ -59,7 +59,7 @@ struct _GVirConfigNodeDeviceClass
 
 GType gvir_config_node_device_get_type(void);
 
-GVirConfigNodeDevice *gvir_config_node_device_new(const gchar *xml);
+GVirConfigNodeDevice *gvir_config_node_device_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-secret.c b/libvirt-gconfig/libvirt-gconfig-secret.c
index 5b639a9..505de4c 100644
--- a/libvirt-gconfig/libvirt-gconfig-secret.c
+++ b/libvirt-gconfig/libvirt-gconfig-secret.c
@@ -61,10 +61,14 @@ static void gvir_config_secret_init(GVirConfigSecret *conn)
 }
 
 
-GVirConfigSecret *gvir_config_secret_new(const gchar *xml)
+GVirConfigSecret *gvir_config_secret_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"secret", NULL);
     return GVIR_CONFIG_SECRET(g_object_new(GVIR_TYPE_CONFIG_SECRET,
-                                           "doc", xml,
+                                           "node", doc->children,
                                            "schema", DATADIR "/libvirt/schemas/secret.rng",
                                            NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-secret.h b/libvirt-gconfig/libvirt-gconfig-secret.h
index 8163ef9..fbd4564 100644
--- a/libvirt-gconfig/libvirt-gconfig-secret.h
+++ b/libvirt-gconfig/libvirt-gconfig-secret.h
@@ -59,7 +59,7 @@ struct _GVirConfigSecretClass
 
 GType gvir_config_secret_get_type(void);
 
-GVirConfigSecret *gvir_config_secret_new(const gchar *xml);
+GVirConfigSecret *gvir_config_secret_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
index 3d6ce5e..ef32aeb 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
@@ -61,10 +61,14 @@ static void gvir_config_storage_pool_init(GVirConfigStoragePool *conn)
 }
 
 
-GVirConfigStoragePool *gvir_config_storage_pool_new(const gchar *xml)
+GVirConfigStoragePool *gvir_config_storage_pool_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"pool", NULL);
     return GVIR_CONFIG_STORAGE_POOL(g_object_new(GVIR_TYPE_CONFIG_STORAGE_POOL,
-                                                 "doc", xml,
+                                                 "node", doc->children,
                                                  "schema", DATADIR "/libvirt/schemas/storagepool.rng",
                                                  NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.h b/libvirt-gconfig/libvirt-gconfig-storage-pool.h
index fcf2fda..e5912f9 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool.h
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.h
@@ -59,7 +59,7 @@ struct _GVirConfigStoragePoolClass
 
 GType gvir_config_storage_pool_get_type(void);
 
-GVirConfigStoragePool *gvir_config_storage_pool_new(const gchar *xml);
+GVirConfigStoragePool *gvir_config_storage_pool_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.c b/libvirt-gconfig/libvirt-gconfig-storage-vol.c
index d3ac8de..886b1e0 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.c
@@ -61,10 +61,14 @@ static void gvir_config_storage_vol_init(GVirConfigStorageVol *conn)
 }
 
 
-GVirConfigStorageVol *gvir_config_storage_vol_new(const gchar *xml)
+GVirConfigStorageVol *gvir_config_storage_vol_new(void)
 {
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"volume", NULL);
     return GVIR_CONFIG_STORAGE_VOL(g_object_new(GVIR_TYPE_CONFIG_STORAGE_VOL,
-                                           "doc", xml,
-                                           "schema", DATADIR "/libvirt/schemas/storage_vol.rng",
-                                           NULL));
+                                                "node", doc->children,
+                                                "schema", DATADIR "/libvirt/schemas/storage_vol.rng",
+                                                NULL));
 }
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.h b/libvirt-gconfig/libvirt-gconfig-storage-vol.h
index 73032b6..08a2180 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol.h
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.h
@@ -59,7 +59,7 @@ struct _GVirConfigStorageVolClass
 
 GType gvir_config_storage_vol_get_type(void);
 
-GVirConfigStorageVol *gvir_config_storage_vol_new(const gchar *xml);
+GVirConfigStorageVol *gvir_config_storage_vol_new(void);
 
 G_END_DECLS
 
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index cc17b60..530907d 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -213,8 +213,11 @@ GVirConfigDomainSnapshot *gvir_domain_snapshot_get_config
         return NULL;
     }
 
+#if 0
     GVirConfigDomainSnapshot *conf = gvir_config_domain_snapshot_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+    return NULL;
 }
diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
index b37a7fa..2c56492 100644
--- a/libvirt-gobject/libvirt-gobject-interface.c
+++ b/libvirt-gobject/libvirt-gobject-interface.c
@@ -203,8 +203,11 @@ GVirConfigInterface *gvir_interface_get_config(GVirInterface *iface,
         return NULL;
     }
 
+#if 0
     GVirConfigInterface *conf = gvir_config_interface_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+    return NULL;
 }
diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
index eb10ce9..b043e42 100644
--- a/libvirt-gobject/libvirt-gobject-network-filter.c
+++ b/libvirt-gobject/libvirt-gobject-network-filter.c
@@ -228,8 +228,11 @@ GVirConfigNetworkFilter *gvir_network_filter_get_config
         return NULL;
     }
 
+#if 0
     GVirConfigNetworkFilter *conf = gvir_config_network_filter_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+    return NULL;
 }
diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
index 158afa4..34692fd 100644
--- a/libvirt-gobject/libvirt-gobject-network.c
+++ b/libvirt-gobject/libvirt-gobject-network.c
@@ -224,8 +224,11 @@ GVirConfigNetwork *gvir_network_get_config(GVirNetwork *network,
         return NULL;
     }
 
+#if 0
     GVirConfigNetwork *conf = gvir_config_network_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+    return NULL;
 }
diff --git a/libvirt-gobject/libvirt-gobject-node-device.c b/libvirt-gobject/libvirt-gobject-node-device.c
index 2847fc6..b3ae6bf 100644
--- a/libvirt-gobject/libvirt-gobject-node-device.c
+++ b/libvirt-gobject/libvirt-gobject-node-device.c
@@ -203,8 +203,12 @@ GVirConfigNodeDevice *gvir_node_device_get_config(GVirNodeDevice *device,
         return NULL;
     }
 
+#if 0
     GVirConfigNodeDevice *conf = gvir_config_node_device_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+
+    return NULL;
 }
diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
index ffff521..b39bac5 100644
--- a/libvirt-gobject/libvirt-gobject-secret.c
+++ b/libvirt-gobject/libvirt-gobject-secret.c
@@ -214,8 +214,12 @@ GVirConfigSecret *gvir_secret_get_config(GVirSecret *secret,
         return NULL;
     }
 
+#if 0
     GVirConfigSecret *conf = gvir_config_secret_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+
+    return NULL;
 }
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index 8cc481e..d790a92 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -239,10 +239,13 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
         return NULL;
     }
 
+#if 0
     GVirConfigStoragePool *conf = gvir_config_storage_pool_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+    return NULL;
 }
 
 typedef gint (* CountFunction) (virStoragePoolPtr vpool);
diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
index 6cbae84..0d94cd5 100644
--- a/libvirt-gobject/libvirt-gobject-storage-vol.c
+++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
@@ -214,8 +214,11 @@ GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
         return NULL;
     }
 
+#if 0
     GVirConfigStorageVol *conf = gvir_config_storage_vol_new(xml);
 
     g_free(xml);
     return conf;
+#endif
+    return NULL;
 }
-- 
1.7.6.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]