mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
linstor: disconnect-disk also search for resource name in Linstor (#9035)
disconnectPhysicalDisk(String, KVMStoragePool) seems to calls the plugin with the resource name instead of the device path, so we also have to search for resource names, while cleaning up.
This commit is contained in:
parent
5c9d79e3fb
commit
ea11128cb3
@ -341,7 +341,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());
|
||||
@ -401,9 +401,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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user