Search in sources :

Example 21 with CoordinatorClientInetAddressMap

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

the class BackupOps method initHosts.

private synchronized void initHosts() {
    CoordinatorClientInetAddressMap addressMap = getInetAddressLookupMap();
    hosts = new TreeMap<>();
    for (String nodeId : addressMap.getControllerNodeIPLookupMap().keySet()) {
        try {
            String ipAddr = addressMap.getConnectableInternalAddress(nodeId);
            DualInetAddress inetAddress = DualInetAddress.fromAddress(ipAddr);
            String host = normalizeDualInetAddress(inetAddress);
            hosts.put(nodeId, host);
        } catch (Exception ex) {
            throw BackupException.fatals.failedToGetHost(nodeId, ex);
        }
    }
    quorumSize = hosts.size() / 2 + 1;
}
Also used : CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) URISyntaxException(java.net.URISyntaxException) CancellationException(java.util.concurrent.CancellationException) MalformedObjectNameException(javax.management.MalformedObjectNameException) RetryableBackupException(com.emc.storageos.management.backup.exceptions.RetryableBackupException) KeeperException(org.apache.zookeeper.KeeperException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) ExecutionException(java.util.concurrent.ExecutionException) BackupException(com.emc.storageos.management.backup.exceptions.BackupException)

Example 22 with CoordinatorClientInetAddressMap

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

the class ZkSimulator method connectClient.

/**
 * Connects to Zookeeper server
 *
 * @return The instance of CoordinatorClient
 * @throws IOException
 */
private CoordinatorClient connectClient() throws IOException {
    CoordinatorClientImpl client = new CoordinatorClientImpl();
    ZkConnection conn = new ZkConnection();
    URI zkUri = URI.create(String.format("coordinator://localhost:%s", config.getClientPortAddress().getPort()));
    conn.setServer(Arrays.asList(zkUri));
    conn.setTimeoutMs(10 * 1000);
    conn.setSiteIdFile("build/data/zk/siteIdFile");
    log.info("Connecting with coordinator service...");
    conn.build();
    log.info("Connecting with coordinator service.");
    client.setZkConnection(conn);
    CoordinatorClientInetAddressMap inetAddressMap = new CoordinatorClientInetAddressMap();
    inetAddressMap.setNodeId("standalone");
    inetAddressMap.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
    inetAddressMap.setCoordinatorClient(client);
    inetAddressMap.setControllerNodeIPLookupMap(new HashMap<String, DualInetAddress>());
    client.setInetAddessLookupMap(inetAddressMap);
    client.setSysSvcName("syssvc");
    client.setSysSvcVersion("1");
    client.setVdcShortId("vdc1");
    Properties properties = new Properties();
    properties.setProperty(BackupConstants.BACKUP_MAX_MANUAL_COPIES, "5");
    client.setDefaultProperties(properties);
    FileInputStream is = new FileInputStream(ovfPropsLocation);
    Properties ovfProps = new Properties();
    ovfProps.load(is);
    is.close();
    client.setOvfProperties(ovfProps);
    client.start();
    return client;
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) Properties(java.util.Properties) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) FileInputStream(java.io.FileInputStream)

Aggregations

CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)22 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)13 ZkConnection (com.emc.storageos.coordinator.common.impl.ZkConnection)9 ArrayList (java.util.ArrayList)9 URI (java.net.URI)8 HashMap (java.util.HashMap)7 FileInputStream (java.io.FileInputStream)6 CoordinatorClientImpl (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl)5 Properties (java.util.Properties)5 Before (org.junit.Before)5 DbVersionInfo (com.emc.storageos.coordinator.client.model.DbVersionInfo)4 KeyCertificateAlgorithmValuesHolder (com.emc.storageos.security.keystore.impl.KeyCertificateAlgorithmValuesHolder)4 KeyCertificatePairGenerator (com.emc.storageos.security.keystore.impl.KeyCertificatePairGenerator)3 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)3 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)2 Configuration (com.emc.storageos.coordinator.common.Configuration)2 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)2 ServiceImpl (com.emc.storageos.coordinator.common.impl.ServiceImpl)2 DbClientContext (com.emc.storageos.db.client.impl.DbClientContext)2 DbClientImpl (com.emc.storageos.db.client.impl.DbClientImpl)2