use of com.emc.storageos.db.client.constraint.URIQueryResultList in project coprhd-controller by CoprHD.
the class RegistryImpl method getDriverAttributes.
@Override
public Map<String, Map<String, List<String>>> getDriverAttributes(String driverName) {
Map<String, Map<String, List<String>>> keyMap = new HashMap<>();
// find existing entries for driver name
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
Map<String, List<String>> attributesMap = new HashMap<>();
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
StringSetMap attributes = registryEntry.getAttributes();
for (Map.Entry<String, AbstractChangeTrackingSet<String>> entry : attributes.entrySet()) {
attributesMap.put(entry.getKey(), new ArrayList<>(entry.getValue()));
}
keyMap.put(registryEntry.getRegistryKey(), attributesMap);
}
return keyMap;
}
use of com.emc.storageos.db.client.constraint.URIQueryResultList in project coprhd-controller by CoprHD.
the class RegistryImpl method clearDriverAttributesForKey.
@Override
public void clearDriverAttributesForKey(String driverName, String key) {
validateRegistryRequest(driverName, key);
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
if (registryEntry.getRegistryKey().equals(key)) {
// remove this entry from db
dbClient.markForDeletion(registryEntry);
break;
}
}
}
use of com.emc.storageos.db.client.constraint.URIQueryResultList in project coprhd-controller by CoprHD.
the class ConnectivityUtil method getStoragePortsForSystem.
/**
* Retrieve all the storage ports of a given StorageSystem and type.
*
* @param storage -- StorageSystem URI
* @return List<StoragePort> -- A list of the the Storage Ports in that Network
*/
public static List<StoragePort> getStoragePortsForSystem(DbClient dbClient, URI storage) {
List<StoragePort> ports = new ArrayList<StoragePort>();
URIQueryResultList storagePortURIs = new URIQueryResultList();
dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStoragePortConstraint(storage), storagePortURIs);
Iterator<URI> storagePortsIter = storagePortURIs.iterator();
while (storagePortsIter.hasNext()) {
URI portURI = storagePortsIter.next();
StoragePort port = dbClient.queryObject(StoragePort.class, portURI);
if (port == null || port.getInactive() == true) {
continue;
}
if (!DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name().equals(port.getCompatibilityStatus())) {
continue;
}
if (false == port.getRegistrationStatus().equals(StoragePort.RegistrationStatus.REGISTERED.name())) {
continue;
}
if (!DiscoveryStatus.VISIBLE.name().equals(port.getDiscoveryStatus())) {
continue;
}
ports.add(port);
}
return ports;
}
use of com.emc.storageos.db.client.constraint.URIQueryResultList in project coprhd-controller by CoprHD.
the class ConnectivityUtil method getProtectionSystemsAssociatedWithArray.
/**
* Get all protection systems associated with an array.
*
* @param dbClient - db client
* @param storageSystem - storage array
* @return list of URIs corresponding to rp systems
*/
public static Set<URI> getProtectionSystemsAssociatedWithArray(DbClient dbClient, URI storageSystem) {
Set<URI> rpSystemIds = new HashSet<URI>();
// Get the Source Storage System in question
StorageSystem sourceStorageSystem = dbClient.queryObject(StorageSystem.class, storageSystem);
// Get all the RPSiteArrays associated to this Storage System
URIQueryResultList sitelist = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getRPSiteArrayByStorageSystemConstraint(storageSystem.toString()), sitelist);
Iterator<URI> it = sitelist.iterator();
while (it.hasNext()) {
URI rpSiteArrayId = it.next();
RPSiteArray rpSiteArray = dbClient.queryObject(RPSiteArray.class, rpSiteArrayId);
if (rpSiteArray != null) {
// Find source RPSiteArrays that qualify and get the Protection System
if (sourceStorageSystem.getId().equals(rpSiteArray.getStorageSystem())) {
rpSystemIds.add(rpSiteArray.getRpProtectionSystem());
}
}
}
return rpSystemIds;
}
use of com.emc.storageos.db.client.constraint.URIQueryResultList 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()));
}
}
}
}
}
}
Aggregations