use of com.emc.storageos.vnx.xmlapi.VNXDataMover in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getPortGroups.
private List<VNXDataMover> getPortGroups(final StorageSystem system) throws VNXException {
List<VNXDataMover> dataMovers = null;
try {
Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
_discExecutor.setKeyMap(reqAttributeMap);
_discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileStoragePortGroup"));
dataMovers = (ArrayList<VNXDataMover>) _discExecutor.getKeyMap().get(VNXFileConstants.STORAGE_PORT_GROUPS);
} catch (BaseCollectionException e) {
throw new VNXException("Get Port Groups op failed", e);
}
return dataMovers;
}
use of com.emc.storageos.vnx.xmlapi.VNXDataMover in project coprhd-controller by CoprHD.
the class VNXStoragePortGroupsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final PostMethod result = (PostMethod) resultObj;
_logger.info("processing vnx datamovers response" + resultObj);
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
if (null != responsePacket.getPacketFault()) {
Status status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
List<Object> queryResponse = getQueryResponse(responsePacket);
Iterator<Object> queryRespItr = queryResponse.iterator();
List<VNXDataMover> movers = new ArrayList<VNXDataMover>();
while (queryRespItr.hasNext()) {
Object responseObj = queryRespItr.next();
if (responseObj instanceof Mover) {
VNXDataMover vnxMover = new VNXDataMover();
Mover mover = (Mover) responseObj;
vnxMover.setId(Integer.valueOf(mover.getMover()));
vnxMover.setName(mover.getName());
vnxMover.setRole(mover.getRole().value());
_logger.debug("Port Group Information : {}", vnxMover.toString());
movers.add(vnxMover);
}
}
_logger.info("Number of Port Groups found : {}", movers.size());
keyMap.put(VNXFileConstants.STORAGE_PORT_GROUPS, movers);
// Extract session information from the response header.
Header[] headers = result.getResponseHeaders(VNXFileConstants.CELERRA_SESSION);
if (null != headers && headers.length > 0) {
keyMap.put(VNXFileConstants.CELERRA_SESSION, headers[0].getValue());
_logger.info("Recieved celerra session information from the Server.");
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx info response due to ", ex);
} finally {
result.releaseConnection();
}
}
use of com.emc.storageos.vnx.xmlapi.VNXDataMover 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