Skip to content

Commit

Permalink
core: simplify SyncDirectLunsCommand#getPluggedVms
Browse files Browse the repository at this point in the history
Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed May 21, 2023
1 parent 54e1397 commit 15392d5
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.ovirt.engine.core.bll.storage.pool;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -219,12 +218,7 @@ private boolean updateLunDisksOnGuests(Set<LUNs> lunsToUpdateInDb) {
}

private List<VM> getPluggedVms(Guid diskId) {
List<VM> result = vmDao.getForDisk(diskId, false).get(Boolean.TRUE);
// Return an empty list if no plugged VMs found
if (result == null) {
result = new ArrayList<>();
}
return result;
return vmDao.getForDisk(diskId, false).computeIfAbsent(Boolean.TRUE, b -> Collections.emptyList());
}

private Stream<Guid> getIdsOfDirectLunsToSync() {
Expand Down

0 comments on commit 15392d5

Please sign in to comment.