Search in sources :

Example 11 with CoordinatorClientImpl

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;
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)

Example 12 with CoordinatorClientImpl

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);
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl)

Example 13 with CoordinatorClientImpl

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);
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) CountDownLatch(java.util.concurrent.CountDownLatch) URI(java.net.URI) Test(org.junit.Test)

Example 14 with CoordinatorClientImpl

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;
    }
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ArrayList(java.util.ArrayList) Service(com.emc.storageos.coordinator.common.Service)

Example 15 with CoordinatorClientImpl

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);
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Aggregations

CoordinatorClientImpl (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl)18 ZkConnection (com.emc.storageos.coordinator.common.impl.ZkConnection)6 URI (java.net.URI)6 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)5 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)4 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)3 ArrayList (java.util.ArrayList)3 DbVersionInfo (com.emc.storageos.coordinator.client.model.DbVersionInfo)2 Service (com.emc.storageos.coordinator.common.Service)2 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)2 IOException (java.io.IOException)2 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)2 StubCoordinatorClientImpl (com.emc.sa.model.mock.StubCoordinatorClientImpl)1 Site (com.emc.storageos.coordinator.client.model.Site)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 DbClientContext (com.emc.storageos.db.client.impl.DbClientContext)1 DbClientImpl (com.emc.storageos.db.client.impl.DbClientImpl)1 BackupException (com.emc.storageos.management.backup.exceptions.BackupException)1 RetryableBackupException (com.emc.storageos.management.backup.exceptions.RetryableBackupException)1 FileInputStream (java.io.FileInputStream)1