Search in sources :

Example 1 with LocalRepository

use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.

the class ZkCmdHandler method rollbackDataRevision.

public void rollbackDataRevision() throws Exception {
    DrUtil drUtil = new DrUtil(ZKUtil.getCoordinatorClient());
    if (!precheckForRollback(drUtil)) {
        return;
    }
    LocalRepository localRepository = LocalRepository.getInstance();
    PropertyInfoExt localDataRevisionProps = localRepository.getDataRevisionPropertyInfo();
    String prevRevision = localDataRevisionProps.getProperty(Constants.KEY_PREV_DATA_REVISION);
    log.info("Previous data revision at local {}", prevRevision);
    if (StringUtils.isNotEmpty(prevRevision)) {
        long rollbackTargetRevision = Long.parseLong(prevRevision);
        drUtil.updateVdcTargetVersion(drUtil.getLocalSite().getUuid(), SiteInfo.DR_OP_CHANGE_DATA_REVISION, DrUtil.newVdcConfigVersion(), rollbackTargetRevision);
        log.info("Manual rollback to {} has been triggered", rollbackTargetRevision);
        System.out.println(String.format("Rollback to %s has been initiated successfully", prevRevision));
    } else {
        log.warn("No valid previous revision found. Skip rollback");
        System.out.println("Can't find viable previous data revision. Rollback oparation has been aborted");
    }
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil) LocalRepository(com.emc.storageos.systemservices.impl.upgrade.LocalRepository)

Example 2 with LocalRepository

use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.

the class SecretsManager method genDHParam.

private boolean genDHParam() {
    LocalRepository localRepository = LocalRepository.getInstance();
    try {
        localRepository.genDHParam();
        log.info("Reconfiguring SSL related config files");
        localRepository.reconfigProperties(SSL_PROP_TAG);
        log.info("Invoking SSL notifier");
        Notifier.getInstance(SSL_PROP_TAG).doNotify();
    } catch (Exception e) {
        log.warn("Failed to generate dhparam.", e);
        return false;
    }
    return true;
}
Also used : LocalRepository(com.emc.storageos.systemservices.impl.upgrade.LocalRepository)

Example 3 with LocalRepository

use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.

the class DrZkHealthMonitor method reconfigZKToWritable.

/**
 * reconfigure ZooKeeper to participant mode within the local site
 *
 * @param observerNodes to be reconfigured
 * @param readOnlyNodes to be reconfigured
 */
public void reconfigZKToWritable(List<String> observerNodes, List<String> readOnlyNodes) {
    log.info("Standby is running in read-only mode due to connection loss with active site. " + "Reconfig coordinatorsvc of all nodes to writable");
    try {
        boolean reconfigLocal = false;
        // if zk is switched from observer mode to participant, reload syssvc
        for (String node : observerNodes) {
            // The local node cannot reboot itself before others
            if (node.equals(coordinatorExt.getMyNodeId())) {
                reconfigLocal = true;
                continue;
            }
            LocalRepository localRepository = LocalRepository.getInstance();
            localRepository.remoteReconfigCoordinator(node, "participant");
            localRepository.remoteRestartCoordinator(node, "participant");
        }
        for (String node : readOnlyNodes) {
            // The local node cannot reboot itself before others
            if (node.equals(coordinatorExt.getMyNodeId())) {
                reconfigLocal = true;
                continue;
            }
            LocalRepository localRepository = LocalRepository.getInstance();
            localRepository.remoteReconfigCoordinator(node, "participant");
            localRepository.remoteRestartCoordinator(node, "participant");
        }
        // reconfigure local node last
        if (reconfigLocal) {
            coordinatorExt.reconfigZKToWritable();
        }
    } catch (Exception ex) {
        log.warn("Unexpected errors during switching back to zk observer. Try again later. {}", ex.toString());
    }
}
Also used : LocalRepository(com.emc.storageos.systemservices.impl.upgrade.LocalRepository)

Example 4 with LocalRepository

use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.

the class IPsecManager method checkIPsecStatus.

private List<String> checkIPsecStatus() {
    LocalRepository localRepository = new LocalRepository();
    String[] disconnectedIPs = localRepository.checkIpsecConnection();
    if (disconnectedIPs[0].isEmpty()) {
        log.info("IPsec runtime status is good.");
        // return empty list to avoid null pointer in java client.
        return new ArrayList<String>();
    } else {
        log.info("Some nodes disconnected over IPsec {}", disconnectedIPs);
        return Arrays.asList(disconnectedIPs);
    }
}
Also used : LocalRepository(com.emc.storageos.systemservices.impl.upgrade.LocalRepository) ArrayList(java.util.ArrayList)

Example 5 with LocalRepository

use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.

the class SchedulerConfig method isClusterUpgrading.

private boolean isClusterUpgrading() {
    try {
        RepositoryInfo target = coordinator.getTargetInfo(RepositoryInfo.class);
        SoftwareVersion targetVersion = target.getCurrentVersion();
        SoftwareVersion currentVersion = new LocalRepository().getRepositoryInfo().getCurrentVersion();
        log.info("The current version={} target version={}", currentVersion, targetVersion);
        if (!currentVersion.equals(targetVersion)) {
            log.info("The current version is NOT equals to target version");
            return true;
        }
    } catch (Exception e) {
        log.error("Failed to get versions e=", e);
        // failed to read data from zk, so no need to do backup at this time
        return true;
    }
    CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
    String currentDbSchemaVersion = coordinatorClient.getCurrentDbSchemaVersion();
    String targetDbSchemaVersion = coordinatorClient.getTargetDbSchemaVersion();
    log.info("Current db schema version: {}, target db schema version: {}.", currentDbSchemaVersion, targetDbSchemaVersion);
    if (currentDbSchemaVersion == null || !currentDbSchemaVersion.equalsIgnoreCase(targetDbSchemaVersion)) {
        log.warn("Current version is not equal to the target version");
        return true;
    }
    ClusterState state = coordinatorClient.getControlNodesState();
    log.info("Current control nodes' state: {}", state);
    if (state == ClusterState.STABLE || state == ClusterState.SYNCING || state == ClusterState.DEGRADED) {
        return false;
    }
    return true;
}
Also used : ClusterState(com.emc.vipr.model.sys.ClusterInfo.ClusterState) SoftwareVersion(com.emc.storageos.coordinator.client.model.SoftwareVersion) RepositoryInfo(com.emc.storageos.coordinator.client.model.RepositoryInfo) LocalRepository(com.emc.storageos.systemservices.impl.upgrade.LocalRepository) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Aggregations

LocalRepository (com.emc.storageos.systemservices.impl.upgrade.LocalRepository)9 RepositoryInfo (com.emc.storageos.coordinator.client.model.RepositoryInfo)2 SoftwareVersion (com.emc.storageos.coordinator.client.model.SoftwareVersion)2 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)1 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)1 ClusterState (com.emc.vipr.model.sys.ClusterInfo.ClusterState)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Test (org.junit.Test)1