rp- commented on code in PR #13910:
URL: https://github.com/apache/cloudstack/pull/13910#discussion_r4648110697
##########
plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/util/LinstorUtil.java:
##########
@@ -352,12 +532,23 @@ public static String getDevicePath(DevelopersApi api,
String rscName) throws Api
null,
null);
for (ResourceWithVolumes rsc : resources) {
- if (!rsc.getVolumes().isEmpty()) {
+ if (!rsc.getVolumes().isEmpty() &&
rsc.getVolumes().get(0).getDevicePath() != null) {
return LinstorUtil.getDevicePathFromResource(rsc);
}
}
- final String errMsg = "viewResources didn't return resources or
volumes for " + rscName;
+ // Shared storage pool resources of stopped VMs are INACTIVE and
report no device path.
+ // Callers like createVbd build the domain XML before
connectPhysicalDisk activates the
+ // resource, so return the deterministic storage layer path here.
+ com.linbit.linstor.api.model.StoragePool sp =
getDiskfulStoragePool(api, rscName);
+ if (sp != null && (sp.getProviderKind() == ProviderKind.LVM ||
sp.getProviderKind() == ProviderKind.LVM_THIN)) {
+ final String vg =
sp.getProps().get("StorDriver/StorPoolName").split("/")[0];
+ final String path = String.format("/dev/%s/%s_00000", vg, rscName);
Review Comment:
no more fallback, and any caller of getDevicePath now makes sure to activate
the resource before.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]