Search in sources :

Example 6 with CoordinatorClientImpl

use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.

the class DistributedQueueTest method createStatisticDistQueue.

/**
 * Create a distributed queue for statistic purpose
 *
 * @throws Exception
 */
public DistributedQueue<Integer> createStatisticDistQueue(final int serial, final int threadsNumber) {
    try {
        CoordinatorClientImpl client = null;
        client = (CoordinatorClientImpl) connectClient();
        ItemStatisticConsumer consumer = new ItemStatisticConsumer();
        consumer.setSerial(serial);
        IntegerSerializer serializer = new IntegerSerializer();
        DistributedQueue<Integer> queue = client.getQueue(QUEUE_NAME_4, consumer, serializer, threadsNumber);
        statisticDistQueueList.add(queue);
        return queue;
    } catch (Exception e) {
        _logger.error("Failed to create statistic distribution queue.", e);
        return null;
    }
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)

Example 7 with CoordinatorClientImpl

use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.

the class DrUtil method isAllSyssvcUp.

/**
 * Check if all syssvc is up and running for specified site
 * @param siteId
 * @return true if all syssvc is running
 */
public boolean isAllSyssvcUp(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);
        Site site = this.getSiteFromLocalVdc(siteId);
        log.info("Node count is {}, running syssvc count is", site.getNodeCount(), svcs.size());
        return svcs.size() == site.getNodeCount();
    } catch (CoordinatorException ex) {
        return false;
    }
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) Site(com.emc.storageos.coordinator.client.model.Site) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) Service(com.emc.storageos.coordinator.common.Service)

Example 8 with CoordinatorClientImpl

use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.

the class TestCoordinatorService method start.

public void start() throws Exception {
    zkServer = new TestingServer();
    zkConnection = new ZkConnection();
    zkConnection.setServer(Collections.singletonList(new URI("coordinator://localhost:" + zkServer.getPort())));
    zkConnection.build();
    coordinatorClient = new CoordinatorClientImpl();
    coordinatorClient.setZkConnection(zkConnection);
    coordinatorClient.setInetAddessLookupMap(StubCoordinatorClientImpl.createLocalAddressLookupMap());
    coordinatorClient.start();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) StubCoordinatorClientImpl(com.emc.sa.model.mock.StubCoordinatorClientImpl) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection)

Example 9 with CoordinatorClientImpl

use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.

the class GeoSeedProviderImpl method initCoordinatorClient.

/**
 * Construct coordinator client from argument. Seed provider instance is created by cassandra
 * on demand. Not from spring context.
 *
 * @param args
 */
private void initCoordinatorClient(Map<String, String> args) throws IOException {
    // endpoints for coordinator in local site
    String coordinatorArg = args.get(COORDINATORS);
    if (coordinatorArg == null || coordinatorArg.trim().isEmpty()) {
        throw new IllegalArgumentException(COORDINATORS);
    }
    String[] coordinators = coordinatorArg.split(",", -1);
    List<URI> uri = new ArrayList<URI>(coordinators.length);
    for (String coord : coordinators) {
        if (!coord.trim().isEmpty()) {
            uri.add(URI.create(coord.trim()));
        }
    }
    ZkConnection connection = new ZkConnection();
    connection.setServer(uri);
    String siteIdFile = args.get(Constants.SITE_ID_FILE);
    connection.setSiteIdFile(siteIdFile);
    connection.build();
    CoordinatorClientImpl client = new CoordinatorClientImpl();
    client.setZkConnection(connection);
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/nodeaddrmap-var.xml");
    CoordinatorClientInetAddressMap inetAddressMap = (CoordinatorClientInetAddressMap) ctx.getBean("inetAddessLookupMap");
    if (inetAddressMap == null) {
        log.error("CoordinatorClientInetAddressMap is not initialized. Node address lookup will fail.");
    }
    // HARCODE FOR NOW
    client.setInetAddessLookupMap(inetAddressMap);
    client.start();
    coordinator = client;
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ArrayList(java.util.ArrayList) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection)

Example 10 with CoordinatorClientImpl

use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.

the class DbSvcRunner method getCoordinator.

/**
 * Get CoordinatorClient instance
 *
 * @return
 * @throws URISyntaxException
 * @throws IOException
 */
public CoordinatorClient getCoordinator() throws URISyntaxException, IOException {
    if (coordinator == null) {
        ZkConnection zkConn = new ZkConnection();
        List<URI> uris = new ArrayList<URI>();
        uris.add(new URI("coordinator://localhost:2181"));
        zkConn.setServer(uris);
        zkConn.setTimeoutMs(10000);
        zkConn.build();
        // Suppress Sonar violation of Lazy initialization of static fields should be synchronized
        // Junit test will be called in single thread by default, it's safe to ignore this violation
        // NOSONAR ("squid:S2444")
        coordinator = new CoordinatorClientImpl();
        coordinator.setZkConnection(zkConn);
        coordinator.setSysSvcName("syssvc");
        coordinator.setSysSvcVersion("1");
        coordinator.setNodeCount(1);
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("nodeaddrmap-var.xml");
        CoordinatorClientInetAddressMap inetAddressMap = (CoordinatorClientInetAddressMap) ctx.getBean("inetAddessLookupMap");
        if (inetAddressMap == null) {
            log.error("CoordinatorClientInetAddressMap is not initialized. Node address lookup will fail.");
        }
        Map<String, DualInetAddress> controlNodes = inetAddressMap.getControllerNodeIPLookupMap();
        // HARCODE FOR NOW
        coordinator.setInetAddessLookupMap(inetAddressMap);
        DbVersionInfo dbVersionInfo = new DbVersionInfo();
        dbVersionInfo.setSchemaVersion(SVC_VERSION);
        coordinator.setDbVersionInfo(dbVersionInfo);
        coordinator.start();
    }
    return coordinator;
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ArrayList(java.util.ArrayList) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) DbVersionInfo(com.emc.storageos.coordinator.client.model.DbVersionInfo)

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