[PATCH] conf: fix virDomainLeaseIndex cannot work when both parameter have lockspaces present

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=1174096

When both parameter have lockspaces present, virDomainLeaseIndex
will always -1 even there is a lease the same with the one we check.
I think we shouldn't do 'continue' when the two lockspaces are the same.

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5cf0b1a..f36affc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11667,13 +11667,14 @@ int virDomainLeaseIndex(virDomainDefPtr def,
 
     for (i = 0; i < def->nleases; i++) {
         vlease = def->leases[i];
-        /* Either both must have lockspaces present which  match.. */
-        if (vlease->lockspace && lease->lockspace &&
-            STRNEQ(vlease->lockspace, lease->lockspace))
-            continue;
+        /* Either both must have lockspaces present which match.. */
+        if (vlease->lockspace && lease->lockspace) {
+            if (STRNEQ(vlease->lockspace, lease->lockspace))
+                continue;
         /* ...or neither must have a lockspace present */
-        if (vlease->lockspace || lease->lockspace)
+        } else if (vlease->lockspace || lease->lockspace)
             continue;
+
         if (STREQ(vlease->key, lease->key))
             return i;
     }
-- 
1.8.3.1

--
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]