Skip to content

Commit 92ba476

Browse files
committed
Merge release branch 4.18 to 4.19
* 4.18: linstor: disconnect-disk also search for resource name in Linstor (#9035)
2 parents b91c387 + ea11128 commit 92ba476

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ private boolean tryDisconnectLinstor(String volumePath, KVMStoragePool pool)
316316
null,
317317
null);
318318

319-
optRsc = getResourceByPath(resources, volumePath);
319+
optRsc = getResourceByPathOrName(resources, volumePath);
320320
} catch (ApiException apiEx) {
321321
// couldn't query linstor controller
322322
s_logger.error(apiEx.getBestMessage());
@@ -376,9 +376,10 @@ public boolean disconnectPhysicalDisk(Map<String, String> volumeToDisconnect)
376376
return false;
377377
}
378378

379-
private Optional<ResourceWithVolumes> getResourceByPath(final List<ResourceWithVolumes> resources, String path) {
379+
private Optional<ResourceWithVolumes> getResourceByPathOrName(
380+
final List<ResourceWithVolumes> resources, String path) {
380381
return resources.stream()
381-
.filter(rsc -> rsc.getVolumes().stream()
382+
.filter(rsc -> getLinstorRscName(path).equalsIgnoreCase(rsc.getName()) || rsc.getVolumes().stream()
382383
.anyMatch(v -> path.equals(v.getDevicePath())))
383384
.findFirst();
384385
}

0 commit comments

Comments
 (0)