adaptive: pick NVMeTCP pool type when transport=nvme-tcp

The adaptive storage framework hard-coded FiberChannel as the KVM-side
pool type for every provider it fronts. With a separate NVMeTCP pool
type now available (and a dedicated NVMe-oF adapter on the KVM side),
teach the lifecycle to route a pool to the right adapter based on a
transport= URL parameter:

  https://user:pass@host/api?...&transport=nvme-tcp

  -> StoragePoolType.NVMeTCP -> NVMeTCPAdapter on the KVM host

When the query parameter is absent the default stays FiberChannel, so
existing FC deployments on Primera or FlashArray continue to work
unchanged.

The choice is made in the shared AdaptiveDataStoreLifeCycleImpl rather
than inside each vendor plugin so every adaptive provider (FlashArray,
Primera, any future one) speaks the same configuration vocabulary.
This commit is contained in:
Eugenio Grosso 2026-04-20 22:50:09 +00:00
parent 20ba972e78
commit b27512c431
1 changed files with 23 additions and 1 deletions

View File

@ -179,7 +179,7 @@ public class AdaptiveDataStoreLifeCycleImpl extends BasePrimaryDataStoreLifeCycl
parameters.setHost(uri.getHost());
parameters.setPort(uri.getPort());
parameters.setPath(uri.getPath() + "?" + uri.getQuery());
parameters.setType(StoragePoolType.FiberChannel);
parameters.setType(pickPoolType(uri));
parameters.setZoneId(zoneId);
parameters.setPodId(podId);
parameters.setClusterId(clusterId);
@ -401,4 +401,26 @@ public class AdaptiveDataStoreLifeCycleImpl extends BasePrimaryDataStoreLifeCycl
logger.info("Disabling storage pool {}", store);
_dataStoreHelper.disable(store);
}
/**
* Resolve the CloudStack StoragePoolType from the provider URL. Adaptive
* plugins advertise the underlying fabric via a {@code transport=} query
* parameter on the URL; when absent we keep the legacy FiberChannel
* default for backwards compatibility with adapters that still assume it.
*/
private static StoragePoolType pickPoolType(java.net.URL uri) {
String query = uri.getQuery();
if (query != null) {
for (String tok : query.split("&")) {
int i = tok.indexOf('=');
if (i > 0 && "transport".equalsIgnoreCase(tok.substring(0, i))) {
String value = tok.substring(i + 1);
if ("nvme-tcp".equalsIgnoreCase(value)) {
return StoragePoolType.NVMeTCP;
}
}
}
}
return StoragePoolType.FiberChannel;
}
}