[PATCH] iscsi_direct: Reset pool capacity and allocation just before refresh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jirka reported a bug that with every 'virsh pool-refresh' an
iscsi-direct pool would grow and grow. The problem is that
virISCSIDirectRefreshVol() only adds to def->capacity and
def->allocation but nothing clears it out to begin with.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/storage/storage_backend_iscsi_direct.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c
index 4ac4ad471c..20997d5c5d 100644
--- a/src/storage/storage_backend_iscsi_direct.c
+++ b/src/storage/storage_backend_iscsi_direct.c
@@ -341,6 +341,7 @@ virISCSIDirectReportLuns(virStoragePoolObjPtr pool,
                          struct iscsi_context *iscsi,
                          char *portal)
 {
+    virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
     struct scsi_task *task = NULL;
     struct scsi_reportluns_list *list = NULL;
     int full_size;
@@ -373,6 +374,8 @@ virISCSIDirectReportLuns(virStoragePoolObjPtr pool,
         goto cleanup;
     }
 
+    def->capacity = 0;
+    def->allocation = 0;
     for (i = 0; i < list->num; i++) {
         if (virISCSIDirectRefreshVol(pool, iscsi, list->luns[i], portal) < 0)
             goto cleanup;
-- 
2.19.2

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux