rajiv-jain-netapp commented on code in PR #13053:
URL: https://github.com/apache/cloudstack/pull/13053#discussion_r3498948831
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java:
##########
@@ -411,23 +396,49 @@ private boolean
validateProtocolSupportAndFetchHostsIdentifier(List<HostVO> host
for (HostVO host : hosts) {
if (host != null) {
ip = host.getStorageIpAddress() != null ?
host.getStorageIpAddress().trim() : "";
- if (ip.isEmpty()) {
- if (host.getPrivateIpAddress() == null ||
host.getPrivateIpAddress().trim().isEmpty()) {
- return false;
- }
- ip = host.getPrivateIpAddress().trim();
+ if (ip.isEmpty() &&
StringUtils.isBlank(host.getPrivateIpAddress() )) {
+ // TODO we will inform customer through alert for
excluded host because of protocol enabled on host
+ continue;
+ } else {
+ ip = ip.isEmpty() ?
host.getPrivateIpAddress().trim() : ip;
}
}
hostIdentifiers.add(ip);
}
break;
default:
- throw new
CloudRuntimeException("validateProtocolSupportAndFetchHostsIdentifier :
Unsupported protocol: " + protocolType.name());
+ throw new CloudRuntimeException("Unsupported protocol: " +
protocolType.name());
}
logger.info("validateProtocolSupportAndFetchHostsIdentifier: All hosts
support the protocol: " + protocolType.name());
return true;
}
+ /**
+ * Creates an NFS export policy (access group) on the ONTAP storage if the
protocol is NFS3
+ * and there are eligible hosts. Skipped for iSCSI (igroups are created
per-host in grantAccess).
+ */
+ private void createNfsAccessGroupIfNeeded(Map<String, String> details,
List<String> hostsIdentifier,
+ List<HostVO> hostsToConnect,
Scope scope,
+ StoragePoolVO storagePool,
StorageStrategy strategy) {
+ if
(!ProtocolType.NFS3.name().equalsIgnoreCase(details.get(OntapStorageConstants.PROTOCOL)))
{
+ return;
+ }
+ if (hostsIdentifier.isEmpty()) {
+ // No eligible hosts — export policy will be created later via
HostListener when hosts come up
+ return;
+ }
+ try {
+ AccessGroup accessGroupRequest = new AccessGroup();
+ accessGroupRequest.setHostsToConnect(hostsToConnect);
+ accessGroupRequest.setScope(scope);
+ accessGroupRequest.setStoragePoolId(storagePool.getId());
+ strategy.createAccessGroup(accessGroupRequest);
+ } catch (Exception e) {
+ logger.error("Failed to create NFS access group on storage for
pool {}: {}", storagePool.getName(), e.getMessage());
+ throw new CloudRuntimeException("Failed to create NFS access group
on storage for pool " + storagePool.getName() + ": " + e.getMessage());
+ }
Review Comment:
we have corrected previous correction, with that we will not enpty IP added
and this situation is not expected now.
--
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]