Search in sources :

Example 6 with StorageDriversInfo

use of com.emc.storageos.coordinator.client.model.StorageDriversInfo in project coprhd-controller by CoprHD.

the class StorageDriverManager method updateMetaData.

private void updateMetaData() {
    Site activeSite = drUtil.getActiveSite();
    List<StorageDriversInfo> infos = getDriversInfo(activeSite.getUuid());
    if (activeSite.getNodeCount() != infos.size()) {
        log.warn("Not all nodes are online, skip updating meta data");
        return;
    }
    boolean installFinished = updateInstallMetadata(infos);
    boolean uninstallFinished = updateUninstallMetadata(infos);
    boolean upgradeFinished = updateUpgradeMetadata(infos);
    if (installFinished || uninstallFinished || upgradeFinished) {
        restartControllerServices();
    }
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) StorageDriversInfo(com.emc.storageos.coordinator.client.model.StorageDriversInfo)

Example 7 with StorageDriversInfo

use of com.emc.storageos.coordinator.client.model.StorageDriversInfo in project coprhd-controller by CoprHD.

the class StorageDriverManager method insertMetadata.

/**
 * During upgrade, the last node who finished uninstalling old driver takes responsibility
 * to fetch meta data of new driver from ZK (and delete) and store it into DB, and then add
 * new driver file name to target list, to trigger all nodes to download it.
 */
private void insertMetadata(Map<String, StorageDriverMetaData> toInsertNewMetaDatas) {
    if (toInsertNewMetaDatas.isEmpty()) {
        return;
    }
    StorageDriversInfo info = coordinatorClient.getTargetInfo(StorageDriversInfo.class);
    if (info == null) {
        info = new StorageDriversInfo();
    }
    for (StorageDriverMetaData metaData : toInsertNewMetaDatas.values()) {
        List<StorageSystemType> types = StorageDriverMapper.map(metaData);
        for (StorageSystemType type : types) {
            type.setIsNative(false);
            type.setDriverStatus(StorageSystemType.STATUS.UPGRADING.toString());
        }
        log.info("DriverUpgradePhase1: Delete metadata from zk and insert it into db: {}", metaData.toString());
        dbClient.createObject(types);
        coordinatorClient.removeServiceConfiguration(metaData.toConfiguration());
        info.getInstalledDrivers().add(metaData.getDriverFileName());
    }
    // update target list, trigger new driver downloading
    log.info("DriverUpgradePhase1: trigger downloading for new driver files listed above");
    coordinatorClient.setTargetInfo(info);
}
Also used : StorageDriverMetaData(com.emc.storageos.coordinator.client.model.StorageDriverMetaData) StorageDriversInfo(com.emc.storageos.coordinator.client.model.StorageDriversInfo) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType)

Example 8 with StorageDriversInfo

use of com.emc.storageos.coordinator.client.model.StorageDriversInfo in project coprhd-controller by CoprHD.

the class StorageDriverManager method updateUninstallMetadata.

private boolean updateUninstallMetadata(List<StorageDriversInfo> infos) {
    List<StorageSystemType> uninstallingTypes = queryDriversByStatus(StorageSystemType.STATUS.UNISNTALLING);
    List<StorageSystemType> finishedTypes = new ArrayList<StorageSystemType>();
    boolean needRestart = false;
    log.info("Uninstalling storage system types: {}", concatStorageSystemTypeNames(uninstallingTypes));
    for (StorageSystemType type : uninstallingTypes) {
        boolean finished = true;
        for (StorageDriversInfo info : infos) {
            if (info.getInstalledDrivers().contains(type.getDriverFileName())) {
                finished = false;
                break;
            }
        }
        if (finished) {
            dbClient.removeObject(type);
            finishedTypes.add(type);
            log.info("Remove {}", type.getStorageTypeName());
            needRestart = true;
        }
    }
    for (String driver : extractDrivers(finishedTypes)) {
        auditCompleteOperation(OperationTypeEnum.UNINSTALL_STORAGE_DRIVER, AuditLogManager.AUDITLOG_SUCCESS, driver);
    }
    return needRestart;
}
Also used : ArrayList(java.util.ArrayList) StorageSystemType(com.emc.storageos.db.client.model.StorageSystemType) StorageDriversInfo(com.emc.storageos.coordinator.client.model.StorageDriversInfo)

Example 9 with StorageDriversInfo

use of com.emc.storageos.coordinator.client.model.StorageDriversInfo in project coprhd-controller by CoprHD.

the class StorageDriverManager method initializeLocalAndTargetInfo.

private void initializeLocalAndTargetInfo() {
    localDriverFiles = localRepo.getLocalDrivers();
    log.info("Local drivers initialized: {}", Arrays.toString(localDriverFiles.toArray()));
    StorageDriversInfo targetInfo = coordinator.getTargetInfo(StorageDriversInfo.class);
    if (targetInfo == null) {
        targetInfo = new StorageDriversInfo();
        targetInfo.setInstalledDrivers(localDriverFiles);
        coordinator.setTargetInfo(targetInfo);
        log.info("Can't find target storage drivers info, so init it with local drivers list");
    }
    targetDriverFiles = targetInfo.getInstalledDrivers();
    log.info("Target drivers info initialized: {}", Arrays.toString(targetDriverFiles.toArray()));
}
Also used : StorageDriversInfo(com.emc.storageos.coordinator.client.model.StorageDriversInfo)

Example 10 with StorageDriversInfo

use of com.emc.storageos.coordinator.client.model.StorageDriversInfo in project coprhd-controller by CoprHD.

the class StorageDriverManager method hasActiveSiteFinishDownload.

private boolean hasActiveSiteFinishDownload(String driverFileName) {
    Site activeSite = drUtil.getActiveSite();
    String activeSiteId = activeSite.getUuid();
    List<StorageDriversInfo> infos = getDriversInfo(activeSiteId);
    if (activeSite.getNodeCount() != infos.size()) {
        // there're offline node in active site
        return false;
    }
    for (StorageDriversInfo info : infos) {
        if (!info.getInstalledDrivers().contains(driverFileName)) {
            return false;
        }
    }
    return true;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) StorageDriversInfo(com.emc.storageos.coordinator.client.model.StorageDriversInfo)

Aggregations

StorageDriversInfo (com.emc.storageos.coordinator.client.model.StorageDriversInfo)14 StorageSystemType (com.emc.storageos.db.client.model.StorageSystemType)8 StorageDriverMetaData (com.emc.storageos.coordinator.client.model.StorageDriverMetaData)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 InterProcessLock (org.apache.curator.framework.recipes.locks.InterProcessLock)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)3 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)3 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)3 Site (com.emc.storageos.coordinator.client.model.Site)2 Service (com.emc.storageos.coordinator.common.Service)2 HashSet (java.util.HashSet)2 ExecutorService (java.util.concurrent.ExecutorService)2 ZipFile (java.util.zip.ZipFile)2 Consumes (javax.ws.rs.Consumes)2 POST (javax.ws.rs.POST)2 Path (javax.ws.rs.Path)2 ConfigVersion (com.emc.storageos.coordinator.client.model.ConfigVersion)1 PowerOffState (com.emc.storageos.coordinator.client.model.PowerOffState)1