use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class BackupOps method getMyDownloadingZKPath.
private String getMyDownloadingZKPath() {
String downloadersPath = getDownloadOwnerPath();
CoordinatorClientImpl client = (CoordinatorClientImpl) coordinatorClient;
CoordinatorClientInetAddressMap addrMap = client.getInetAddessLookupMap();
String myNodeId = addrMap.getNodeId();
return downloadersPath + "/" + myNodeId;
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class BackupOps method unregisterDownloader.
public void unregisterDownloader() throws Exception {
String path = getMyDownloadingZKPath();
log.info("unregister downloader: {}", path);
CoordinatorClientImpl client = (CoordinatorClientImpl) coordinatorClient;
client.deleteNode(path);
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class DistributedQueueTest method testDistributedQueue.
/**
* Tests multiple consumer / producers
*
* @throws Exception
*/
@Test
public void testDistributedQueue() throws Exception {
final int eachCount = 1000;
final int numQueue = 1;
final int pushThreadCount = 20;
// manually change 'testlocal' and server for test remote
// need construct real remote env at first
boolean testlocal = true;
CoordinatorClientImpl client = null;
if (testlocal) {
client = (CoordinatorClientImpl) connectClient();
} else {
List<URI> server = new ArrayList<URI>();
server.add(URI.create("coordinator://10.247.101.174:2181"));
server.add(URI.create("coordinator://10.247.101.175:2181"));
server.add(URI.create("coordinator://10.247.101.176:2181"));
server.add(URI.create("coordinator://10.247.101.177:2181"));
server.add(URI.create("coordinator://10.247.101.178:2181"));
client = (CoordinatorClientImpl) connectClient(server);
}
CountDownLatch latch = new CountDownLatch(eachCount * pushThreadCount);
IntegerConsumer consumer = new IntegerConsumer();
consumer.setLatch(latch);
IntegerSerializer serializer = new IntegerSerializer();
List<DistributedQueue<Integer>> queueList = new ArrayList<DistributedQueue<Integer>>();
for (int index = 0; index < numQueue; index++) {
queueList.add(client.getQueue(QUEUE_NAME, consumer, serializer, 25));
}
_logger.info("basicTest start");
for (int index = 0; index < pushThreadCount; index++) {
startPut(queueList.get(index % numQueue), 0, eachCount);
}
Assert.assertTrue(latch.await(600, TimeUnit.SECONDS));
_logger.info("basicTest end");
// todo fix me: wait for async deletes to finish.
Thread.sleep(1000 * 60);
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class DrUtil method isSiteUp.
/**
* Check if site is up and running
*
* @param siteId
* @return true if any syssvc is running on this site
*/
public boolean isSiteUp(String siteId) {
// Get service beacons for given site - - assume syssvc on all sites share same service name in beacon
try {
String syssvcName = ((CoordinatorClientImpl) coordinator).getSysSvcName();
String syssvcVersion = ((CoordinatorClientImpl) coordinator).getSysSvcVersion();
List<Service> svcs = coordinator.locateAllServices(siteId, syssvcName, syssvcVersion, null, null);
List<String> nodeList = new ArrayList<>();
for (Service svc : svcs) {
nodeList.add(svc.getNodeId());
}
log.info("Site {} is up. active nodes {}", siteId, StringUtils.join(nodeList, ","));
return true;
} catch (CoordinatorException ex) {
if (ex.getServiceCode() == ServiceCode.COORDINATOR_SVC_NOT_FOUND) {
// no service beacon found for given site
return false;
}
log.error("Unexpected error when checking site service becons", ex);
return true;
}
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class BackupOps method checkBackupPropertyInfo.
private void checkBackupPropertyInfo(File propertyInfoFile, boolean isGeo) throws Exception {
RestoreManager manager = new RestoreManager();
CoordinatorClientImpl client = (CoordinatorClientImpl) coordinatorClient;
manager.setNodeCount(client.getNodeCount());
DualInetAddress addresses = coordinatorClient.getInetAddessLookupMap().getDualInetAddress();
String ipaddress4 = addresses.getInet4();
String ipaddress6 = addresses.getInet6();
manager.setIpAddress4(ipaddress4);
manager.setIpAddress6(ipaddress6);
manager.setEnableChangeVersion(false);
manager.checkBackupInfo(propertyInfoFile, isGeo);
}
Aggregations