[libvirt-glib] Add gvir_config_domain_disk_set_readonly()

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

 



From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>

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

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
index a39bf03..fb4e2b4 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
@@ -292,3 +292,14 @@ gvir_config_domain_disk_get_target_dev(GVirConfigDomainDisk *disk)
     return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(disk),
                                             "target", "dev");
 }
+
+void
+gvir_config_domain_disk_set_readonly(GVirConfigDomainDisk *disk,
+                                     gboolean readonly)
+{
+    if (readonly) {
+        GVirConfigObject *node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(disk), "readonly");
+        g_object_unref(node);
+    } else
+        gvir_config_object_delete_child(GVIR_CONFIG_OBJECT(disk), "readonly");
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
index d9d90e5..3359049 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
@@ -117,6 +117,8 @@ char *gvir_config_domain_disk_get_driver_name(GVirConfigDomainDisk *disk);
 char *gvir_config_domain_disk_get_driver_type(GVirConfigDomainDisk *disk);
 GVirConfigDomainDiskBus gvir_config_domain_disk_get_target_bus(GVirConfigDomainDisk *disk);
 char *gvir_config_domain_disk_get_target_dev(GVirConfigDomainDisk *disk);
+void gvir_config_domain_disk_set_readonly(GVirConfigDomainDisk *disk,
+                                          gboolean readonly);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 7cf3c3d..73fe279 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -80,6 +80,7 @@ LIBVIRT_GCONFIG_0.0.3 {
 	gvir_config_domain_disk_get_target_dev;
 	gvir_config_domain_disk_set_target_dev;
 	gvir_config_domain_disk_get_disk_type;
+	gvir_config_domain_disk_set_readonly;
 	gvir_config_domain_disk_set_type;
 
 	gvir_config_domain_filesys_get_type;
-- 
1.7.7.5

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