use of com.emc.storageos.vnxe.models.VNXeNasServer in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method computeStaticLoadMetrics.
/**
* Compute static load metrics.
*
* @param accessProfile
* @return
*/
private void computeStaticLoadMetrics(AccessProfile accessProfile) throws BaseCollectionException {
URI storageSystemId = accessProfile.getSystemId();
StorageSystem storageSystem = null;
try {
storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
_logger.info("started computeStaticLoadMetrics for storagesystem: {}", storageSystem.getLabel());
VNXeApiClient client = getVnxUnityClient(accessProfile);
List<VNXeNasServer> nasServers = client.getNasServers();
for (VNXeNasServer nasServer : nasServers) {
if ((nasServer.getMode() == VNXeNasServer.NasServerModeEnum.DESTINATION) || nasServer.getIsReplicationDestination()) {
_logger.debug("Found a replication destination NasServer");
continue;
}
if (nasServer.getIsSystem()) {
// skip system nasServer
continue;
}
VirtualNAS virtualNAS = findvNasByNativeId(storageSystem, nasServer.getId());
if (virtualNAS != null) {
_logger.info("Process db metrics for nas server : {}", nasServer.getName());
StringMap dbMetrics = virtualNAS.getMetrics();
if (dbMetrics == null) {
dbMetrics = new StringMap();
}
// process db metrics
StringMap tmpDbMetrics = populateDbMetrics(nasServer, client);
dbMetrics.putAll(tmpDbMetrics);
// set dbMetrics in db
virtualNAS.setMetrics(dbMetrics);
_dbClient.updateObject(virtualNAS);
}
}
} catch (Exception e) {
_logger.error("CollectStatisticsInformation failed. Storage system: {}", storageSystemId, e);
}
}
use of com.emc.storageos.vnxe.models.VNXeNasServer in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDeviceTest method getStorageHADomain.
public List<StorageHADomain> getStorageHADomain() {
VNXeApiClient apiclient = _unity.getVnxUnityClient(_device);
List<VNXeNasServer> nasServers = apiclient.getNasServers();
List<StorageHADomain> haDomains = new ArrayList<StorageHADomain>();
List<String> proto = new ArrayList<String>();
proto.add("CIFS");
StringSet protocols = new StringSet(proto);
for (VNXeNasServer nasServer : nasServers) {
StorageHADomain haDomain = new StorageHADomain();
haDomain.setId(URIUtil.createId(StorageHADomain.class));
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(_device, nasServer.getName(), NativeGUIDGenerator.ADAPTER);
haDomain.setNativeGuid(adapterNativeGuid);
haDomain.setStorageDeviceURI(_device.getId());
haDomain.setAdapterName(nasServer.getName());
haDomain.setName(nasServer.getName());
haDomain.setSerialNumber(nasServer.getId());
haDomain.setFileSharingProtocols(protocols);
haDomain.setVirtual(true);
haDomains.add(haDomain);
}
return haDomains;
}
use of com.emc.storageos.vnxe.models.VNXeNasServer in project coprhd-controller by CoprHD.
the class NasServerRequestTest method getTest.
@Test
public void getTest() {
NasServerRequest req = new NasServerRequest(_client, "system_nas_0");
VNXeNasServer nasServer = req.get();
String name = nasServer.getName();
System.out.println(name);
String spId = nasServer.getCurrentSP().getId();
System.out.println(spId);
System.out.println(nasServer.getMode());
}
use of com.emc.storageos.vnxe.models.VNXeNasServer in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method discoverNasServers.
/**
* Discover the NasServer (Port Groups) for the specified VNXe storage
* array.
*
* @param system
* storage system information
* @param client
* VNXeServiceClient
* @param nasServerIdMap
* all valid nasServer id map
* @param arraySupportedProtocol
* array supported protocol
* @return Map of New and Existing NasServers
* @throws VNXeException
*/
private HashMap<String, List<StorageHADomain>> discoverNasServers(StorageSystem system, VNXeApiClient client, Map<String, URI> nasServerIdMap, StringSet arraySupportedProtocols) throws VNXeException {
HashMap<String, List<StorageHADomain>> allNasServers = new HashMap<String, List<StorageHADomain>>();
List<StorageHADomain> newNasServers = new ArrayList<StorageHADomain>();
List<StorageHADomain> existingNasServers = new ArrayList<StorageHADomain>();
List<VirtualNAS> newVirtualNas = new ArrayList<VirtualNAS>();
List<VirtualNAS> existingVirtualNas = new ArrayList<VirtualNAS>();
boolean isNFSSupported = false;
boolean isCIFSSupported = false;
boolean isBothSupported = false;
_logger.info("Start NasServer discovery for storage system {}", system.getId());
List<VNXeNasServer> nasServers = client.getNasServers();
List<VNXeCifsServer> cifsServers = client.getCifsServers();
List<VNXeNfsServer> nfsServers = client.getNfsServers();
for (VNXeNasServer nasServer : nasServers) {
StorageHADomain haDomain = null;
if (null == nasServer) {
_logger.debug("Null data mover in list of port groups.");
continue;
}
if ((nasServer.getMode() == VNXeNasServer.NasServerModeEnum.DESTINATION) || nasServer.getIsReplicationDestination()) {
_logger.debug("Found a replication destination NasServer");
// On failover the existing Nas server becomes the destination. So changing state to unknown as it
// should not be picked for provisioning.
VirtualNAS vNas = findvNasByNativeId(system, nasServer.getId());
if (vNas != null) {
vNas.setNasState(VirtualNasState.UNKNOWN.name());
existingVirtualNas.add(vNas);
}
continue;
}
if (nasServer.getIsSystem()) {
// skip system nasServer
continue;
}
StringSet protocols = new StringSet();
// Check if port group was previously discovered
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, nasServer.getName(), NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
Iterator<URI> it = results.iterator();
if (it.hasNext()) {
StorageHADomain tmpDomain = _dbClient.queryObject(StorageHADomain.class, it.next());
if (tmpDomain.getStorageDeviceURI().equals(system.getId())) {
haDomain = tmpDomain;
_logger.debug("Found duplicate {} ", nasServer.getName());
}
}
// get the supported protocol on the nasServer
if (cifsServers != null && !cifsServers.isEmpty()) {
for (VNXeCifsServer cifsServer : cifsServers) {
if (cifsServer.getNasServer().getId().equals(nasServer.getId())) {
protocols.add(StorageProtocol.File.CIFS.name());
isCIFSSupported = true;
break;
}
}
}
if (nfsServers != null && !nfsServers.isEmpty()) {
for (VNXeNfsServer nfsServer : nfsServers) {
if (nfsServer.getNasServer() != null) {
if (nfsServer.getNasServer().getId().equals(nasServer.getId())) {
protocols.add(StorageProtocol.File.NFS.name());
isNFSSupported = true;
break;
}
}
}
}
if (protocols.size() == 2) {
// this nasServer support both
isBothSupported = true;
}
// If the nasServer was not previously discovered
if (haDomain == null) {
haDomain = new StorageHADomain();
haDomain.setId(URIUtil.createId(StorageHADomain.class));
haDomain.setNativeGuid(adapterNativeGuid);
haDomain.setStorageDeviceURI(system.getId());
haDomain.setAdapterName(nasServer.getName());
haDomain.setName(nasServer.getName());
haDomain.setSerialNumber(nasServer.getId());
newNasServers.add(haDomain);
} else {
existingNasServers.add(haDomain);
}
haDomain.setFileSharingProtocols(protocols);
haDomain.setVirtual(true);
nasServerIdMap.put(nasServer.getId(), haDomain.getId());
CifsServerMap cifsServersMap = new CifsServerMap();
for (VNXeCifsServer cifsServer : cifsServers) {
if (cifsServer.getNasServer().getId().equals(nasServer.getId())) {
_logger.info("Cifs Server {} for {} ", cifsServer.getName(), nasServer.getName());
if (!cifsServer.getFileInterfaces().isEmpty()) {
_logger.info("{} has CIFS Enabled since interfaces are found ", nasServer.getName(), cifsServer.getName() + ":" + cifsServer.getFileInterfaces());
protocols.add(StorageProtocol.File.CIFS.name());
NasCifsServer nasCifsServer = new NasCifsServer();
nasCifsServer.setId(cifsServer.getId());
nasCifsServer.setMoverIdIsVdm(true);
nasCifsServer.setName(cifsServer.getName());
nasCifsServer.setDomain(cifsServer.getDomain());
cifsServersMap.put(cifsServer.getName(), nasCifsServer);
}
}
}
VirtualNAS vNas = findvNasByNativeId(system, nasServer.getId());
// If the nasServer was not previously discovered
if (vNas == null) {
vNas = new VirtualNAS();
vNas.setId(URIUtil.createId(VirtualNAS.class));
String nasNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, nasServer.getId(), NativeGUIDGenerator.VIRTUAL_NAS);
vNas.setNativeGuid(nasNativeGuid);
vNas.setStorageDeviceURI(system.getId());
vNas.setNasName(nasServer.getName());
vNas.setNativeId(nasServer.getId());
newVirtualNas.add(vNas);
} else {
existingVirtualNas.add(vNas);
}
vNas.setProtocols(protocols);
vNas.setNasState(VirtualNasState.LOADED.name());
vNas.setCifsServersMap(cifsServersMap);
}
// Persist the NAS servers!!!
if (existingVirtualNas != null && !existingVirtualNas.isEmpty()) {
_logger.info("discoverNasServers - modified VirtualNAS servers size {}", existingVirtualNas.size());
_dbClient.updateObject(existingVirtualNas);
}
if (newVirtualNas != null && !newVirtualNas.isEmpty()) {
_logger.info("discoverNasServers - new VirtualNAS servers size {}", newVirtualNas.size());
_dbClient.createObject(newVirtualNas);
}
if (isBothSupported) {
arraySupportedProtocols.add(StorageProtocol.File.NFS.name());
arraySupportedProtocols.add(StorageProtocol.File.CIFS.name());
} else if (isNFSSupported && isCIFSSupported) {
arraySupportedProtocols.add(StorageProtocol.File.NFS_OR_CIFS.name());
} else if (isNFSSupported) {
arraySupportedProtocols.add(StorageProtocol.File.NFS.name());
} else if (isCIFSSupported) {
arraySupportedProtocols.add(StorageProtocol.File.CIFS.name());
}
_logger.info("NasServer discovery for storage system {} complete.", system.getId());
for (StorageHADomain newDomain : newNasServers) {
_logger.info("New NasServer : {} : {}", newDomain.getNativeGuid(), newDomain.getId());
}
for (StorageHADomain domain : existingNasServers) {
_logger.info("Existing NasServer : {} : {}", domain.getNativeGuid(), domain.getId());
}
allNasServers.put(NEW, newNasServers);
allNasServers.put(EXISTING, existingNasServers);
return allNasServers;
}
use of com.emc.storageos.vnxe.models.VNXeNasServer in project coprhd-controller by CoprHD.
the class VNXeCommunicationInterface method discoverNasServers.
/**
* Discover the NasServer (Port Groups) for the specified VNXe storage
* array.
*
* @param system
* storage system information
* @param client
* VNXeServiceClient
* @param nasServerIdMap
* all valid nasServer id map
* @param arraySupportedProtocol
* array supported protocol
* @return Map of New and Existing NasServers
* @throws VNXeException
*/
private HashMap<String, List<StorageHADomain>> discoverNasServers(StorageSystem system, VNXeApiClient client, Map<String, URI> nasServerIdMap, StringSet arraySupportedProtocols) throws VNXeException {
HashMap<String, List<StorageHADomain>> allNasServers = new HashMap<String, List<StorageHADomain>>();
List<StorageHADomain> newNasServers = new ArrayList<StorageHADomain>();
List<StorageHADomain> existingNasServers = new ArrayList<StorageHADomain>();
boolean isNFSSupported = false;
boolean isCIFSSupported = false;
boolean isBothSupported = false;
_logger.info("Start NasServer discovery for storage system {}", system.getId());
List<VNXeNasServer> nasServers = client.getNasServers();
List<VNXeCifsServer> cifsServers = client.getCifsServers();
List<VNXeNfsServer> nfsServers = client.getNfsServers();
for (VNXeNasServer nasServer : nasServers) {
StorageHADomain haDomain = null;
if (null == nasServer) {
_logger.debug("Null data mover in list of port groups.");
continue;
}
if (nasServer.getMode() == VNXeNasServer.NasServerModeEnum.DESTINATION) {
_logger.debug("Found a replication destination NasServer");
continue;
}
if (nasServer.getIsSystem()) {
// skip system nasServer
continue;
}
StringSet protocols = new StringSet();
// Check if port group was previously discovered
URIQueryResultList results = new URIQueryResultList();
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, nasServer.getName(), NativeGUIDGenerator.ADAPTER);
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid), results);
if (results.iterator().hasNext()) {
StorageHADomain tmpDomain = _dbClient.queryObject(StorageHADomain.class, results.iterator().next());
if (tmpDomain.getStorageDeviceURI().equals(system.getId())) {
haDomain = tmpDomain;
_logger.debug("Found duplicate {} ", nasServer.getName());
}
}
// get the supported protocol on the nasServer
if (cifsServers != null && !cifsServers.isEmpty()) {
for (VNXeCifsServer cifsServer : cifsServers) {
if (cifsServer.getNasServer().getId().equals(nasServer.getId())) {
protocols.add(StorageProtocol.File.CIFS.name());
isCIFSSupported = true;
break;
}
}
}
if (nfsServers != null && !nfsServers.isEmpty()) {
for (VNXeNfsServer nfsServer : nfsServers) {
if (nfsServer.getNasServer().getId().equals(nasServer.getId())) {
protocols.add(StorageProtocol.File.NFS.name());
isNFSSupported = true;
break;
}
}
}
if (protocols.size() == 2) {
// this nasServer support both
isBothSupported = true;
}
// If the nasServer was not previously discovered
if (haDomain == null) {
haDomain = new StorageHADomain();
haDomain.setId(URIUtil.createId(StorageHADomain.class));
haDomain.setNativeGuid(adapterNativeGuid);
haDomain.setStorageDeviceURI(system.getId());
haDomain.setAdapterName(nasServer.getName());
haDomain.setName(nasServer.getName());
haDomain.setSerialNumber(nasServer.getId());
haDomain.setFileSharingProtocols(protocols);
newNasServers.add(haDomain);
} else {
haDomain.setFileSharingProtocols(protocols);
existingNasServers.add(haDomain);
}
nasServerIdMap.put(nasServer.getId(), haDomain.getId());
}
if (isBothSupported) {
arraySupportedProtocols.add(StorageProtocol.File.NFS.name());
arraySupportedProtocols.add(StorageProtocol.File.CIFS.name());
} else if (isNFSSupported && isCIFSSupported) {
arraySupportedProtocols.add(StorageProtocol.File.NFS_OR_CIFS.name());
} else if (isNFSSupported) {
arraySupportedProtocols.add(StorageProtocol.File.NFS.name());
} else if (isCIFSSupported) {
arraySupportedProtocols.add(StorageProtocol.File.CIFS.name());
}
_logger.info("NasServer discovery for storage system {} complete.", system.getId());
for (StorageHADomain newDomain : newNasServers) {
_logger.info("New NasServer : {} : {}", newDomain.getNativeGuid(), newDomain.getId());
}
for (StorageHADomain domain : existingNasServers) {
_logger.info("Existing NasServer : {} : {}", domain.getNativeGuid(), domain.getId());
}
// return portGroups;
allNasServers.put(NEW, newNasServers);
allNasServers.put(EXISTING, existingNasServers);
return allNasServers;
}
Aggregations