[libvirt-glib PATCHv3 15/27] Add gvir_config_domain_set_devices

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

 



--
v2: use g_return_if_fail to test function args for sanity
---
 libvirt-gconfig/libvirt-gconfig-domain.c |   23 +++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain.h |    2 ++
 libvirt-gconfig/libvirt-gconfig.sym      |    3 ++-
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 3f84b5f..6cee46f 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -290,3 +290,26 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain,
     os_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(os));
     gvir_config_object_set_child(GVIR_CONFIG_OBJECT(domain), os_node);
 }
+
+/**
+ * gvir_config_domain_set_devices:
+ * @devices: (in) (element-type LibvirtGConfig.DomainDevice):
+ */
+void gvir_config_domain_set_devices(GVirConfigDomain *domain,
+                                    GList *devices)
+{
+    xmlNodePtr devices_node;
+    GList *it;
+
+    g_return_if_fail(GVIR_IS_CONFIG_DOMAIN(domain));
+
+    devices_node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(domain),
+                                                    "devices");
+    for (it = devices; it != NULL; it = it->next) {
+        GVirConfigDomainDevice *device = GVIR_CONFIG_DOMAIN_DEVICE(it->data);
+        xmlNodePtr node;
+
+        node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(device));
+        xmlAddChild(devices_node, node);
+    }
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 4989901..08682aa 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -79,6 +79,8 @@ void gvir_config_domain_set_clock(GVirConfigDomain *domain,
                                   GVirConfigDomainClock *klock);
 void gvir_config_domain_set_os(GVirConfigDomain *domain,
                                GVirConfigDomainOs *os);
+void gvir_config_domain_set_devices(GVirConfigDomain *domain,
+                                    GList *devices);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 258c1f3..44c2e11 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -8,13 +8,14 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_domain_new;
 	gvir_config_domain_new_from_xml;
 	gvir_config_domain_set_clock;
-	gvir_config_domain_set_os;
+	gvir_config_domain_set_devices;
 	gvir_config_domain_get_features;
 	gvir_config_domain_set_features;
 	gvir_config_domain_get_memory;
 	gvir_config_domain_set_memory;
 	gvir_config_domain_get_name;
 	gvir_config_domain_set_name;
+	gvir_config_domain_set_os;
 	gvir_config_domain_get_vcpus;
 	gvir_config_domain_set_vcpus;
 
-- 
1.7.7.3

--
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]