use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverManager method updateInstallMetadata.
private boolean updateInstallMetadata(List<StorageDriversInfo> infos) {
List<StorageSystemType> installingTypes = queryDriversByStatus(StorageSystemType.STATUS.INSTALLING);
List<StorageSystemType> finishedTypes = new ArrayList<StorageSystemType>();
boolean needRestart = false;
log.info("Installing storage system types: {}", concatStorageSystemTypeNames(installingTypes));
for (StorageSystemType type : installingTypes) {
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("update status from installing to active for {}", type.getStorageTypeName());
needRestart = true;
}
}
for (String driver : extractDrivers(finishedTypes)) {
auditCompleteOperation(OperationTypeEnum.INSTALL_STORAGE_DRIVER, AuditLogManager.AUDITLOG_SUCCESS, driver);
}
return needRestart;
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class ExternalDeviceCommunicationInterface method initDrivers.
private void initDrivers() {
if (initialized) {
return;
}
List<URI> ids = _dbClient.queryByType(StorageSystemType.class, true);
Iterator<StorageSystemType> it = _dbClient.queryIterativeObjects(StorageSystemType.class, ids);
Map<String, AbstractStorageDriver> cachedDriverInstances = new HashMap<>();
while (it.hasNext()) {
StorageSystemType type = it.next();
if (type.getIsNative() == null || type.getIsNative()) {
continue;
}
if (!StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.BLOCK.toString())) {
continue;
}
String typeName = type.getStorageTypeName();
String className = type.getDriverClassName();
// provider and managed system should use the same driver instance
if (cachedDriverInstances.containsKey(className)) {
drivers.put(typeName, cachedDriverInstances.get(className));
_log.info("Driver info for storage system type {} has been set into externaldevice instance", typeName);
continue;
}
String mainClassName = type.getDriverClassName();
try {
AbstractStorageDriver driverInstance = (AbstractStorageDriver) Class.forName(mainClassName).newInstance();
drivers.put(typeName, driverInstance);
cachedDriverInstances.put(className, driverInstance);
_log.info("Driver info for storage system type {} has been set into externaldevice instance", typeName);
} catch (Exception e) {
_log.error("Error happened when instantiating class {}", mainClassName);
}
}
initialized = true;
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageSystemTypesInitUtils method insertStorageSystemTypes.
private void insertStorageSystemTypes() {
for (Map.Entry<META_TYPE, List<String>> entry : SYSTEMS_AND_PROVIDERS.entrySet()) {
META_TYPE metaType = entry.getKey();
List<String> systems = entry.getValue();
for (String system : systems) {
if (!PlatformUtils.isOssBuild() && system.equals(CEPH)) {
log.info("Skip inserting ceph meta data in non-oss build");
continue;
}
StorageSystemType type = new StorageSystemType();
URI uri = URIUtil.createId(StorageSystemType.class);
type.setId(uri);
type.setStorageTypeId(uri.toString());
type.setStorageTypeName(system);
type.setStorageTypeDispName(DISPLAY_NAME_MAP.get(system));
type.setMetaType(mapType(metaType));
type.setDriverClassName(metaType.toString().toLowerCase());
type.setIsSmiProvider(metaType.isProvider());
type.setIsDefaultSsl(SSL_ENABLE_TYPE_LIST.contains(system));
type.setIsDefaultMDM(MDM_ENABLE_LIST.contains(system));
type.setIsOnlyMDM(ONLY_MDM_LIST.contains(system));
type.setIsElementMgr(ELEMENT_MANAGER_LIST.contains(system));
type.setIsSecretKey(SECREAT_KEY_ENABLE_LIST.contains(system));
type.setSslPort(SSL_PORT_MAP.get(system));
type.setNonSslPort(NON_SSL_PORT_MAP.get(system));
type.setIsNative(true);
if (alreadyExists(type)) {
log.info("Meta data for {} already exist", type.getStorageTypeName());
continue;
}
log.info("Meta data for {} don't exist or have changed, update", type.getStorageTypeName());
dbClient.createObject(type);
}
}
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class ControllerServiceImpl method initDriverManager.
private void initDriverManager(List<StorageSystemType> types) {
StorageDriverManager driverManager = (StorageDriverManager) getBean(StorageDriverManager.STORAGE_DRIVER_MANAGER);
for (StorageSystemType type : types) {
String typeName = type.getStorageTypeName();
String driverName = type.getDriverName();
if (type.getIsSmiProvider()) {
driverManager.getStorageProvidersMap().put(driverName, typeName);
_log.info("Driver info for storage system type {} has been set into storageDriverManager instance", typeName);
continue;
}
driverManager.getStorageSystemsMap().put(driverName, typeName);
if (type.getManagedBy() != null) {
driverManager.getProviderManaged().add(typeName);
} else {
driverManager.getDirectlyManaged().add(typeName);
}
if (StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.FILE.toString())) {
driverManager.getFileSystems().add(typeName);
} else if (StringUtils.equals(type.getMetaType(), StorageSystemType.META_TYPE.BLOCK.toString())) {
driverManager.getBlockSystems().add(typeName);
}
_log.info("Driver info for storage system type {} has been set into storageDriverManager instance", typeName);
}
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverManager method queryDriversByStatus.
private List<StorageSystemType> queryDriversByStatus(StorageSystemType.STATUS status) {
List<StorageSystemType> types = new ArrayList<StorageSystemType>();
List<URI> ids = dbClient.queryByType(StorageSystemType.class, true);
Iterator<StorageSystemType> it = dbClient.queryIterativeObjects(StorageSystemType.class, ids);
while (it.hasNext()) {
StorageSystemType type = it.next();
if (StringUtils.equals(type.getDriverStatus(), status.toString())) {
types.add(type);
}
}
return types;
}
Aggregations