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

[libvirt] [PATCH 2/2] Ignore backing file errors in FS storage pool (v3)



Currently a single storage volume with a broken backing file will disable the
whole storage pool. This can happen when the backing file is on some
unavailable network storage or if the backing volume is deleted, while the
storage volumes using it are not.
Since the storage pool then can not be re-activated, re-creating the missing 
or
deleting the now useless volumes using libvirt only is impossible.

To "fix" this case, all errors detected during storage pool activation are now
(silently) ignored. Errors are still logged by the called functions, which 
have
more knowledge on the detailed error condition.

To reproduce:
  dir=$(mktemp -d)
  virsh pool-create-as tmp dir '' '' '' '' "$dir"
  virsh vol-create-as --format qcow2 tmp back 1G
  virsh vol-create-as --format qcow2 --backing-vol-format qcow2 --backing-vol 
back tmp cow 1G
  virsh vol-delete --pool tmp back
  virsh pool-refresh tmp
After the last step, the pool will be gone (because it was not persistent). As
long as the now broken image stays in the directory, you will not be able to
re-create or re-start the pool.

Signed-off-by: Philipp Hahn <hahn univention de>
---
 src/storage/storage_backend_fs.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index ff39d48..0cf4e54 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -647,11 +647,11 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
                                                 &vol->allocation,
                                                 &vol->capacity,
                                                 &vol->target.encryption)) < 0) {
-            if (ret == -1)
-                goto cleanup;
-            else {
-                /* Silently ignore non-regular files,
-                 * eg '.' '..', 'lost+found', dangling symbolic link */
+            if (ret < 0) {
+                /* Silently ignore all errors,
+                 * eg '.' '..', 'lost+found', dangling symbolic link,
+                 * backend file unavailable, file unreadable.
+                 * A detailed error report has already been logged. */
                 virStorageVolDefFree(vol);
                 vol = NULL;
                 continue;

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