Search in sources :

Example 16 with CoordinatorClientImpl

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

the class BackupOps method isDownloadInProgress.

public boolean isDownloadInProgress() {
    try {
        CoordinatorClientImpl client = (CoordinatorClientImpl) coordinatorClient;
        String path = getDownloadOwnerPath();
        log.info("Download zk path={}", path);
        List<String> downloaders = client.getChildren(path);
        return (downloaders != null) && (!downloaders.isEmpty());
    } catch (KeeperException.NoNodeException e) {
        // no downloading is running
        return false;
    } catch (Exception e) {
        log.error("Failed to check downloading tasks e=", e);
        throw BackupException.fatals.failedToReadZkInfo(e);
    }
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl) KeeperException(org.apache.zookeeper.KeeperException) 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 17 with CoordinatorClientImpl

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

the class BackupOps method registerDownloader.

public void registerDownloader() throws Exception {
    String path = getMyDownloadingZKPath();
    CoordinatorClientImpl client = (CoordinatorClientImpl) coordinatorClient;
    log.info("register downloader: {}", path);
    client.createEphemeralNode(path, null);
}
Also used : CoordinatorClientImpl(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl)

Example 18 with CoordinatorClientImpl

use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl 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

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