[libvirt] [PATCH] storage: Break out the loop if duplicate pool is found

Osier Yang jyang at redhat.com
Sat Apr 28 08:22:33 UTC 2012


It doesn't break out the "for" loop even if duplicate pool is
found, and thus the "matchpool" could be overriden as NULL again
if there is different pool afterwards.

To address the problem in libvirt-user list:

https://www.redhat.com/archives/libvirt-users/2012-April/msg00150.html
---
 src/conf/storage_conf.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7579327..9a42e34 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1710,6 +1710,9 @@ int virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
             break;
         }
         virStoragePoolObjUnlock(pool);
+
+        if (matchpool)
+            break;
     }
 
     if (matchpool) {
-- 
1.7.7.3




More information about the libvir-list mailing list