提交 046d82d7 编写于 作者: L Luyao Huang 提交者: Michal Privoznik

conf: fix virDomainLeaseIndex logic

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

When both parameter have lockspaces present, virDomainLeaseIndex
always returns -1 even there is a lease the same with the one we
check. This is due to broken logic in 'if-else' statement.
Signed-off-by: NLuyao Huang <lhuang@redhat.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 311b4a67
......@@ -11673,13 +11673,15 @@ 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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册