Skip to content

Commit

Permalink
linstor: disconnect-disk also search for resource name in Linstor
Browse files Browse the repository at this point in the history
  • Loading branch information
rp- committed May 2, 2024
1 parent fc18caa commit 626cf6d
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private boolean tryDisconnectLinstor(String volumePath, KVMStoragePool pool)
null,
null);

optRsc = getResourceByPath(resources, volumePath);
optRsc = getResourceByPathOrName(resources, volumePath);
} catch (ApiException apiEx) {
// couldn't query linstor controller
s_logger.error(apiEx.getBestMessage());
Expand Down Expand Up @@ -375,9 +375,10 @@ public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect)
return false;
}

private Optional<ResourceWithVolumes> getResourceByPath(final List<ResourceWithVolumes> resources, String path) {
private Optional<ResourceWithVolumes> getResourceByPathOrName(
final List<ResourceWithVolumes> resources, String path) {
return resources.stream()
.filter(rsc -> rsc.getVolumes().stream()
.filter(rsc -> getLinstorRscName(path).equalsIgnoreCase(rsc.getName()) || rsc.getVolumes().stream()
.anyMatch(v -> path.equals(v.getDevicePath())))
.findFirst();
}
Expand Down

0 comments on commit 626cf6d

Please sign in to comment.