use of com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method scanProvider.
private boolean scanProvider(StorageProvider provider, StorageSystem storageSystem, boolean activeProvider, String opId) throws DatabaseException, BaseCollectionException, ControllerException {
Map<String, StorageSystemViewObject> storageCache = new HashMap<String, StorageSystemViewObject>();
_dbClient.createTaskOpStatus(StorageProvider.class, provider.getId(), opId, ResourceOperationTypeEnum.SCAN_SMISPROVIDER);
ScanTaskCompleter scanCompleter = new ScanTaskCompleter(StorageProvider.class, provider.getId(), opId);
try {
scanCompleter.statusPending(_dbClient, "Scan for storage system is Initiated");
provider.setLastScanStatusMessage("");
_dbClient.updateObject(provider);
ControllerServiceImpl.performScan(provider.getId(), scanCompleter, storageCache);
scanCompleter.statusReady(_dbClient, "Scan for storage system has completed");
} catch (Exception ex) {
_log.error("Scan failed for {}--->", provider, ex);
scanCompleter.statusError(_dbClient, DeviceControllerErrors.dataCollectionErrors.scanFailed(ex.getLocalizedMessage(), ex));
throw DeviceControllerException.exceptions.scanProviderFailed(storageSystem.getNativeGuid(), provider.getId().toString());
}
if (!storageCache.containsKey(storageSystem.getNativeGuid())) {
return false;
} else {
StorageSystemViewObject vo = storageCache.get(storageSystem.getNativeGuid());
String model = vo.getProperty(StorageSystemViewObject.MODEL);
if (StringUtils.isNotBlank(model)) {
storageSystem.setModel(model);
}
String serialNo = vo.getProperty(StorageSystemViewObject.SERIAL_NUMBER);
if (StringUtils.isNotBlank(serialNo)) {
storageSystem.setSerialNumber(serialNo);
}
String version = vo.getProperty(StorageSystemViewObject.VERSION);
if (StringUtils.isNotBlank(version)) {
storageSystem.setMajorVersion(version);
}
String name = vo.getProperty(StorageSystemViewObject.STORAGE_NAME);
if (StringUtils.isNotBlank(name)) {
storageSystem.setLabel(name);
}
provider.addStorageSystem(_dbClient, storageSystem, activeProvider);
return true;
}
}
use of com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.ScanTaskCompleter in project coprhd-controller by CoprHD.
the class BlockControllerImpl method scanStorageProviders.
/**
* {@inheritDoc}
*/
@Override
public void scanStorageProviders(AsyncTask[] tasks) throws ControllerException {
try {
Map<String, DataCollectionScanJob> scanJobByInterfaceType = new HashMap<String, DataCollectionScanJob>();
for (AsyncTask task : tasks) {
ScanTaskCompleter completer = new ScanTaskCompleter(task);
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, completer.getId());
if (provider != null && !provider.getInactive()) {
if (scanJobByInterfaceType.get(provider.getInterfaceType()) == null) {
scanJobByInterfaceType.put(provider.getInterfaceType(), new DataCollectionScanJob());
}
scanJobByInterfaceType.get(provider.getInterfaceType()).addCompleter(completer);
}
}
for (DataCollectionScanJob job : scanJobByInterfaceType.values()) {
_util.scheduleScanningJobs(job);
}
} catch (Exception e) {
throw ClientControllerException.fatals.unableToScanSMISProviders(tasks, "BlockController", e);
}
}
Aggregations