[libvirt] [PATCH 1/3] storage: Fix reporting an error on an already mounted filesystem

Erik Skultety posted 3 patches 9 years ago
[libvirt] [PATCH 1/3] storage: Fix reporting an error on an already mounted filesystem
Posted by Erik Skultety 9 years ago
When FS pool's source is already mounted on the target location instead
of just simply marking the pool as active, thus starting it we fail with
an error stating that the source is indeed already mounted on the target.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 src/storage/storage_backend_fs.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 54bcc57..fe4705b 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -358,14 +358,13 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool)
     if (virStorageBackendFileSystemIsValid(pool) < 0)
         return -1;
 
+    if ((rc = virStorageBackendFileSystemIsMounted(pool)) < 0)
+        return -1;
+
     /* Short-circuit if already mounted */
-    if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 0) {
-        if (rc == 1) {
-            virReportError(VIR_ERR_OPERATION_INVALID,
-                           _("Target '%s' is already mounted"),
-                           pool->def->target.path);
-        }
-        return -1;
+    if (rc == 1) {
+        VIR_INFO("Target '%s' is already mounted", pool->def->target.path);
+        return 0;
     }
 
     if (!(src = virStorageBackendFileSystemGetPoolSource(pool)))
-- 
2.10.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] storage: Fix reporting an error on an already mounted filesystem
Posted by John Ferlan 9 years ago

On 02/07/2017 09:16 AM, Erik Skultety wrote:
> When FS pool's source is already mounted on the target location instead
> of just simply marking the pool as active, thus starting it we fail with
> an error stating that the source is indeed already mounted on the target.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/storage/storage_backend_fs.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 

ACK

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list