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

[libvirt] [libvirt-glib 1/2] Allow unsetting of string properties



From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>

This changes gvir_config_object_set_node_content to accept a NULL
content and to remove the corresponding node when this happens
---
 libvirt-gconfig/libvirt-gconfig-domain-os.c        |   20 ++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-seclabel.c  |    8 ++++++++
 libvirt-gconfig/libvirt-gconfig-domain.c           |    8 ++++++++
 libvirt-gconfig/libvirt-gconfig-object.c           |    7 ++++++-
 .../libvirt-gconfig-storage-permissions.c          |    4 ++++
 .../libvirt-gconfig-storage-pool-source.c          |    4 ++++
 .../libvirt-gconfig-storage-pool-target.c          |    4 ++++
 libvirt-gconfig/libvirt-gconfig-storage-pool.c     |    8 ++++++++
 .../libvirt-gconfig-storage-vol-backing-store.c    |    4 ++++
 libvirt-gconfig/libvirt-gconfig-storage-vol.c      |    4 ++++
 10 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c
index 86f90a2..74cdd4d 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-os.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c
@@ -81,6 +81,10 @@ void gvir_config_domain_os_set_os_type(GVirConfigDomainOs *os,
                                         "type", type_str);
 }
 
+/**
+ * gvir_config_domain_os_set_kernel:
+ * @kernel: (allow-none): The kernel path
+ */
 void gvir_config_domain_os_set_kernel(GVirConfigDomainOs *os,
                                       const char * kernel)
 {
@@ -88,6 +92,10 @@ void gvir_config_domain_os_set_kernel(GVirConfigDomainOs *os,
                                         "kernel", kernel);
 }
 
+/**
+ * gvir_config_domain_os_set_ramdisk:
+ * @ramdisk: (allow-none): The ramdisk path
+ */
 void gvir_config_domain_os_set_ramdisk(GVirConfigDomainOs *os,
                                        const char * ramdisk)
 {
@@ -95,6 +103,10 @@ void gvir_config_domain_os_set_ramdisk(GVirConfigDomainOs *os,
                                         "initrd", ramdisk);
 }
 
+/**
+ * gvir_config_domain_os_set_cmdline:
+ * @cmdline: (allow-none): The direct boot commandline
+ */
 void gvir_config_domain_os_set_cmdline(GVirConfigDomainOs *os,
                                        const char * cmdline)
 {
@@ -102,6 +114,10 @@ void gvir_config_domain_os_set_cmdline(GVirConfigDomainOs *os,
                                         "cmdline", cmdline);
 }
 
+/**
+ * gvir_config_domain_os_set_init:
+ * @init: (allow-none):
+ */
 void gvir_config_domain_os_set_init(GVirConfigDomainOs *os,
                                     const char * init)
 {
@@ -109,6 +125,10 @@ void gvir_config_domain_os_set_init(GVirConfigDomainOs *os,
                                         "init", init);
 }
 
+/**
+ * gvir_config_domain_os_set_loader:
+ * @loader: (allow-none):
+ */
 void gvir_config_domain_os_set_loader(GVirConfigDomainOs *os,
                                       const char * loader)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c
index cc83797..9d9ec33 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-seclabel.c
@@ -89,6 +89,10 @@ void gvir_config_domain_seclabel_set_model(GVirConfigDomainSeclabel *seclabel,
 
 }
 
+/**
+ * gvir_config_domain_seclabel_set_baselabel:
+ * @label: (allow-none):
+ */
 void gvir_config_domain_seclabel_set_baselabel(GVirConfigDomainSeclabel *seclabel,
                                                const char *label)
 {
@@ -98,6 +102,10 @@ void gvir_config_domain_seclabel_set_baselabel(GVirConfigDomainSeclabel *seclabe
                                         "baselabel", label);
 }
 
+/**
+ * gvir_config_domain_seclabel_set_label:
+ * @label: (allow-none):
+ */
 void gvir_config_domain_seclabel_set_label(GVirConfigDomainSeclabel *seclabel,
                                            const char *label)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index b95515e..d100009 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -204,6 +204,10 @@ const char *gvir_config_domain_get_name(GVirConfigDomain *domain)
                                                "name");
 }
 
+/**
+ * gvir_config_domain_set_name:
+ * @name: (allow-none):
+ */
 void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
 {
     gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
@@ -217,6 +221,10 @@ const char *gvir_config_domain_get_description(GVirConfigDomain *domain)
                                                "description");
 }
 
+/**
+ * gvir_config_domain_set_description:
+ * @description: (allow-none):
+ */
 void gvir_config_domain_set_description(GVirConfigDomain *domain, const char *description)
 {
     gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 3dac59a..288bbc4 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -537,7 +537,12 @@ gvir_config_object_set_node_content(GVirConfigObject *object,
 
     g_return_if_fail(GVIR_CONFIG_IS_OBJECT(object));
     g_return_if_fail(node_name != NULL);
-    g_return_if_fail(value != NULL);
+
+    if (value == NULL) {
+        gvir_config_object_delete_child(object, node_name, NULL);
+
+        return;
+    }
 
     node = gvir_config_object_replace_child(object, node_name);
     g_return_if_fail(node != NULL);
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-permissions.c b/libvirt-gconfig/libvirt-gconfig-storage-permissions.c
index 57e50c4..5c0d40f 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-permissions.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-permissions.c
@@ -79,6 +79,10 @@ void gvir_config_storage_permissions_set_group(GVirConfigStoragePermissions *per
                                                "group", group);
 }
 
+/**
+ * gvir_config_storage_permissions_set_label:
+ * @label: (allow-none):
+ */
 void gvir_config_storage_permissions_set_label(GVirConfigStoragePermissions *perms,
                                                const char *label)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c
index d92c692..c9a14da 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-source.c
@@ -136,6 +136,10 @@ void gvir_config_storage_pool_source_set_host(GVirConfigStoragePoolSource *sourc
     g_object_unref(G_OBJECT(node));
 }
 
+/**
+ * gvir_config_storage_pool_source_set_name:
+ * @name: (allow-none):
+ */
 void gvir_config_storage_pool_source_set_name(GVirConfigStoragePoolSource *source,
                                               const char *name)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c
index 0d7f164..bf97194 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool-target.c
@@ -71,6 +71,10 @@ GVirConfigStoragePoolTarget *gvir_config_storage_pool_target_new_from_xml(const
     return GVIR_CONFIG_STORAGE_POOL_TARGET(object);
 }
 
+/**
+ * gvir_config_storage_pool_target_set_path:
+ * @path: (allow-none):
+ */
 void gvir_config_storage_pool_target_set_path(GVirConfigStoragePoolTarget *target,
                                               const char *path)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
index c524c17..1bbcfe9 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
@@ -86,6 +86,10 @@ void gvir_config_storage_pool_set_pool_type(GVirConfigStoragePool *pool,
                                                NULL);
 }
 
+/**
+ * gvir_config_storage_pool_set_name:
+ * @name: (allow-none):
+ */
 void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool,
                                        const char *name)
 {
@@ -95,6 +99,10 @@ void gvir_config_storage_pool_set_name(GVirConfigStoragePool *pool,
                                         "name", name);
 }
 
+/**
+ * gvir_config_storage_pool_set_uuid:
+ * @uuid: (allow-none):
+ */
 void gvir_config_storage_pool_set_uuid(GVirConfigStoragePool *pool,
                                        const char *uuid)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c
index 2e8aa22..620c8e6 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-backing-store.c
@@ -84,6 +84,10 @@ void gvir_config_storage_vol_backing_store_set_format(GVirConfigStorageVolBackin
     g_object_unref(G_OBJECT(node));
 }
 
+/**
+ * gvir_config_storage_vol_backing_store_set_path:
+ * @path: (allow-none):
+ */
 void gvir_config_storage_vol_backing_store_set_path(GVirConfigStorageVolBackingStore *backing_store,
                                                     const char *path)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.c b/libvirt-gconfig/libvirt-gconfig-storage-vol.c
index 6281c02..e20dca3 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.c
@@ -74,6 +74,10 @@ GVirConfigStorageVol *gvir_config_storage_vol_new_from_xml(const gchar *xml,
     return GVIR_CONFIG_STORAGE_VOL(object);
 }
 
+/**
+ * gvir_config_storage_vol_set_name:
+ * @name: (allow-none):
+ */
 void gvir_config_storage_vol_set_name(GVirConfigStorageVol *vol,
                                       const char *name)
 {
-- 
1.7.10.1


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