Merge release branch 4.18 to 4.19

* 4.18:
  linstor: disconnect-disk also search for resource name in Linstor (#9035)
This commit is contained in:
Daan Hoogland 2024-05-06 10:35:27 +02:00
commit 92ba476593

View File

@ -316,7 +316,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
null,
null);
optRsc = getResourceByPath(resources, volumePath);
optRsc = getResourceByPathOrName(resources, volumePath);
} catch (ApiException apiEx) {
// couldn't query linstor controller
s_logger.error(apiEx.getBestMessage());
@ -376,9 +376,10 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
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();
}