use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class CinderUtils method getStorageAdapter.
/**
* Creates StorageHADomain for storage port.
*
* Cinder API does not provide the information about the storage adapter.
* Consider it as a dummy storageHADomain for cinder based systems. If the storageHADomain
* is not populated then the port will not be considered for multipath participatipation. While
* creating a virtual pool with multiple paths, it gets discarded if storageHADomain is not found.
*
* @param storageSystem
* @param dbClient
* @return
*/
public static StorageHADomain getStorageAdapter(StorageSystem storageSystem, DbClient dbClient) {
String cinderHostName = "";
URI providerUri = storageSystem.getActiveProviderURI();
StorageProvider provider = dbClient.queryObject(StorageProvider.class, providerUri);
if (null != provider && null != provider.getKeys()) {
cinderHostName = provider.getKeyValue(CinderConstants.KEY_CINDER_HOST_NAME);
}
String adapterNativeGUID = NativeGUIDGenerator.generateNativeGuid(storageSystem, cinderHostName, NativeGUIDGenerator.ADAPTER);
StorageHADomain adapter = new StorageHADomain();
adapter.setStorageDeviceURI(storageSystem.getId());
adapter.setId(URIUtil.createId(StorageHADomain.class));
adapter.setAdapterName(cinderHostName);
adapter.setLabel(cinderHostName);
adapter.setNativeGuid(adapterNativeGUID);
adapter.setNumberofPorts("1");
adapter.setAdapterType(StorageHADomain.HADomainType.FRONTEND.name());
adapter.setInactive(false);
dbClient.createObject(adapter);
return adapter;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class NetAppFileStorageDevice method findVfilerName.
/**
* Return the vFiler name associated with the file system. If a vFiler is not associated with
* this file system, then it will return null.
*/
private String findVfilerName(FileShare fs) {
String portGroup = null;
URI port = fs.getStoragePort();
if (port == null) {
_log.info("No storage port URI to retrieve vFiler name");
} else {
StoragePort stPort = _dbClient.queryObject(StoragePort.class, port);
if (stPort != null) {
URI haDomainUri = stPort.getStorageHADomain();
if (haDomainUri == null) {
_log.info("No Port Group URI for port {}", port);
} else {
StorageHADomain haDomain = _dbClient.queryObject(StorageHADomain.class, haDomainUri);
if (haDomain != null && haDomain.getVirtual() == true) {
portGroup = stPort.getPortGroup();
_log.debug("using port {} and vFiler {}", stPort.getPortNetworkId(), portGroup);
}
}
}
}
return portGroup;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getAllStoragePort.
private List<StoragePort> getAllStoragePort(StorageSystem storageSystem, Boolean isVirtual) throws IOException {
ArrayList<StoragePort> allStoragePorts = new ArrayList<>();
List<URI> storagePortURIs = _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePortConstraint(storageSystem.getId()));
List<StoragePort> storagePorts = _dbClient.queryObject(StoragePort.class, storagePortURIs);
for (StoragePort sp : storagePorts) {
URI moverOrVdmURI = sp.getStorageHADomain();
if (!sp.getInactive() && moverOrVdmURI != null) {
StorageHADomain moverOrVdm = _dbClient.queryObject(StorageHADomain.class, moverOrVdmURI);
if (moverOrVdm != null) {
if (moverOrVdm.getVirtual() == isVirtual) {
allStoragePorts.add(sp);
}
}
}
}
// return ports;
return allStoragePorts;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method discoverPorts.
/**
* Retrieve the Data Mover IP Interfaces (aka Storage Ports) for the specified VNX File Storage Array
*
* @param system storage system information including credentials.
* @return Map of New and Existing Storage Ports
* @throws VNXFileCollectionException
* @throws IOException
*/
private HashMap<String, List<StoragePort>> discoverPorts(StorageSystem system, Set<StorageHADomain> movers) throws VNXFileCollectionException, VNXException, IOException {
HashMap<String, List<StoragePort>> storagePorts = new HashMap<String, List<StoragePort>>();
List<StoragePort> newStoragePorts = new ArrayList<StoragePort>();
List<StoragePort> existingStoragePorts = new ArrayList<StoragePort>();
List<PhysicalNAS> modifiedServers = new ArrayList<PhysicalNAS>();
_logger.info("Start storage port discovery for storage system {}", system.getId());
// Retrieve the list of data movers interfaces for the VNX File device.
List<VNXDataMoverIntf> allDmIntfs = getPorts(system);
List<VNXVdm> vdms = getVdmPortGroups(system);
// Filter VDM ports
List<VNXDataMoverIntf> dataMovers = null;
Map<String, VNXDataMoverIntf> dmIntMap = new HashMap();
for (VNXDataMoverIntf intf : allDmIntfs) {
_logger.info("getPorts Adding {} : {}", intf.getName(), intf.getIpAddress());
dmIntMap.put(intf.getName(), intf);
}
// Changes to fix Jira CTRL - 9151
VNXFileSshApi sshDmApi = new VNXFileSshApi();
sshDmApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
// collect VDM interfaces
for (VNXVdm vdm : vdms) {
// Sometimes getVdmPortGroups(system) method does not collect all VDM interfaces,
// So running Collect NFS/CIFS interfaces from nas_server -info command. This will return
// Interfaces assigned to VDM and not thru CIFS servers
Map<String, String> vdmIntfs = sshDmApi.getVDMInterfaces(vdm.getVdmName());
for (String vdmIF : vdmIntfs.keySet()) {
_logger.info("Remove VDM interface {}", vdmIF);
dmIntMap.remove(vdmIF);
}
}
// Got the filtered out DataMover Interfaces
List<VNXDataMoverIntf> dmIntfs = new ArrayList(dmIntMap.values());
_logger.info("Number unfiltered mover interfaces found: {}", allDmIntfs.size());
_logger.info("Number mover interfaces found: {}", dmIntfs.size());
// Create the list of storage ports.
for (VNXDataMoverIntf intf : dmIntfs) {
StoragePort port = null;
StorageHADomain matchingHADomain = getMatchingMoverById(movers, intf.getDataMoverId());
// Check for valid data mover
if (null == matchingHADomain) {
continue;
}
// Check if storage port was already discovered
String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, intf.getIpAddress(), NativeGUIDGenerator.PORT);
port = findExistingPort(portNativeGuid);
if (null == port) {
// Since a port was not found, attempt with previous naming convention (ADAPTER instead of PORT)
String oldNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, intf.getIpAddress(), NativeGUIDGenerator.ADAPTER);
port = findExistingPort(oldNativeGuid);
if (null != port) {
// found with old naming convention, therefore update name.
port.setLabel(portNativeGuid);
port.setNativeGuid(portNativeGuid);
}
}
// If data mover interface was not previously discovered, add new storage port
if (port == null) {
port = new StoragePort();
port.setId(URIUtil.createId(StoragePort.class));
port.setLabel(portNativeGuid);
port.setTransportType("IP");
port.setNativeGuid(portNativeGuid);
port.setStorageDevice(system.getId());
port.setRegistrationStatus(RegistrationStatus.REGISTERED.toString());
port.setPortName(intf.getName());
port.setPortNetworkId(intf.getIpAddress());
port.setPortGroup(intf.getDataMoverId());
port.setStorageHADomain(matchingHADomain.getId());
_logger.info("Creating new storage port using NativeGuid : {} name : {}, IP : {}", new Object[] { portNativeGuid, intf.getName(), intf.getIpAddress() });
newStoragePorts.add(port);
} else {
port.setStorageHADomain(matchingHADomain.getId());
existingStoragePorts.add(port);
}
port.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
// Set storage port details to vNas
PhysicalNAS nas = findPhysicalNasByNativeId(system, intf.getDataMoverId());
if (nas != null) {
if (nas.getStoragePorts() != null && !nas.getStoragePorts().isEmpty()) {
if (nas.getStoragePorts().contains(port.getId())) {
nas.getStoragePorts().remove(port.getId());
}
}
nas.getStoragePorts().add(port.getId().toString());
modifiedServers.add(nas);
_logger.info("PhysicalNAS : {} : port : {} got modified", nas.getId(), port.getPortName());
}
}
// Persist the changed nas servers!!!
if (modifiedServers != null && !modifiedServers.isEmpty()) {
_logger.info("Modified PhysicalNAS servers size {}", modifiedServers.size());
_dbClient.persistObject(modifiedServers);
}
_logger.info("Storage port discovery for storage system {} complete", system.getId());
for (StoragePort newPort : newStoragePorts) {
_logger.info("New Storage Port : {} : {}", newPort.getNativeGuid(), newPort.getPortName() + ":" + newPort.getId());
}
for (StoragePort port : existingStoragePorts) {
_logger.info("Old Storage Port : {} : {}", port.getNativeGuid(), port.getPortName() + ":" + port.getId());
}
storagePorts.put(NEW, newStoragePorts);
storagePorts.put(EXISTING, existingStoragePorts);
return storagePorts;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class VNXFileCommunicationInterface method getAllVDMs.
private Map<String, StorageHADomain> getAllVDMs(StorageSystem storageSystem) throws IOException {
Map<String, StorageHADomain> allVDMs = new ConcurrentHashMap<>();
List<URI> storageAdapterURIs = _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStorageHADomainConstraint(storageSystem.getId()));
List<StorageHADomain> dataMovers = _dbClient.queryObject(StorageHADomain.class, storageAdapterURIs);
for (StorageHADomain dm : dataMovers) {
if (!dm.getInactive() && dm.getVirtual()) {
_logger.info("found a Virtual StorageHADomain for storage system {} {}", storageSystem.getSerialNumber(), dm.getAdapterName());
allVDMs.put(dm.getAdapterName(), dm);
}
}
return allVDMs;
}
Aggregations