[libvirt] [PATCH] fs: Fix pool building when directory already exists

Currently, when trying to virsh pool-define/virsh pool-build a new 'dir' pool, if the target directory already exists, virsh pool-build/virStoragePoolBuild will error out. This is a change of behaviour compared to eg libvirt 1.2.13 This is caused by the wrong type being used for the dir_create_flags variable in virStorageBackendFileSystemBuild , it's defined as a bool but is used as a flag bit field so should be unsigned int (this matches the type virDirCreate expects for this variable). This should fix https://bugzilla.gnome.org/show_bug.cgi?id=752417 (GNOME Boxes) and https://bugzilla.redhat.com/show_bug.cgi?id=1244080 (downstream virt-manager). --- src/storage/storage_backend_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 0eebac3..c0ea1df 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -784,7 +784,8 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED, char *parent = NULL; char *p = NULL; mode_t mode; - bool needs_create_as_uid, dir_create_flags; + bool needs_create_as_uid; + unsigned int dir_create_flags; virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE | VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret); -- 2.4.3

On Fri, Jul 17, 2015 at 10:12:44AM +0200, Christophe Fergeau wrote:
Currently, when trying to virsh pool-define/virsh pool-build a new 'dir' pool, if the target directory already exists, virsh pool-build/virStoragePoolBuild will error out. This is a change of behaviour compared to eg libvirt 1.2.13
This is caused by the wrong type being used for the dir_create_flags variable in virStorageBackendFileSystemBuild , it's defined as a bool but is used as a flag bit field so should be unsigned int (this matches the type virDirCreate expects for this variable).
This should fix https://bugzilla.gnome.org/show_bug.cgi?id=752417 (GNOME Boxes) and https://bugzilla.redhat.com/show_bug.cgi?id=1244080 (downstream virt-manager). --- src/storage/storage_backend_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK, this should also be back-ported to v1.2.16-maint and v1.2.17-maint branches.
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 0eebac3..c0ea1df 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -784,7 +784,8 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED, char *parent = NULL; char *p = NULL; mode_t mode; - bool needs_create_as_uid, dir_create_flags; + bool needs_create_as_uid; + unsigned int dir_create_flags;
virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE | VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret); -- 2.4.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Fri, Jul 17, 2015 at 10:31:11AM +0200, Martin Kletzander wrote:
On Fri, Jul 17, 2015 at 10:12:44AM +0200, Christophe Fergeau wrote:
Currently, when trying to virsh pool-define/virsh pool-build a new 'dir' pool, if the target directory already exists, virsh pool-build/virStoragePoolBuild will error out. This is a change of behaviour compared to eg libvirt 1.2.13
This is caused by the wrong type being used for the dir_create_flags variable in virStorageBackendFileSystemBuild , it's defined as a bool but is used as a flag bit field so should be unsigned int (this matches the type virDirCreate expects for this variable).
This should fix https://bugzilla.gnome.org/show_bug.cgi?id=752417 (GNOME Boxes) and https://bugzilla.redhat.com/show_bug.cgi?id=1244080 (downstream virt-manager). --- src/storage/storage_backend_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK, this should also be back-ported to v1.2.16-maint and v1.2.17-maint branches.
Pushed to all 3 branches, Christophe
participants (2)
-
Christophe Fergeau
-
Martin Kletzander