use of com.emc.storageos.datadomain.restapi.model.DDSystem in project coprhd-controller by CoprHD.
the class DataDomainCommunicationInterface method validDdosVersion.
private boolean validDdosVersion(StorageSystem storageSystem, DataDomainClient ddClient) {
String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(Type.valueOf(DATADOMAIN));
DDSystem ddSystem = ddClient.getDDSystem(storageSystem.getNativeGuid());
_log.info("Verifying DDOS version: minimum supported {}, discovered {}", minimumSupportedVersion, ddSystem.version);
if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, ddSystem.version) < 0) {
return false;
}
return true;
}
use of com.emc.storageos.datadomain.restapi.model.DDSystem in project coprhd-controller by CoprHD.
the class DataDomainCommunicationInterface method scan.
@Override
public void scan(AccessProfile accessProfile) throws DataDomainApiException {
DataDomainClient ddClient = getDataDomainClient(accessProfile);
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, accessProfile.getSystemId());
DDMCInfoDetail ddmcInfo = new DDMCInfoDetail();
try {
ddmcInfo = ddClient.getManagementSystemInfo();
} catch (DataDomainApiException dex) {
provider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.toString());
String op = "DDMC info retrieval";
String sys = provider.getLabel() + "(" + provider.getIPAddress() + ")";
throw DataDomainApiException.exceptions.opFailedProviderUnreachable(op, sys);
}
if (!validDdmcVersion(accessProfile, provider, ddmcInfo)) {
String version = null;
String minimumSupportedVersion = null;
Map<String, String> props = accessProfile.getProps();
if (props != null) {
version = props.get(CURRENT_VERSION);
minimumSupportedVersion = props.get(MINIMUM_VERSION);
}
throw DataDomainApiException.exceptions.scanFailedIncompatibleDdmc(version, minimumSupportedVersion);
}
Map<String, StorageSystemViewObject> cache = accessProfile.getCache();
DDSystemList systemList = ddClient.getManagedSystemList();
for (DDSystemInfo system : systemList.getSystemInfo()) {
DDSystem ddSystem = ddClient.getDDSystem(system.getId());
StorageSystemViewObject view = new StorageSystemViewObject();
view.addprovider(accessProfile.getSystemId().toString());
view.setDeviceType(accessProfile.getSystemType());
view.setProperty(StorageSystemViewObject.SERIAL_NUMBER, ddSystem.serialNo);
view.setProperty(StorageSystemViewObject.MODEL, ddSystem.model);
view.setProperty(StorageSystemViewObject.STORAGE_NAME, ddSystem.name);
view.setProperty(StorageSystemViewObject.VERSION, ddSystem.version);
cache.put(system.getId(), view);
}
}
use of com.emc.storageos.datadomain.restapi.model.DDSystem in project coprhd-controller by CoprHD.
the class DataDomainCommunicationInterface method discoverPool.
private void discoverPool(DataDomainClient ddClient, StorageSystem storageSystem) {
boolean newPool = false;
boolean match = false;
StoragePool storagePool = getPoolFromDB(storageSystem);
if (storagePool == null) {
// New storage pool
storagePool = new StoragePool();
storagePool.setId(URIUtil.createId(StoragePool.class));
String nativeGid = NativeGUIDGenerator.generateNativeGuid(storageSystem, storageSystem.getNativeGuid(), NativeGUIDGenerator.POOL);
storagePool.setNativeGuid(nativeGid);
storagePool.setLabel(storageSystem.getLabel());
storagePool.setPoolName(storageSystem.getLabel());
storagePool.setPoolClassName(POOL_TYPE);
storagePool.setPoolServiceType(StoragePool.PoolServiceType.file.toString());
storagePool.setStorageDevice(storageSystem.getId());
StringSet protocols = new StringSet();
protocols.add(StorageProtocol.File.NFS.name());
protocols.add(StorageProtocol.File.CIFS.name());
storagePool.setProtocols(protocols);
storagePool.setLongTermRetention(true);
storagePool.setSupportedResourceTypes(StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
storagePool.setRegistrationStatus(DiscoveredDataObject.RegistrationStatus.REGISTERED.toString());
newPool = true;
_log.info("Creating new storage pool for system : {} ", storageSystem.getNativeGuid());
}
storagePool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY.toString());
storagePool.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
DDSystem ddSystem = ddClient.getDDSystem(storageSystem.getNativeGuid());
storagePool.setNativeId(ddSystem.id);
storagePool.setTotalCapacity(ddSystem.logicalCapacity.getTotal() >> DataDomainApiConstants.B_TO_KB_SHIFT);
storagePool.setFreeCapacity(ddSystem.logicalCapacity.getAvailable() >> DataDomainApiConstants.B_TO_KB_SHIFT);
storagePool.setSubscribedCapacity(ddSystem.logicalCapacity.getUsed() >> DataDomainApiConstants.B_TO_KB_SHIFT);
StringMap capacityProp = storagePool.getCustomProperties();
capacityProp.put(DataDomainApiConstants.TOTAL_PHYSICAL_CAPACITY, Long.valueOf(ddSystem.physicalCapacity.getTotal() >> DataDomainApiConstants.B_TO_KB_SHIFT).toString());
capacityProp.put(DataDomainApiConstants.AVAILABLE_PHYSICAL_CAPACITY, Long.valueOf(ddSystem.physicalCapacity.getAvailable() >> DataDomainApiConstants.B_TO_KB_SHIFT).toString());
capacityProp.put(DataDomainApiConstants.USED_PHYSICAL_CAPACITY, Long.valueOf(ddSystem.physicalCapacity.getUsed() >> DataDomainApiConstants.B_TO_KB_SHIFT).toString());
capacityProp.put(DataDomainApiConstants.SYSTEM_QUOTA, Long.valueOf(ddSystem.subscribedCapacity >> DataDomainApiConstants.B_TO_KB_SHIFT).toString());
capacityProp.put(DataDomainApiConstants.COMPRESSION_FACTOR, Double.valueOf(ddSystem.compressionFactor).toString());
DDMTreeList list = ddClient.getMTreeList(storageSystem.getNativeGuid());
capacityProp.put(DataDomainApiConstants.NUMBER_MTREES, Long.valueOf(list.mtree.size()).toString());
// Temporarily fix until DD fixes logical capacity computation
if (ddSystem.compressionFactor < 0.5) {
capacityProp.put(DataDomainApiConstants.COMPRESSION_FACTOR, "1.0");
storagePool.setTotalCapacity(Long.valueOf(capacityProp.get(DataDomainApiConstants.TOTAL_PHYSICAL_CAPACITY)));
storagePool.setFreeCapacity(Long.valueOf(capacityProp.get(DataDomainApiConstants.AVAILABLE_PHYSICAL_CAPACITY)));
storagePool.setSubscribedCapacity(Long.valueOf(capacityProp.get(DataDomainApiConstants.USED_PHYSICAL_CAPACITY)));
}
if ((DiscoveredDataObject.DataCollectionJobStatus.ERROR.name().equals(storageSystem.getDiscoveryStatus())) || (DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name().equals(storageSystem.getCompatibilityStatus()))) {
storagePool.setDiscoveryStatus(DiscoveryStatus.NOTVISIBLE.name());
storagePool.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
} else {
storagePool.setDiscoveryStatus(DiscoveryStatus.VISIBLE.name());
storagePool.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
}
if (ImplicitPoolMatcher.checkPoolPropertiesChanged(storagePool.getCompatibilityStatus(), DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name())) {
match = true;
}
if (newPool) {
_dbClient.createObject(storagePool);
} else {
_dbClient.persistObject(storagePool);
}
if (match) {
StringBuffer errorMessage = new StringBuffer();
ImplicitPoolMatcher.matchModifiedStoragePoolsWithAllVpool(Arrays.asList(storagePool), _dbClient, _coordinator, storageSystem.getId(), errorMessage);
}
_log.info("discoverPools for storage system {} - complete", storageSystem.getId());
}
Aggregations