7a3408
From 951bd331d71c86f606961d4ce7e2172e817b32d1 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <951bd331d71c86f606961d4ce7e2172e817b32d1@dist-git>
7a3408
From: Christophe Fergeau <cfergeau@redhat.com>
7a3408
Date: Tue, 21 Jul 2015 09:40:04 -0400
7a3408
Subject: [PATCH] storage: Fix pool building when directory already exists
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1244080
7a3408
7a3408
Currently, when trying to virsh pool-define/virsh pool-build a new
7a3408
'dir' pool, if the target directory already exists, virsh
7a3408
pool-build/virStoragePoolBuild will error out. This is a change of
7a3408
behaviour compared to eg libvirt 1.2.13
7a3408
7a3408
This is caused by the wrong type being used for the dir_create_flags
7a3408
variable in virStorageBackendFileSystemBuild , it's defined as a bool
7a3408
but is used as a flag bit field so should be unsigned int (this matches
7a3408
the type virDirCreate expects for this variable).
7a3408
7a3408
This should fix https://bugzilla.gnome.org/show_bug.cgi?id=752417 (GNOME
7a3408
Boxes) and https://bugzilla.redhat.com/show_bug.cgi?id=1244080
7a3408
(downstream virt-manager).
7a3408
7a3408
(cherry picked from commit 60d5ed8c520462fd8fbc2d8dfac7b7c16ae5eb51)
7a3408
Signed-off-by: John Ferlan <jferlan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/storage/storage_backend_fs.c | 3 ++-
7a3408
 1 file changed, 2 insertions(+), 1 deletion(-)
7a3408
7a3408
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
7a3408
index 0eebac3..c0ea1df 100644
7a3408
--- a/src/storage/storage_backend_fs.c
7a3408
+++ b/src/storage/storage_backend_fs.c
7a3408
@@ -784,7 +784,8 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
7a3408
     char *parent = NULL;
7a3408
     char *p = NULL;
7a3408
     mode_t mode;
7a3408
-    bool needs_create_as_uid, dir_create_flags;
7a3408
+    bool needs_create_as_uid;
7a3408
+    unsigned int dir_create_flags;
7a3408
 
7a3408
     virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
7a3408
                   VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
7a3408
-- 
7a3408
2.5.0
7a3408