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

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

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.

- Patch 1 is an error reporting tweak
- Patch 2 is a feature, but implementing it simplifies later patches
- Patch 3 makes pool.build not even attempt mkdir if the dir already exists.
- Patch 4 makes pool.build skip dir chown'ing unless user explicitly
  requested uid or gid via the XML
- Patch 5-6 make pool.build skip dir chmod unless the user explicitly
  requested <mode> via the XML. If a mode is required for mkdir, continue
  to use the previous default.

Cole Robinson (6):
  storage: fs: Don't overwrite virDirCreate error
  storage: fs: Fill in permissions on pool refresh
  storage: fs: Don't attempt directory creation if it already exists
  storage: fs: Don't try to chown directory unless user requested
  storage: conf: Don't set any default <mode> in the XML
  storage: fs: Only force directory permissions if required

 docs/schemas/storagecommon.rng                     |  5 +-
 src/conf/storage_conf.c                            | 42 +++++------
 src/storage/storage_backend.c                      | 20 ++++--
 src/storage/storage_backend.h                      |  3 +
 src/storage/storage_backend_fs.c                   | 81 ++++++++++++++++------
 src/storage/storage_backend_logical.c              |  4 +-
 src/util/virfile.c                                 | 47 ++++++++-----
 tests/storagepoolxml2xmlin/pool-dir.xml            |  2 +-
 tests/storagepoolxml2xmlout/pool-dir.xml           |  2 +-
 tests/storagepoolxml2xmlout/pool-netfs-gluster.xml |  2 +-
 tests/storagevolxml2xmlin/vol-file.xml             |  6 +-
 tests/storagevolxml2xmlout/vol-file.xml            |  6 +-
 tests/storagevolxml2xmlout/vol-gluster-dir.xml     |  2 +-
 tests/storagevolxml2xmlout/vol-sheepdog.xml        |  2 +-
 14 files changed, 147 insertions(+), 77 deletions(-)


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