]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Initialize pool size parameters for refresh thread
authorNitesh Konkar <niteshkonkar.libvirt@gmail.com>
Tue, 22 Mar 2016 08:34:50 +0000 (04:34 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 29 Mar 2016 11:28:47 +0000 (07:28 -0400)
If the pool creation thread happens to detect the luns in
the scsi target, the size parameters will be calculated as
part of the refreshPool called from storagePoolCreate().

This means the virStoragePoolFCRefreshThread (commit id
'512b874') waiting to run and "refresh" the pool will
essentially double the allocation and capacity values.
A separate refresh would correct the values.

To avoid this, the FCRefreshThread needs to reinitialize
the pool size values prior to calling virStorageBackendSCSIFindLUs
which eventually calls virStorageBackendSCSINewLun and
updates the size values for each volume found.

src/storage/storage_backend_scsi.c

index 670cc4d3f6e949c508252b57d836ea675e0dde51..7c7d7d0da92efa856c1868c371d6f40206c86603 100644 (file)
@@ -614,6 +614,9 @@ virStoragePoolFCRefreshThread(void *opaque)
          */
         VIR_DEBUG("Attempt FC Refresh for pool='%s' name='%s' tries='%d'",
                   pool->def->name, fchost_name, tries);
+
+        pool->def->allocation = pool->def->capacity = pool->def->available = 0;
+
         if (virStoragePoolObjIsActive(pool) &&
             virGetSCSIHostNumber(fchost_name, &host) == 0 &&
             virStorageBackendSCSITriggerRescan(host) == 0) {