diff --git a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java index b38ab382a42d..632b92c80fd3 100644 --- a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java +++ b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java @@ -341,7 +341,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()); @@ -401,9 +401,10 @@ public boolean disconnectPhysicalDisk(Map volumeToDisconnect) return false; } - private Optional getResourceByPath(final List resources, String path) { + private Optional getResourceByPathOrName( + final List 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(); }