[libvirt] [PATCH v2 0/5] storage: fs: tweak dir perms handling on build

Cole Robinson crobinso at redhat.com
Tue May 5 16:43:58 UTC 2015


Consider the following issue

- Using virt-manager with qemu:///session
- User adds a storage pool pointing at /tmp. No explicit permissions are
  requested in the XML
- virt-manager calls PoolDefine, then PoolBuild
- libvirt tries to unconditionally chmod 755 /tmp. This fails because my
  user doesn't own root. Pool build fails, virt-manager reports failure

Yes there's a couple ways we could avoid this specific case in
virt-manager, but I think it makes more sense to have pool.build on
a directory be a no-op in this case. The following patches address this.

I already pushed some bits of v1 of the series. Now the patches are:

- Patch 1 (new) fixes a bug in the previous patches I pushed
- Patch 2 (new) changes storage XML to not output -1 for owner/group
- Patch 3 changes storage XML to not hardcode a <mode> value if the user
  didn't specify one in.
- Patch 4 (new) drops a redundant flag to virDirCreate
- Patch 5 makes pool.build skip dir chmod unless the user explicitly
  requested <mode> via the XML. However if a mode is required for mkdir,
  continue to use the previous default.

v2:
    Add patches 1, 3, 4, adjust other patches to match
    Style fix in patch 5

Cole Robinson (5):
  virfile: virDirCreate: Fix ALLOW_EXIST conditional
  storage: conf: Don't output owner/group -1
  storage: conf: Don't set any default <mode> in the XML
  virfile: virDirCreate: Drop redundand FORCE_PERMS flag
  storage: fs: Only force directory permissions if required

 docs/schemas/storagecommon.rng                     | 36 ++++++++------
 src/conf/storage_conf.c                            | 57 +++++++++++-----------
 src/storage/storage_backend.c                      | 20 ++++++--
 src/storage/storage_backend.h                      |  3 ++
 src/storage/storage_backend_fs.c                   | 21 +++++---
 src/storage/storage_backend_logical.c              |  4 +-
 src/util/virfile.c                                 |  8 ++-
 src/util/virfile.h                                 |  3 +-
 tests/storagepoolxml2xmlout/pool-dir-naming.xml    |  2 -
 tests/storagepoolxml2xmlout/pool-dir.xml           |  2 -
 tests/storagepoolxml2xmlout/pool-netfs-gluster.xml |  3 --
 tests/storagevolxml2xmlin/vol-file.xml             |  4 +-
 .../vol-gluster-dir-neg-uid.xml                    |  2 -
 tests/storagevolxml2xmlout/vol-gluster-dir.xml     |  3 --
 tests/storagevolxml2xmlout/vol-sheepdog.xml        |  3 --
 15 files changed, 91 insertions(+), 80 deletions(-)

-- 
2.4.0




More information about the libvir-list mailing list