]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: return -1 when fs pool can't be mounted
authorJán Tomko <jtomko@redhat.com>
Thu, 11 Jul 2013 10:36:59 +0000 (12:36 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 11 Jul 2013 10:42:15 +0000 (12:42 +0200)
Don't reuse the return value of virStorageBackendFileSystemIsMounted.
If it's 0, we'd return it even if the mount command failed.

Also, don't report another error if it's -1, since one has already
been reported.

Introduced by 258e06c.

https://bugzilla.redhat.com/show_bug.cgi?id=981251

src/storage/storage_backend_fs.c

index 8b40f5524fa2f9b6078a1974e1e7e1862d0abe93..d305b063ffd9dd01683e9105cfc6902948537ca4 100644 (file)
@@ -355,6 +355,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
                       pool->def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS);
     virCommandPtr cmd = NULL;
     int ret = -1;
+    int rc;
 
     if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
         if (pool->def->source.nhost != 1) {
@@ -381,10 +382,12 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
     }
 
     /* Short-circuit if already mounted */
-    if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) {
-        virReportError(VIR_ERR_OPERATION_INVALID,
-                       _("Target '%s' is already mounted"),
-                       pool->def->target.path);
+    if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 0) {
+        if (rc == 1) {
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           _("Target '%s' is already mounted"),
+                           pool->def->target.path);
+        }
         return -1;
     }