[PATCH] storage: fix volume perms when it is not specified.

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

 



This commit adds permissions inheritance to volume from main pool when
it is not explicitly added by command or XML definition. It permissions
are defined into XML, they should be respected.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=677242

Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
---
 src/storage/storage_driver.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 4a13e90481..5961d35f26 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1850,6 +1850,16 @@ storageVolCreateXML(virStoragePoolPtr pool,
         goto cleanup;
     }
 
+    /* Inherit perms and mode from pool when they are not defined. */
+    if (voldef->target.perms->uid == (uid_t)-1)
+        voldef->target.perms->uid = def->target.perms.uid;
+
+    if (voldef->target.perms->gid == (gid_t)-1)
+        voldef->target.perms->gid = def->target.perms.gid;
+
+    if (voldef->target.perms->mode == (mode_t)-1)
+        voldef->target.perms->mode = def->target.perms.mode;
+
     if (virStorageVolCreateXMLEnsureACL(pool->conn, def, voldef) < 0)
         goto cleanup;
 
-- 
2.19.1

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

  Powered by Linux