use of com.emc.storageos.coordinator.client.model.StorageDriverMetaData in project coprhd-controller by CoprHD.
the class StorageDriverManager method updateUpgradeMetadata.
private boolean updateUpgradeMetadata(List<StorageDriversInfo> infos) {
List<StorageSystemType> upgradingTypes = queryDriversByStatus(StorageSystemType.STATUS.UPGRADING);
List<StorageSystemType> finishedTypes = new ArrayList<StorageSystemType>();
boolean needRestart = false;
Map<String, StorageDriverMetaData> toInsertNewMetaDatas = new HashMap<String, StorageDriverMetaData>();
log.info("Upgrading storage system types: {}", concatStorageSystemTypeNames(upgradingTypes));
for (StorageSystemType type : upgradingTypes) {
String driverName = type.getDriverName();
String driverFileName = type.getDriverFileName();
if (upgradingDriverMap.containsKey(driverName)) {
StorageDriverMetaData metaData = upgradingDriverMap.get(driverName);
// last one removes old meta data
boolean finished = true;
for (StorageDriversInfo info : infos) {
if (info.getInstalledDrivers().contains(driverFileName)) {
finished = false;
break;
}
}
if (finished) {
toInsertNewMetaDatas.put(metaData.getDriverName(), metaData);
log.info("DriverUpgradephase1: remove {} ", type.getStorageTypeName());
dbClient.removeObject(type);
}
} else {
// last one marks active
boolean finished = true;
for (StorageDriversInfo info : infos) {
if (!info.getInstalledDrivers().contains(type.getDriverFileName())) {
finished = false;
break;
}
}
if (finished) {
type.setDriverStatus(StorageSystemType.STATUS.ACTIVE.toString());
dbClient.updateObject(type);
finishedTypes.add(type);
log.info("DriverUpgradephase2: mark active for {}", type.getStorageTypeName());
needRestart = true;
}
}
}
insertMetadata(toInsertNewMetaDatas);
for (String driver : extractDrivers(finishedTypes)) {
auditCompleteOperation(OperationTypeEnum.UPGRADE_STORAGE_DRIVER, AuditLogManager.AUDITLOG_SUCCESS, driver);
}
return needRestart;
}
use of com.emc.storageos.coordinator.client.model.StorageDriverMetaData in project coprhd-controller by CoprHD.
the class StorageDriverManager method getUpgradeDriverMetaDataMap.
private Map<String, StorageDriverMetaData> getUpgradeDriverMetaDataMap() {
List<Configuration> configs = coordinatorClient.queryAllConfiguration(StorageDriverMetaData.KIND);
Map<String, StorageDriverMetaData> result = new HashMap<String, StorageDriverMetaData>();
if (configs == null || configs.isEmpty()) {
return result;
}
for (Configuration config : configs) {
StorageDriverMetaData newMetaData = new StorageDriverMetaData(config);
result.put(newMetaData.getDriverName(), newMetaData);
}
return result;
}
use of com.emc.storageos.coordinator.client.model.StorageDriverMetaData in project coprhd-controller by CoprHD.
the class StorageDriverServiceTest method testUpgrade.
@Test
public void testUpgrade() {
String driverName = "driver1";
FormDataContentDisposition details = mock(FormDataContentDisposition.class);
doReturn(0L).when(details).getSize();
boolean force = false;
StorageDriverMetaData metaData = createMetaData();
metaData.setDriverName("driver1");
metaData.setDriverVersion("1.2.3.5");
// mock parsing meta data
doReturn(metaData).when(service).parseDriverMetaData(anyObject());
try {
service.upgrade(driverName, null, details, force);
} catch (Exception e) {
fail("driver upgrade failed");
}
}
Aggregations