use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class StorageProcessor method getStorageAdapter.
protected StorageHADomain getStorageAdapter(DbClient dbClient, String adapterNativeGuid) {
try {
_logger.info("Adapter Native {}", adapterNativeGuid);
@SuppressWarnings("deprecation") List<URI> adapterURIs = dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageHADomainByNativeGuidConstraint(adapterNativeGuid));
if (adapterURIs != null && !adapterURIs.isEmpty()) {
for (URI adapterURI : adapterURIs) {
StorageHADomain adapter = dbClient.queryObject(StorageHADomain.class, adapterURI);
_logger.info("Adapter {}", adapter.getId());
if (!adapter.getInactive()) {
return adapter;
}
}
}
} catch (Exception e) {
_logger.error("Adapter {} not found", adapterNativeGuid, e);
}
return null;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method processStorageAdapterResponse.
/**
* Process the StorageAdapter response received from the server.
*
* @param system : storagesystem details.
* @param portControllerList : List of portcontrollers info received from server.
* @param accessProfile : accessProfile details.
* @throws IOException
*/
private void processStorageAdapterResponse(StorageSystem system, List<PortController> portControllerList, AccessProfile accessProfile) throws IOException {
List<StorageHADomain> newAdapters = new ArrayList<StorageHADomain>();
List<StorageHADomain> updateAdapters = new ArrayList<StorageHADomain>();
if (null != portControllerList && !portControllerList.isEmpty()) {
for (PortController portControllerFromResponse : portControllerList) {
boolean isNew = false;
String nativeGuid = NativeGUIDGenerator.generateNativeGuid(system, portControllerFromResponse.getObjectID(), NativeGUIDGenerator.ADAPTER);
StorageHADomain adapter = checkAdapterExistsInDB(nativeGuid);
if (null == adapter) {
isNew = true;
adapter = new StorageHADomain();
adapter.setStorageDeviceURI(system.getId());
adapter.setId(URIUtil.createId(StorageHADomain.class));
adapter.setAdapterName(portControllerFromResponse.getDisplayName());
adapter.setLabel(portControllerFromResponse.getDisplayName());
adapter.setNativeGuid(nativeGuid);
newAdapters.add(adapter);
}
adapter.setAdapterName(portControllerFromResponse.getDisplayName());
adapter.setLabel(portControllerFromResponse.getDisplayName());
if (!HDSConstants.NO_CLUSTER_ID.equalsIgnoreCase(portControllerFromResponse.getCluster())) {
adapter.setSlotNumber(portControllerFromResponse.getCluster());
}
adapter.setName(portControllerFromResponse.getDisplayName());
if (!isNew) {
updateAdapters.add(adapter);
}
}
_dbClient.createObject(newAdapters);
_dbClient.persistObject(updateAdapters);
}
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class HDSCommunicationInterface method checkAdapterExistsInDB.
/**
* Check if Adapter exists in DB.
*
* @param poolInstance
* @param _dbClient
* @param profile
* @return
* @throws IOException
*/
protected StorageHADomain checkAdapterExistsInDB(String nativeGuid) throws IOException {
StorageHADomain adapter = null;
// use NativeGuid to lookup Pools in DB
List<StorageHADomain> adapterInDB = CustomQueryUtility.getActiveStorageHADomainByNativeGuid(_dbClient, nativeGuid);
if (adapterInDB != null && !adapterInDB.isEmpty()) {
adapter = adapterInDB.get(0);
}
return adapter;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class VNXFileCommApi method getCIFSExport.
/**
* Get the CIFS export from the storage system based on the export path
*
* @param system storage system details
* @param args FileDeviceInputOutput object with export path details
* @return export map
*/
public Map<String, String> getCIFSExport(StorageSystem system, FileDeviceInputOutput args) {
StoragePort storagePort = _dbClient.queryObject(StoragePort.class, args.getFs().getStoragePort());
String moverId = null;
String exportPath = args.getExportPath();
StorageHADomain dataMover = null;
URI dataMoverId = storagePort.getStorageHADomain();
dataMover = _dbClient.queryObject(StorageHADomain.class, dataMoverId);
moverId = dataMover.getName();
_log.info("Getting Mover Id {} to list FS CIFS export at {}", moverId, exportPath);
// get export from storage system.
sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
Map<String, Map<String, String>> allExportsForPathMap = sshApi.getCIFSExportsForPath(dataMover.getAdapterName());
Map<String, String> exportMap = null;
if (allExportsForPathMap != null) {
exportMap = allExportsForPathMap.get(exportPath);
}
return exportMap;
}
use of com.emc.storageos.db.client.model.StorageHADomain in project coprhd-controller by CoprHD.
the class VNXFileCommApi method getNFSExport.
/**
* Get the export from the storage system based on the export path
*
* @param system storage system details
* @param args FileDeviceInputOutput object with export path details
* @return export map
*/
public Map<String, String> getNFSExport(StorageSystem system, FileDeviceInputOutput args) {
sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
StoragePort storagePort = _dbClient.queryObject(StoragePort.class, args.getFs().getStoragePort());
String moverId;
String exportPath = args.getExportPath();
StorageHADomain dataMover = null;
URI dataMoverId = storagePort.getStorageHADomain();
dataMover = _dbClient.queryObject(StorageHADomain.class, dataMoverId);
moverId = dataMover.getName();
_log.info("Getting Mover Id {} to list FS export at {}", moverId, exportPath);
// get export from storage system.
sshApi.setConnParams(system.getIpAddress(), system.getUsername(), system.getPassword());
Map<String, Map<String, String>> allExportsForPathMap = sshApi.getNFSExportsForPath(dataMover.getAdapterName(), exportPath);
Map<String, String> exportMap = null;
if (allExportsForPathMap != null) {
exportMap = allExportsForPathMap.get(exportPath);
}
return exportMap;
}
Aggregations