]> xenbits.xensource.com Git - libvirt.git/commitdiff
virISCSIDirectRefreshVol: Don't clear volumes in each run
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 28 Feb 2019 14:08:19 +0000 (15:08 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 28 Feb 2019 14:55:48 +0000 (15:55 +0100)
When fetching LUNs from iscsi server the
virISCSIDirectReportLuns() is called. This function does some
libiscsi calls and then calls virISCSIDirectRefreshVol() over
each LUN found. It's unfortunate that the latter calls
virStoragePoolObjClearVols() as we lose all LUNs processed
in previous iterations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/storage/storage_backend_iscsi_direct.c

index 20997d5c5d23f7a4c5f5cb7d5b8867ba92bbbad6..32ceb592d9a9a98b7719f7a036e0b4a641d31f19 100644 (file)
@@ -309,7 +309,6 @@ virISCSIDirectRefreshVol(virStoragePoolObjPtr pool,
     uint32_t nb_block;
     VIR_AUTOPTR(virStorageVolDef) vol = NULL;
 
-    virStoragePoolObjClearVols(pool);
     if (virISCSIDirectTestUnitReady(iscsi, lun) < 0)
         return -1;
 
@@ -376,6 +375,7 @@ virISCSIDirectReportLuns(virStoragePoolObjPtr pool,
 
     def->capacity = 0;
     def->allocation = 0;
+    virStoragePoolObjClearVols(pool);
     for (i = 0; i < list->num; i++) {
         if (virISCSIDirectRefreshVol(pool, iscsi, list->luns[i], portal) < 0)
             goto cleanup;