mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-29 15:21:50 +03:00
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: Luyao Huang <lhuang@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
311b4a677f
commit
046d82d72f
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user