use of com.emc.storageos.model.file.policy.FileProtectionRemoteSettings in project coprhd-controller by CoprHD.
the class VirtualPool method getFileProtectionRemoteSettings.
public static Map<String, FileProtectionRemoteSettings> getFileProtectionRemoteSettings(URI defaultVpool, final DbClient dbClient) {
Map<String, FileProtectionRemoteSettings> settings = new HashMap<String, FileProtectionRemoteSettings>();
VirtualPool vpool = dbClient.queryObject(VirtualPool.class, defaultVpool);
if (vpool != null && vpool.getFileReplicationSupported()) {
// Find is there any replication policy attached to vpool
FilePolicy replPolicy = null;
StringSet policies = vpool.getFilePolicies();
if (policies != null && !policies.isEmpty()) {
for (String strPolicy : policies) {
FilePolicy policy = dbClient.queryObject(FilePolicy.class, URI.create(strPolicy));
if (FilePolicyType.file_replication.name().equalsIgnoreCase(policy.getFilePolicyType())) {
replPolicy = policy;
break;
}
}
}
if (replPolicy != null) {
// Fill the replication type and copy mode!!
FileProtectionRemoteSettings fileReplSettings = new FileProtectionRemoteSettings();
fileReplSettings.setReplicationCopyMode(replPolicy.getFileReplicationCopyMode());
fileReplSettings.setReplicationType(replPolicy.getFileReplicationType());
fileReplSettings.setTargetVirtualPool(defaultVpool.toString());
settings.put(defaultVpool.toString(), fileReplSettings);
}
}
return settings;
}
use of com.emc.storageos.model.file.policy.FileProtectionRemoteSettings in project coprhd-controller by CoprHD.
the class VirtualPoolAttributeMapBuilder method buildMap.
@Override
public Map<String, Object> buildMap() {
if (null != _vpool.getProtocols() && !_vpool.getProtocols().isEmpty()) {
putAttributeInMap(Attributes.protocols.toString(), _vpool.getProtocols());
}
putAttributeInMap(Attributes.auto_tiering_policy_name.toString(), _vpool.getAutoTierPolicyName());
putAttributeInMap(Attributes.compression_enabled.toString(), _vpool.getCompressionEnabled());
putAttributeInMap(Attributes.unique_policy_names.toString(), _vpool.getUniquePolicyNames());
putAttributeInMap(Attributes.drive_type.toString(), _vpool.getDriveType());
if (null != _vpool.getArrayInfo() && !_vpool.getArrayInfo().isEmpty()) {
putAttributeInMap(Attributes.system_type.toString(), _vpool.getArrayInfo().get(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE));
putAttributeInMap(Attributes.raid_levels.toString(), _vpool.getArrayInfo().get(VirtualPoolCapabilityValuesWrapper.RAID_LEVEL));
}
putAttributeInMap(Attributes.high_availability_type.toString(), _vpool.getHighAvailability());
String haNh = null;
String haCos = null;
StringMap haNhCosMap = _vpool.getHaVarrayVpoolMap();
if (haNhCosMap != null && !haNhCosMap.isEmpty()) {
haNh = haNhCosMap.keySet().iterator().next();
haCos = haNhCosMap.get(haNh);
if (haNh.equals(NullColumnValueGetter.getNullURI().toString())) {
haNh = null;
}
if (haCos.equals(NullColumnValueGetter.getNullURI().toString())) {
haCos = null;
}
}
if (null != _vpool.getScheduleSnapshots()) {
putAttributeInMap(Attributes.schedule_snapshots.toString(), _vpool.getScheduleSnapshots());
}
if (null != _vpool.getFileReplicationSupported()) {
putAttributeInMap(Attributes.file_replication_supported.toString(), _vpool.getFileReplicationSupported());
// Update the replication setting to the mapper!!
if (_vpool.getFileReplicationSupported() && fileRemoteProtectionSettings != null && !fileRemoteProtectionSettings.isEmpty()) {
FileProtectionRemoteSettings fileProtectionSettings = fileRemoteProtectionSettings.get(_vpool.getId().toString());
if (fileProtectionSettings != null) {
putAttributeInMap(Attributes.file_replication_type.toString(), fileProtectionSettings.getReplicationType());
putAttributeInMap(Attributes.file_replication_copy_mode.toString(), fileProtectionSettings.getReplicationCopyMode());
if (fileProtectionSettings.getTargetVirtualPool() != null) {
putAttributeInMap(Attributes.file_replication_target_vpool.toString(), URI.create(fileProtectionSettings.getTargetVirtualPool()));
}
}
}
}
putAttributeInMap(Attributes.high_availability_varray.toString(), haNh);
putAttributeInMap(Attributes.high_availability_vpool.toString(), haCos);
putAttributeInMap(Attributes.high_availability_rp.toString(), _vpool.getHaVarrayConnectedToRp());
putAttributeInMap(Attributes.metropoint.toString(), _vpool.getMetroPoint());
putAttributeInMap(Attributes.provisioning_type.toString(), _vpool.getSupportedProvisioningType());
putAttributeInMap(Attributes.vpool_type.toString(), _vpool.getType());
putAttributeInMap(Attributes.max_paths.toString(), _vpool.getNumPaths());
putAttributeInMap(Attributes.paths_per_initiator.toString(), _vpool.getPathsPerInitiator());
putAttributeInMap(Attributes.varrays.toString(), _vpool.getVirtualArrays());
putAttributeInMap(Attributes.max_native_snapshots.toString(), _vpool.getMaxNativeSnapshots());
putAttributeInMap(Attributes.max_native_continuous_copies.toString(), _vpool.getMaxNativeContinuousCopies());
Integer preAllocationInt = _vpool.getThinVolumePreAllocationPercentage();
if (preAllocationInt != null && preAllocationInt > 0) {
putAttributeInMap(Attributes.thin_volume_preallocation_percentage.toString(), preAllocationInt);
}
StringMap rpVaVpMap = new StringMap();
if (null != protectionSettings) {
for (URI vArray : protectionSettings.keySet()) {
VpoolProtectionVarraySettings vaVp = protectionSettings.get(vArray);
if (vaVp != null) {
rpVaVpMap.put(vArray.toString(), vaVp.getVirtualPool() != null ? vaVp.getVirtualPool().toString() : null);
}
}
}
putAttributeInMap(Attributes.recoverpoint_map.toString(), rpVaVpMap);
// Only check pools for consistency group compatibility if RecoverPoint protection is
// not selected. We are creating a RecoverPoint consistency group if RP is selected,
// not an array-based consistency group.
putAttributeInMap(Attributes.multi_volume_consistency.toString(), (rpVaVpMap.size() == 0) ? _vpool.getMultivolumeConsistency() : Boolean.FALSE);
// Remote Mirror Protection
if (null != remoteProtectionSettings && !remoteProtectionSettings.isEmpty()) {
_logger.info("Remote Settings : {}", Joiner.on("\t").join(remoteProtectionSettings.keySet()));
putAttributeInMap(Attributes.remote_copy.toString(), remoteProtectionSettings);
}
putAttributeInMap(Attributes.long_term_retention_policy.toString(), _vpool.getLongTermRetention());
putAttributeInMap(Attributes.min_datacenters.toString(), _vpool.getMinDataCenters());
if (_vpool.getDedupCapable() != null && _vpool.getDedupCapable()) {
putAttributeInMap(Attributes.dedup.toString(), _vpool.getDedupCapable());
}
return _attributeMap;
}
Aggregations