use of com.emc.storageos.vnx.xmlapi.VNXCifsServer in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getCifServers.
private List<VNXCifsServer> getCifServers(final StorageSystem system) throws VNXException {
List<VNXCifsServer> cifsServers;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get(VNXFileConstants.VNX_FILE_CIFS_CONFIG));
cifsServers = (List<VNXCifsServer>) _discExecutor.getKeyMap().get(VNXFileConstants.CIFS_SERVERS);
} catch (BaseCollectionException e) {
throw new VNXException("Get CifServers op failed", e);
}
return cifsServers;
}
use of com.emc.storageos.vnx.xmlapi.VNXCifsServer in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method discoverPortGroups.
/**
* Discover the Data Movers (Port Groups) for the specified VNX File storage array.
*
* @param system storage system information including credentials.
* @return Map of New and Existing port groups
* @throws VNXFileCollectionException
*/
private HashMap<String, List<StorageHADomain>> discoverPortGroups(StorageSystem system, StringSet fileSharingProtocols) throws VNXFileCollectionException, VNXException {
HashMap<String, List<StorageHADomain>> portGroups = new HashMap<String, List<StorageHADomain>>();
List<StorageHADomain> newPortGroups = new ArrayList<StorageHADomain>();
List<StorageHADomain> existingPortGroups = new ArrayList<StorageHADomain>();
boolean isNfsCifsSupported = false;
List<PhysicalNAS> newNasServers = new ArrayList<PhysicalNAS>();
List<PhysicalNAS> existingNasServers = new ArrayList<PhysicalNAS>();
_logger.info("Start port group discovery for storage system {}", system.getId());
List<VNXDataMover> dataMovers = getPortGroups(system);
_logger.debug("Number movers found: {}", dataMovers.size());
for (VNXDataMover mover : dataMovers) {
StorageHADomain portGroup = null;
if (null == mover) {
_logger.debug("Null data mover in list of port groups.");
continue;
}
if (mover.getRole().equals(DM_ROLE_STANDBY)) {
_logger.debug("Found standby data mover");
continue;
}
// Check if port group was previously discovered
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, mover.getName(), NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
Iterator<URI> iter = results.iterator();
while (iter.hasNext()) {
StorageHADomain tmpGroup = _dbClient.queryObject(StorageHADomain.class, iter.next());
if (tmpGroup != null && !tmpGroup.getInactive() && tmpGroup.getStorageDeviceURI().equals(system.getId())) {
portGroup = tmpGroup;
_logger.debug("Found duplicate {} ", mover.getName());
}
}
List<VNXCifsServer> cifsServers = getCifServers(system, String.valueOf(mover.getId()), "false");
CifsServerMap cifsServersMap = new CifsServerMap();
for (VNXCifsServer cifsServer : cifsServers) {
_logger.info("Cifs Server {} for {} ", cifsServer.getName(), mover.getName());
NasCifsServer nasCifsServer = new NasCifsServer();
nasCifsServer.setId(cifsServer.getId());
nasCifsServer.setInterfaces(cifsServer.getInterfaces());
nasCifsServer.setMoverIdIsVdm(cifsServer.getMoverIdIsVdm());
nasCifsServer.setName(cifsServer.getName());
nasCifsServer.setType(cifsServer.getType());
nasCifsServer.setDomain(cifsServer.getDomain());
cifsServersMap.put(cifsServer.getName(), nasCifsServer);
}
// Check supported network file sharing protocols.
StringSet protocols = new StringSet();
protocols.add(StorageProtocol.File.NFS.name());
protocols.add(StorageProtocol.File.CIFS.name());
// If the data mover (aka port group) was not previously discovered
if (portGroup == null) {
portGroup = new StorageHADomain();
portGroup.setId(URIUtil.createId(StorageHADomain.class));
portGroup.setNativeGuid(adapterNativeGuid);
portGroup.setStorageDeviceURI(system.getId());
portGroup.setAdapterName(mover.getName());
portGroup.setVirtual(false);
portGroup.setName((Integer.toString(mover.getId())));
portGroup.setFileSharingProtocols(protocols);
_logger.info("Found data mover {} at {}", mover.getName(), mover.getId());
newPortGroups.add(portGroup);
} else {
// Set protocols if it has changed between discoveries or a upgrade scenario
portGroup.setFileSharingProtocols(protocols);
existingPortGroups.add(portGroup);
}
PhysicalNAS existingNas = findPhysicalNasByNativeId(system, String.valueOf(mover.getId()));
if (existingNas != null) {
existingNas.setProtocols(protocols);
existingNas.setCifsServersMap(cifsServersMap);
existingNasServers.add(existingNas);
} else {
PhysicalNAS physicalNas = createPhysicalNas(system, mover);
if (physicalNas != null) {
physicalNas.setProtocols(protocols);
physicalNas.setCifsServersMap(cifsServersMap);
newNasServers.add(physicalNas);
}
}
}
// Persist the NAS servers!!!
if (existingNasServers != null && !existingNasServers.isEmpty()) {
_logger.info("discoverPortGroups - modified PhysicalNAS servers size {}", existingNasServers.size());
_dbClient.persistObject(existingNasServers);
}
if (newNasServers != null && !newNasServers.isEmpty()) {
_logger.info("discoverPortGroups - new PhysicalNAS servers size {}", newNasServers.size());
_dbClient.createObject(newNasServers);
}
// With current API, NFS/CIFS is assumed to be always supported.
fileSharingProtocols.add(StorageProtocol.File.NFS.name());
fileSharingProtocols.add(StorageProtocol.File.CIFS.name());
_logger.info("Port group discovery for storage system {} complete.", system.getId());
for (StorageHADomain newDomain : newPortGroups) {
_logger.info("New Storage Domain : {} : {}", newDomain.getNativeGuid(), newDomain.getAdapterName() + ":" + newDomain.getId());
}
for (StorageHADomain domain : existingPortGroups) {
_logger.info("Old Storage Domain : {} : {}", domain.getNativeGuid(), domain.getAdapterName() + ":" + domain.getId());
}
// return portGroups;
portGroups.put(NEW, newPortGroups);
portGroups.put(EXISTING, existingPortGroups);
return portGroups;
}
Aggregations