[libvirt-glib 07/23] Add gvir_config_domain_new to create an empty domain

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

 



---
 libvirt-gconfig/libvirt-gconfig-domain.c |   12 ++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h |    1 +
 libvirt-gconfig/libvirt-gconfig.sym      |    1 +
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 2b9419e..7ae10b8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -103,6 +103,18 @@ GVirConfigDomain *gvir_config_domain_new_from_xml(const gchar *xml)
                                            NULL));
 }
 
+GVirConfigDomain *gvir_config_domain_new(void)
+{
+    xmlDocPtr doc;
+
+    doc = xmlNewDoc((xmlChar *)"1.0");
+    doc->children = xmlNewDocNode(doc, NULL, (xmlChar *)"domain", NULL);
+    return GVIR_CONFIG_DOMAIN(g_object_new(GVIR_TYPE_CONFIG_DOMAIN,
+                                           "node", doc->children,
+                                           "schema", DATADIR "/libvirt/schemas/domain.rng",
+                                           NULL));
+}
+
 /* FIXME: do we add a GError ** to all getters in case there's an XML
  * parsing error? Doesn't work with gobject properties
  * => have a function to test if an error has occurred a la cairo?
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 343f076..baa94c6 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -60,6 +60,7 @@ struct _GVirConfigDomainClass
 GType gvir_config_domain_get_type(void);
 
 GVirConfigDomain *gvir_config_domain_new_from_xml(const gchar *xml);
+GVirConfigDomain *gvir_config_domain_new(void);
 
 char *gvir_config_domain_get_name(GVirConfigDomain *domain);
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 76e2ba2..8702a76 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -4,6 +4,7 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_capabilities_new;
 
 	gvir_config_domain_get_type;
+	gvir_config_domain_new;
 	gvir_config_domain_new_from_xml;
 	gvir_config_domain_get_name;
 
-- 
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]