This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new ea11128cb37 linstor: disconnect-disk also search for resource name in
Linstor (#9035)
ea11128cb37 is described below
commit ea11128cb37ff7e5991c786b122e292fa10a38e2
Author: Rene Peinthor <[email protected]>
AuthorDate: Mon May 6 09:05:31 2024 +0200
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.
---
.../com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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 b38ab382a42..632b92c80fd 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 @@ 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();
}