use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class AbstractManager method areAllDbsvcActive.
/**
* Check if all dbsvc instances are active in the cluster
* currently it's only being used before adjusting db token number but it might as well be used elsewhere.
*
* @return true if all dbsvc are active, false otherwise
*/
protected boolean areAllDbsvcActive() {
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
List<Service> activeDbsvcs = coordinatorClient.locateAllSvcsAllVers(Constants.DBSVC_NAME);
List<String> activeDbsvcIds = new ArrayList<>(activeDbsvcs.size());
for (Service activeDbsvc : activeDbsvcs) {
activeDbsvcIds.add(activeDbsvc.getId());
}
log.info("List of active dbsvc instances in the cluster: {}, expect {} instances", activeDbsvcIds, nodeCount);
boolean allActive = activeDbsvcs.size() == nodeCount;
if (!allActive) {
log.info("not all dbsvc instances are active. Retrying...");
}
return allActive;
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SchedulerConfig method initRetainedAndUploadedBackups.
private void initRetainedAndUploadedBackups() {
this.retainedBackups.clear();
this.uploadedBackups.clear();
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
Configuration cfg = coordinatorClient.queryConfiguration(coordinatorClient.getSiteId(), Constants.BACKUP_SCHEDULER_CONFIG, Constants.GLOBAL_ID);
if (cfg != null) {
String succBackupStr = cfg.getConfig(BackupConstants.BACKUP_TAGS_RETAINED);
if (succBackupStr != null && succBackupStr.length() > 0) {
splitAndRemoveEmpty(succBackupStr, ",", this.retainedBackups);
}
String completedTagsStr = cfg.getConfig(BackupConstants.BACKUP_TAGS_UPLOADED);
if (completedTagsStr != null && completedTagsStr.length() > 0) {
splitAndRemoveEmpty(completedTagsStr, ",", this.uploadedBackups);
}
}
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SchedulerConfig method queryBackupUploadStatus.
/**
* Query upload status from ZK
*/
public BackupUploadStatus queryBackupUploadStatus() {
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
Configuration cfg = coordinatorClient.queryConfiguration(coordinatorClient.getSiteId(), BackupConstants.BACKUP_UPLOAD_STATUS, Constants.GLOBAL_ID);
Map<String, String> allItems = (cfg == null) ? new HashMap<String, String>() : cfg.getAllConfigs(false);
BackupUploadStatus uploadStatus = new BackupUploadStatus(allItems);
log.info("Upload status is: {}", uploadStatus);
return uploadStatus;
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class StoragePortProcessor method processResult.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
_newPortList = new ArrayList<StoragePort>();
_updatePortList = new ArrayList<StoragePort>();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
CoordinatorClient coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT);
Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
Set<URI> systemsToRunRPConnectivity = (HashSet<URI>) keyMap.get(Constants.SYSTEMS_RUN_RP_CONNECTIVITY);
StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
CIMObjectPath storageAdapterPath = getObjectPathfromCIMArgument(args);
Iterable<String> adapterItr = Splitter.on(Constants.PATH_DELIMITER_PATTERN).limit(3).split(storageAdapterPath.getKey(Constants.NAME).getValue().toString());
String adapterNativeGuid = NativeGUIDGenerator.generateNativeGuid(device, Iterables.getLast(adapterItr), NativeGUIDGenerator.ADAPTER);
StorageHADomain haDomain = getStorageAdapter(_dbClient, adapterNativeGuid);
if (null == haDomain) {
_logger.info("Adapter Not found");
return;
}
while (it.hasNext()) {
CIMInstance portInstance = null;
StoragePort port = null;
try {
portInstance = it.next();
// skip back end ports other than RDF Ports
if (!HADomainType.REMOTE.name().equalsIgnoreCase(haDomain.getAdapterType()) && BACKEND_PORT.equalsIgnoreCase(getCIMPropertyValue(portInstance, USAGERESTRICTION))) {
continue;
}
// 2 - Ethernet Port 4 - FC Port
if (LINKTECHNOLOGY_ETHERNET.equalsIgnoreCase(getCIMPropertyValue(portInstance, LINKTECHNOLOGY))) {
port = createStoragePort(null, portInstance, profile, haDomain, false, IP, device);
checkProtocolAlreadyExists(protocols, ISCSI);
String deviceId = getCIMPropertyValue(portInstance, DEVICEID);
/*
* For SMI-S 8.x, While getting the iSCSI Port details, we use SystemName property
* (Ex. SYMMETRIX-+-<<SERIAL>>-+-SE-1G-+-0)
* Where this call just add the deviceId to the KeyMap (i.e SE-1G-+-0).
* Hence manually constructing the key.
*/
if (device.getUsingSmis80()) {
String systemName = getCIMPropertyValue(portInstance, SYSTEM_NAME);
StringBuffer deviceIdStrBuf = new StringBuffer(systemName);
deviceIdStrBuf.append(Constants.SMIS80_DELIMITER).append(deviceId);
deviceId = deviceIdStrBuf.toString();
}
_logger.debug("Adding iSCSI Port instance {} to keyMap", deviceId);
keyMap.put(deviceId, port);
addPath(keyMap, operation.getResult(), portInstance.getObjectPath());
} else if (LINKTECHNOLOGY_FC.equalsIgnoreCase(getCIMPropertyValue(portInstance, LINKTECHNOLOGY))) {
port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
checkProtocolAlreadyExists(protocols, FC);
createStoragePort(port, portInstance, profile, haDomain, true, FC, device);
} else {
_logger.debug("Unsupported Port : {}", getCIMPropertyValue(portInstance, DEVICEID));
}
} catch (Exception e) {
_logger.warn("Port Discovery failed for {}", getCIMPropertyValue(portInstance, DEVICEID), e);
}
}
_dbClient.createObject(_newPortList);
_dbClient.persistObject(_updatePortList);
// ports used later to run Transport Zone connectivity
List<List<StoragePort>> portsUsedToRunTZoneConnectivity = (List<List<StoragePort>>) keyMap.get(Constants.STORAGE_PORTS);
portsUsedToRunTZoneConnectivity.add(_newPortList);
portsUsedToRunTZoneConnectivity.add(_updatePortList);
List<StoragePool> modifiedPools = StoragePoolAssociationHelper.getStoragePoolsFromPorts(_dbClient, _newPortList, _updatePortList);
for (StoragePool pool : modifiedPools) {
// pool matcher will be invoked on this pool
if (!poolsToMatchWithVpool.containsKey(pool.getId())) {
poolsToMatchWithVpool.put(pool.getId(), pool);
}
}
// Systems used to run RP connectivity later after runing pool matcher
systemsToRunRPConnectivity.addAll(StoragePoolAssociationHelper.getStorageSytemsFromPorts(_newPortList, null));
systemsToRunRPConnectivity.addAll(StoragePoolAssociationHelper.getStorageSytemsFromPorts(_updatePortList, null));
// discovered ports used later to check for not visible ports
List<StoragePort> discoveredPorts = (List<StoragePort>) keyMap.get(Constants.DISCOVERED_PORTS);
discoveredPorts.addAll(_newPortList);
discoveredPorts.addAll(_updatePortList);
_logger.debug("# Pools used in invoking PoolMatcher during StoragePortProcessor {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet()));
} catch (Exception e) {
_logger.error("Port Discovery failed -->{}", getMessage(e));
} finally {
_newPortList = null;
_updatePortList = null;
}
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class StorageProtocolEndPointProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
CoordinatorClient coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
List<StoragePort> newPorts = new ArrayList<StoragePort>();
List<StoragePort> existingPorts = new ArrayList<StoragePort>();
while (it.hasNext()) {
CIMInstance endPointInstance = null;
StoragePort port = null;
try {
endPointInstance = it.next();
String portInstanceID = endPointInstance.getObjectPath().getKey(SYSTEMNAME).getValue().toString();
if (device.checkIfVmax3()) {
CIMObjectPath logicalPortPath = getObjectPathfromCIMArgument(args);
// We need the portInstanceID to not constitute the Virtual information.
// i.e Instead of SYMMETRIX-+-<<SERIAL>>-+-115-+-0 it should be SYMMETRIX-+-<<SERIAL>>-+-SE-1G-+-0
StringBuffer newPortInstanceID = new StringBuffer(logicalPortPath.getKey(SYSTEMNAME).getValue().toString());
newPortInstanceID.append(Constants._plusDelimiter).append(logicalPortPath.getKey(DEVICEID).getValue().toString());
portInstanceID = (newPortInstanceID.toString()).replaceAll(Constants.SMIS_PLUS_REGEX, Constants.SMIS80_DELIMITER_REGEX);
}
String iScsiPortName = getCIMPropertyValue(endPointInstance, NAME);
// Skip the iSCSI ports without name or without a valid name.
if (null == iScsiPortName || iScsiPortName.split(COMMA_STR)[0].length() <= 0) {
_logger.warn("Invalid port Name found for {} Skipping", portInstanceID);
continue;
}
port = checkEthernetStoragePortExistsInDB(iScsiPortName.split(COMMA_STR)[0].toLowerCase(), _dbClient, device);
createEthernetStoragePort(keyMap, port, endPointInstance, portInstanceID, coordinator, newPorts, existingPorts);
addPath(keyMap, operation.getResult(), endPointInstance.getObjectPath());
} catch (Exception e) {
_logger.warn("SCSI End Point Discovery failed for {}-->{}", "", getMessage(e));
}
}
@SuppressWarnings("unchecked") List<List<StoragePort>> portsUsedToRunNetworkConnectivity = (List<List<StoragePort>>) keyMap.get(Constants.STORAGE_PORTS);
portsUsedToRunNetworkConnectivity.add(newPorts);
// discovered ports used later to check for not visible ports
List<StoragePort> discoveredPorts = (List<StoragePort>) keyMap.get(Constants.DISCOVERED_PORTS);
discoveredPorts.addAll(newPorts);
discoveredPorts.addAll(existingPorts);
List<StoragePool> modifiedPools = StoragePoolAssociationHelper.getStoragePoolsFromPorts(_dbClient, newPorts, null);
for (StoragePool pool : modifiedPools) {
// pool matcher will be invoked on this pool
if (!poolsToMatchWithVpool.containsKey(pool.getId())) {
poolsToMatchWithVpool.put(pool.getId(), pool);
}
}
_logger.debug("# Pools used in invoking PoolMatcher during StorageProtoclEndPoint {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet()));
} catch (Exception e) {
_logger.error("SCSI End Point Discovery failed -->{}", getMessage(e));
}
}
Aggregations