]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Do not break the whole vol lookup process in the middle
authorOsier Yang <jyang@redhat.com>
Mon, 26 Sep 2011 06:30:44 +0000 (14:30 +0800)
committerOsier Yang <jyang@redhat.com>
Tue, 27 Sep 2011 00:38:12 +0000 (08:38 +0800)
* src/storage/storage_driver.c: As virStorageVolLookupByPath lookups
all the pool objs of the drivers, breaking when failing on getting
the stable path of the pool will just breaks the whole lookup process,
it can cause the API fails even if the vol exists indeed. It won't get
any benefit. This patch is to fix it.

src/storage/storage_driver.c

index c05b74ebf6569ca5c6d0bfed6c967e3c4ab4c753..8c2d6e1a1bd1daeff1d2225af73c003e39b9e0da 100644 (file)
@@ -1247,14 +1247,14 @@ storageVolumeLookupByPath(virConnectPtr conn,
 
             stable_path = virStorageBackendStablePath(driver->pools.objs[i],
                                                       cleanpath);
-            /*
-             * virStorageBackendStablePath already does
-             * virStorageReportError if it fails; we just need to keep
-             * propagating the return code
-             */
             if (stable_path == NULL) {
+                /* Don't break the whole lookup process if it fails on
+                 * getting the stable path for some of the pools.
+                 */
+                VIR_WARN("Failed to get stable path for pool '%s'",
+                         driver->pools.objs[i]->def->name);
                 virStoragePoolObjUnlock(driver->pools.objs[i]);
-                goto cleanup;
+                continue;
             }
 
             vol = virStorageVolDefFindByPath(driver->pools.objs[i],
@@ -1274,7 +1274,6 @@ storageVolumeLookupByPath(virConnectPtr conn,
         virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
                               "%s", _("no storage vol with matching path"));
 
-cleanup:
     VIR_FREE(cleanpath);
     storageDriverUnlock(driver);
     return ret;