use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class ConnectivityUtil method findAllVirtualArraysForRPSiteArray.
/**
* Find all the associated VSA URIs for the passed in RPSiteArray
*
* @param dbClient
* @param siteArray
* @param ids virtual array ids collected
* @return void
*/
private static void findAllVirtualArraysForRPSiteArray(DbClient dbClient, RPSiteArray siteArray, Collection<URI> ids) {
if (siteArray != null) {
// Find all the Storage Pools associated to this RPSiteArray
URIQueryResultList storagePoolURIs = new URIQueryResultList();
dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePoolConstraint(siteArray.getStorageSystem()), storagePoolURIs);
Iterator<URI> storagePoolIter = storagePoolURIs.iterator();
while (storagePoolIter.hasNext()) {
URI storagePoolURI = storagePoolIter.next();
StoragePool storagePool = dbClient.queryObject(StoragePool.class, storagePoolURI);
// For each Storage Pool get all the connected VSAs
if (storagePool != null && !storagePool.getInactive() && storagePool.getConnectedVirtualArrays() != null) {
for (String vArrayId : storagePool.getConnectedVirtualArrays()) {
ids.add(URI.create(vArrayId));
}
}
}
// If the rpsite array storage system is vplex check virtual array
// connectivity to rpsite using front end storage ports
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, siteArray.getStorageSystem());
if (storageSystem != null && isAVPlex(storageSystem)) {
Map<URI, List<StoragePort>> storagePortMap = ConnectivityUtil.getStoragePortsOfType(dbClient, storageSystem.getId(), PortType.frontend);
for (Map.Entry<URI, List<StoragePort>> storagePortEntry : storagePortMap.entrySet()) {
for (StoragePort storagePort : storagePortEntry.getValue()) {
// For each Storage Port get all the connected VSAs
if (storagePort.getConnectedVirtualArrays() != null && !storagePort.getConnectedVirtualArrays().isEmpty() && !ids.containsAll(URIUtil.toURIList(storagePort.getConnectedVirtualArrays()))) {
_log.info(String.format("Vplex System [%s] has connectvity to RP Site [%s]", storageSystem.getLabel(), siteArray.getRpSiteName()));
ids.addAll(URIUtil.toURIList(storagePort.getConnectedVirtualArrays()));
}
if (storagePort.getAssignedVirtualArrays() != null && !storagePort.getAssignedVirtualArrays().isEmpty() && !ids.containsAll(URIUtil.toURIList(storagePort.getAssignedVirtualArrays()))) {
_log.info(String.format("Vplex System [%s] has connectvity to RP Site [%s]", storageSystem.getLabel(), siteArray.getRpSiteName()));
ids.addAll(URIUtil.toURIList(storagePort.getAssignedVirtualArrays()));
}
}
}
}
}
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class ExportUtils method getStoragePortSystemType.
private static String getStoragePortSystemType(DbClient dbClient, StoragePort port, Map<URI, String> systemURIToType) {
URI systemURI = port.getStorageDevice();
String systemType = systemURIToType.get(systemURI);
if (systemType == null) {
StorageSystem system = dbClient.queryObject(StorageSystem.class, systemURI);
systemType = system.getSystemType();
systemURIToType.put(systemURI, systemType);
}
return systemType;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class VPlexUtil method isBackendFullCopyInReplicationGroup.
/**
* Check if the full copy is a vplex full copy and its backend full copy is in a replication group
*
* @param fullcopy
* @param dbClient
* @return true or false
*/
public static boolean isBackendFullCopyInReplicationGroup(Volume fullcopy, DbClient dbClient) {
boolean result = false;
URI systemURI = fullcopy.getStorageController();
StorageSystem system = dbClient.queryObject(StorageSystem.class, systemURI);
String type = system.getSystemType();
if (type.equals(DiscoveredDataObject.Type.vplex.name())) {
Volume backendFullcopy = getVPLEXBackendVolume(fullcopy, true, dbClient);
if (backendFullcopy != null) {
String replicationGroup = backendFullcopy.getReplicationGroupInstance();
if (NullColumnValueGetter.isNotNullValue(replicationGroup)) {
result = true;
}
}
}
return result;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class VPlexUtil method isVplexBackendVolume.
/**
* Check if the volume is a backend volume of a vplex volume
*
* @param volume the volume
* @param dbClient
* @return true or false
*/
public static boolean isVplexBackendVolume(Volume volume, DbClient dbClient) {
final List<Volume> vplexVolumes = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, Volume.class, getVolumesByAssociatedId(volume.getId().toString()));
for (Volume vplexVolume : vplexVolumes) {
URI storageURI = vplexVolume.getStorageController();
StorageSystem storage = dbClient.queryObject(StorageSystem.class, storageURI);
if (DiscoveredDataObject.Type.vplex.name().equals(storage.getSystemType())) {
return true;
}
}
return false;
}
use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.
the class FileDeviceController method deleteNFSAcls.
@Override
public void deleteNFSAcls(URI storage, URI fsURI, String subDir, String opId) throws InternalException {
ControllerUtils.setThreadLocalLogData(fsURI, opId);
FileObject fsObj = null;
FileDeviceInputOutput args = new FileDeviceInputOutput();
FileShare fs = null;
Snapshot snapshotObj = null;
boolean isFile = false;
try {
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
args.setSubDirectory(subDir);
_log.info("FileDeviceController::deleteNFSAcls Recieved Nfs ACL DELETE Operation ");
// File
if (URIUtil.isType(fsURI, FileShare.class)) {
isFile = true;
fs = _dbClient.queryObject(FileShare.class, fsURI);
fsObj = fs;
args.addFSFileObject(fs);
args.setFileSystemPath(fs.getPath());
StoragePool pool = _dbClient.queryObject(StoragePool.class, fs.getPool());
args.addStoragePool(pool);
} else {
// Snapshot
snapshotObj = _dbClient.queryObject(Snapshot.class, fsURI);
fsObj = snapshotObj;
fs = _dbClient.queryObject(FileShare.class, snapshotObj.getParent());
args.addFileShare(fs);
args.setFileSystemPath(fs.getPath());
args.addSnapshotFileObject(snapshotObj);
StoragePool pool = _dbClient.queryObject(StoragePool.class, fs.getPool());
args.addStoragePool(pool);
}
args.setFileOperation(isFile);
args.setOpId(opId);
List<NfsACE> aceDeleteList = new ArrayList<NfsACE>();
List<NFSShareACL> dbNfsAclTemp = queryAllNfsACLInDB(fs, subDir, args);
makeNfsAceFromDB(aceDeleteList, dbNfsAclTemp);
args.setNfsAclsToDelete(aceDeleteList);
// Do the Operation on device.
BiosCommandResult result = getDevice(storageObj.getSystemType()).deleteNfsACLs(storageObj, args);
if (result.isCommandSuccess()) {
// Update Database
if (!dbNfsAclTemp.isEmpty()) {
for (NFSShareACL nfsShareACL : dbNfsAclTemp) {
nfsShareACL.setInactive(true);
}
_dbClient.updateObject(dbNfsAclTemp);
}
}
if (result.getCommandPending()) {
return;
}
// Audit & Update the task status
OperationTypeEnum auditType = null;
auditType = (isFile) ? OperationTypeEnum.DELETE_FILE_SYSTEM_NFS_ACL : OperationTypeEnum.DELETE_FILE_SNAPSHOT_NFS_ACL;
fsObj.getOpStatus().updateTaskStatus(opId, result.toOperation());
// Monitoring - Event Processing
String eventMsg = result.isCommandSuccess() ? "" : result.getMessage();
if (isFile) {
recordFileDeviceOperation(_dbClient, auditType, result.isCommandSuccess(), eventMsg, args.getFileSystemPath(), fs, storageObj);
} else {
recordFileDeviceOperation(_dbClient, auditType, result.isCommandSuccess(), eventMsg, args.getFileSystemPath(), snapshotObj, fs, storageObj);
}
_dbClient.updateObject(fsObj);
} catch (Exception e) {
String[] params = { storage.toString(), fsURI.toString() };
_log.error("Unable to Delete ACL on file system or snapshot: storage {}, FS/snapshot URI {}", params, e);
_log.error("{}, {} ", e.getMessage(), e);
updateTaskStatus(opId, fsObj, e);
}
}
Aggregations