Damans227 commented on code in PR #13910:
URL: https://github.com/apache/cloudstack/pull/13910#discussion_r4271463154
##########
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:
what happens for an encrypted volume here? looks like this hands the vm the
raw disk under the encryption layer instead of the unlocked one
##########
plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/util/LinstorUtil.java:
##########
@@ -101,6 +106,49 @@ public static DevelopersApi getLinstorAPI(String
linstorUrl, String apiToken, bo
return new DevelopersApi(client);
}
+ /**
+ * The REST API version of the connected controller, e.g. "1.29.1", or
null if it could not be queried.
+ */
+ @Nullable
+ public static String getRestApiVersion(DevelopersApi api) {
+ try {
+ return api.controllerVersion().getRestApiVersion();
+ } catch (ApiException apiExc) {
+ LOGGER.warn("Unable to query controller API version: {}",
apiExc.getBestMessage());
+ return null;
+ }
+ }
+
+ /**
+ * Check if the connected controller supports the live-migration
attach/detach API:
+ * make-available with auto_manage_dual_primary and unmake-available,
added with REST API 1.29.0.
+ */
+ public static boolean supportsLiveMigrateApi(DevelopersApi api) {
Review Comment:
any reason not to remember this per controller like the description says?
right now every connect and disconnect asks again, and one failed call quietly
drops back to the old migration steps
--
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]