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();
}
}
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);
}
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;
}
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()));
}
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;
}
Aggregations