use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverService method filterTypesByDriver.
private List<StorageSystemType> filterTypesByDriver(String driverName) {
List<StorageSystemType> types = listStorageSystemTypes();
List<StorageSystemType> toUninstallTypes = new ArrayList<StorageSystemType>();
for (StorageSystemType type : types) {
if (!StringUtils.equals(driverName, type.getDriverName())) {
continue;
}
toUninstallTypes.add(type);
}
return toUninstallTypes;
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverService method getStorageDriverOperationLock.
protected InterProcessLock getStorageDriverOperationLock() {
// Try to acquire lock, succeed or throw Exception
InterProcessLock lock = coordinator.getSiteLocalLock(STORAGE_DRIVER_OPERATION_lOCK);
boolean acquired;
try {
acquired = lock.acquire(LOCK_WAIT_TIME_SEC, TimeUnit.SECONDS);
} catch (Exception e) {
try {
lock.release();
} catch (Exception ex) {
log.error("Fail to release storage driver operation lock", ex);
}
throw APIException.internalServerErrors.installDriverPrecheckFailed("Acquiring lock failed, there's another trigger operation holding lock");
}
if (!acquired) {
throw APIException.internalServerErrors.installDriverPrecheckFailed("Acquiring lock failed, there's another trigger operation holding lock");
}
// Check if there's ongoing storage operation, if there is, release lock
// and throw exception
StorageSystemType opOngoingStorageType = null;
List<StorageSystemType> types = listStorageSystemTypes();
for (StorageSystemType type : types) {
String statusStr = type.getDriverStatus();
if (statusStr == null) {
log.info("Bypass type {} as it has no status field value", type.getStorageTypeName());
continue;
}
StorageSystemType.STATUS status = Enum.valueOf(StorageSystemType.STATUS.class, type.getDriverStatus());
if (status.isStorageOperationOngoing()) {
opOngoingStorageType = type;
break;
}
}
if (opOngoingStorageType != null) {
try {
lock.release();
} catch (Exception e) {
log.error("Fail to release storage driver operation lock", e);
}
throw APIException.internalServerErrors.installDriverPrecheckFailed(String.format("Driver %s is in % state", opOngoingStorageType.getDriverName(), opOngoingStorageType.getDriverStatus()));
}
return lock;
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverService method queryStorageDriver.
/**
* @return driver specified by the name; return all drivers if name is null
*/
private List<StorageDriverRestRep> queryStorageDriver(String name) {
Set<String> usedProviderTypes = getUsedStorageProviderTypes();
Set<String> usedSystemTypes = getUsedStorageSystemTypes();
Map<String, StorageDriverRestRep> driverMap = new HashMap<String, StorageDriverRestRep>();
List<URI> ids = dbClient.queryByType(StorageSystemType.class, true);
Iterator<StorageSystemType> it = dbClient.queryIterativeObjects(StorageSystemType.class, ids);
while (it.hasNext()) {
StorageSystemType type = it.next();
String driverName = type.getDriverName();
if (name != null && !name.equals(driverName)) {
continue;
}
if (type.getIsNative() == null || type.getIsNative()) {
// bypass native storage types
continue;
}
setTypeDriverStatus(type, usedProviderTypes, usedSystemTypes);
setDriverIntoMap(driverName, type, driverMap);
}
List<StorageDriverRestRep> drivers = new ArrayList<StorageDriverRestRep>();
drivers.addAll(driverMap.values());
return drivers;
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverService method getAllDriverNames.
private Set<String> getAllDriverNames() {
List<StorageSystemType> types = listStorageSystemTypes();
Set<String> drivers = new HashSet<String>();
for (StorageSystemType type : types) {
drivers.add(type.getDriverName());
}
return drivers;
}
use of com.emc.storageos.db.client.model.StorageSystemType in project coprhd-controller by CoprHD.
the class StorageDriverMapper method map.
/**
* @return supported StorageSystemTypes by this driver. The first is the
* storage system, and the second is storage provider if there is
*/
public static List<StorageSystemType> map(StorageDriverMetaData driver) {
List<StorageSystemType> types = new ArrayList<StorageSystemType>();
StorageSystemType type = new StorageSystemType();
type.setStorageTypeName(driver.getStorageName());
type.setStorageTypeDispName(driver.getStorageDisplayName());
type.setDriverName(driver.getDriverName());
type.setDriverVersion(driver.getDriverVersion());
type.setDriverFileName(driver.getDriverFileName());
type.setMetaType(driver.getMetaType());
URI uri = URIUtil.createId(StorageSystemType.class);
type.setId(uri);
type.setStorageTypeId(uri.toString());
type.setIsDefaultSsl(driver.isEnableSsl());
type.setSslPort(Long.toString(driver.getSslPort()));
type.setNonSslPort(Long.toString(driver.getNonSslPort()));
type.setSupportAutoTierPolicy(driver.isSupportAutoTierPolicy());
type.setDriverClassName(driver.getDriverClassName());
types.add(type);
if (StringUtils.isNotEmpty(driver.getProviderName()) && StringUtils.isNotEmpty(driver.getProviderDisplayName())) {
StorageSystemType provider = new StorageSystemType();
provider.setStorageTypeName(driver.getProviderName());
provider.setStorageTypeDispName(driver.getProviderDisplayName());
provider.setIsSmiProvider(true);
provider.setDriverName(driver.getDriverName());
provider.setDriverVersion(driver.getDriverVersion());
provider.setDriverFileName(driver.getDriverFileName());
provider.setMetaType(driver.getMetaType());
uri = URIUtil.createId(StorageSystemType.class);
provider.setId(uri);
provider.setStorageTypeId(uri.toString());
provider.setIsDefaultSsl(driver.isEnableSsl());
provider.setSslPort(Long.toString(driver.getSslPort()));
provider.setNonSslPort(Long.toString(driver.getNonSslPort()));
provider.setSupportAutoTierPolicy(driver.isSupportAutoTierPolicy());
provider.setDriverClassName(driver.getDriverClassName());
type.setManagedBy(provider.getStorageTypeId());
types.add(provider);
}
return types;
}
Aggregations