use of com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam.VirtualArrayVirtualPoolMapEntry in project coprhd-controller by CoprHD.
the class BlockVirtualPoolBuilder method setHighAvailability.
public BlockVirtualPoolBuilder setHighAvailability(String type, Boolean enableCrossConnect, URI virtualArrayId, URI virtualPoolId, Boolean activeProtectionAtHASite, Boolean metroPoint) {
VirtualPoolHighAvailabilityParam highAvailability = new VirtualPoolHighAvailabilityParam();
if (HighAvailability.isHighAvailability(type)) {
highAvailability.setType(type);
highAvailability.setAutoCrossConnectExport(enableCrossConnect);
if (HighAvailability.isVplexDistributed(type)) {
VirtualArrayVirtualPoolMapEntry value = new VirtualArrayVirtualPoolMapEntry();
value.setVirtualArray(virtualArrayId);
value.setVirtualPool(virtualPoolId);
value.setActiveProtectionAtHASite(activeProtectionAtHASite);
highAvailability.setHaVirtualArrayVirtualPool(value);
highAvailability.setMetroPoint(metroPoint);
}
}
virtualPool.setHighAvailability(highAvailability);
return this;
}
use of com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam.VirtualArrayVirtualPoolMapEntry in project coprhd-controller by CoprHD.
the class BlockVirtualPoolUpdateBuilder method setHighAvailability.
public BlockVirtualPoolUpdateBuilder setHighAvailability(String type, Boolean enableCrossConnect, URI virtualArrayId, URI virtualPoolId, Boolean activeProtectionAtHASite, Boolean metroPoint) {
VirtualPoolHighAvailabilityParam highAvailability = new VirtualPoolHighAvailabilityParam();
if (HighAvailability.isVplexDistributed(type) || HighAvailability.isVplexLocal(type)) {
highAvailability.setType(type);
highAvailability.setAutoCrossConnectExport(enableCrossConnect);
if (HighAvailability.isVplexDistributed(type)) {
VirtualArrayVirtualPoolMapEntry value = new VirtualArrayVirtualPoolMapEntry();
value.setVirtualArray(virtualArrayId);
value.setVirtualPool(defaultURI(virtualPoolId));
value.setActiveProtectionAtHASite(activeProtectionAtHASite);
highAvailability.setHaVirtualArrayVirtualPool(value);
highAvailability.setMetroPoint(metroPoint);
}
}
virtualPool.setHighAvailability(highAvailability);
return this;
}
use of com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam.VirtualArrayVirtualPoolMapEntry in project coprhd-controller by CoprHD.
the class BlockVirtualPoolService method prepareVirtualPool.
// This method must not persist anything to the DB
private VirtualPool prepareVirtualPool(BlockVirtualPoolParam param, Map<URI, VpoolRemoteCopyProtectionSettings> remoteSettingsMap, Map<URI, VpoolProtectionVarraySettings> protectionSettingsMap, List<VpoolProtectionVarraySettings> protectionSettingsList) {
if (remoteSettingsMap == null) {
remoteSettingsMap = new HashMap<URI, VpoolRemoteCopyProtectionSettings>();
}
if (protectionSettingsMap == null) {
protectionSettingsMap = new HashMap<URI, VpoolProtectionVarraySettings>();
}
if (protectionSettingsList == null) {
protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
}
VirtualPool vpool = new VirtualPool();
vpool.setType(VirtualPool.Type.block.name());
// set common VirtualPool parameters.
populateCommonVirtualPoolCreateParams(vpool, param);
// By default, mirrors and snaps are disabled
vpool.setMaxNativeContinuousCopies(VirtualPool.MAX_DISABLED);
vpool.setMaxNativeSnapshots(VirtualPool.MAX_DISABLED);
if (param.getThinVolumePreAllocationPercentage() != null) {
vpool.setThinVolumePreAllocationPercentage(param.getThinVolumePreAllocationPercentage());
}
if (param.getMultiVolumeConsistency() != null) {
vpool.setMultivolumeConsistency(param.getMultiVolumeConsistency());
}
StringSetMap arrayInfo = new StringSetMap();
if (null != param.getRaidLevels()) {
for (String raidLevel : param.getRaidLevels()) {
arrayInfo.put(VirtualPoolCapabilityValuesWrapper.RAID_LEVEL, raidLevel);
}
}
if (null != param.getSystemType()) {
arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, param.getSystemType());
}
if (arrayInfo.isEmpty()) {
arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, NONE);
}
vpool.addArrayInfoDetails(arrayInfo);
if (param.getProtection() != null) {
if (param.getProtection().getContinuousCopies() != null) {
URI ccVpoolURI = param.getProtection().getContinuousCopies().getVpool();
if (!NullColumnValueGetter.isNullURI(ccVpoolURI)) {
URI vpoolUri = param.getProtection().getContinuousCopies().getVpool();
ArgValidator.checkUri(vpoolUri);
VirtualPool protectionMirrorVpool = _permissionsHelper.getObjectById(vpoolUri, VirtualPool.class);
ArgValidator.checkEntity(protectionMirrorVpool, vpoolUri, false);
if (param.getHighAvailability() != null) {
validateMirrorVpool(param.getHighAvailability().getType(), protectionMirrorVpool);
} else {
validateMirrorVpool(null, protectionMirrorVpool);
}
vpool.setMirrorVirtualPool(vpoolUri.toString());
}
}
if ((param.getProtection().getSnapshots() != null) && (param.getProtection().getSnapshots().getMaxSnapshots() != null)) {
vpool.setMaxNativeSnapshots(param.getProtection().getSnapshots().getMaxSnapshots());
}
if ((param.getProtection().getContinuousCopies() != null) && (param.getProtection().getContinuousCopies().getMaxMirrors() != null)) {
if (param.getHighAvailability() != null) {
validateMaxNativeContinuousCopies(param.getProtection().getContinuousCopies().getMaxMirrors(), param.getHighAvailability().getType());
if (param.getProtection().getContinuousCopies().getVpool() == null && VirtualPool.HighAvailabilityType.vplex_distributed.name().equals(param.getHighAvailability().getType()) && (param.getProtection().getContinuousCopies().getMaxMirrors() > 0)) {
throw APIException.badRequests.invalidMirrorVpoolForVplexDistributedVpool();
}
}
vpool.setMaxNativeContinuousCopies(param.getProtection().getContinuousCopies().getMaxMirrors());
}
// employ...
if ((param.getProtection().getRecoverPoint() != null) && (param.getProtection().getRecoverPoint().getCopies() != null)) {
ProtectionSourcePolicy sourcePolicy = param.getProtection().getRecoverPoint().getSourcePolicy();
if (sourcePolicy != null) {
vpool.setJournalSize(sourcePolicy.getJournalSize());
vpool.setRpRpoValue(sourcePolicy.getRpoValue());
vpool.setRpRpoType(sourcePolicy.getRpoType());
vpool.setRpCopyMode(sourcePolicy.getRemoteCopyMode());
if (!NullColumnValueGetter.isNullURI(sourcePolicy.getJournalVarray())) {
vpool.setJournalVarray(sourcePolicy.getJournalVarray().toString());
if (!NullColumnValueGetter.isNullURI(sourcePolicy.getJournalVpool())) {
vpool.setJournalVpool(sourcePolicy.getJournalVpool().toString());
} else {
String journalVpoolId = NullColumnValueGetter.getNullStr();
if (param.getHighAvailability() == null || Boolean.TRUE.equals(param.getHighAvailability().getMetroPoint())) {
// In cases of MetroPoint or when high availability is not specified, default the journal virtual pool
// to the parent virtual pool
journalVpoolId = vpool.getId().toString();
} else if (Boolean.FALSE.equals(param.getHighAvailability().getMetroPoint()) && param.getHighAvailability().getHaVirtualArrayVirtualPool() != null && Boolean.TRUE.equals(param.getHighAvailability().getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite())) {
// HA virtual pool.
if (param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool() != null) {
journalVpoolId = param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool().toString();
}
} else {
// In cases of MetroPoint or when high availability is not specified, default the journal virtual pool
// to the parent virtual pool
journalVpoolId = vpool.getId().toString();
}
vpool.setJournalVpool(journalVpoolId);
}
}
if (param.getHighAvailability() != null && param.getHighAvailability().getMetroPoint() != null && param.getHighAvailability().getMetroPoint()) {
if (!NullColumnValueGetter.isNullURI(sourcePolicy.getStandbyJournalVarray())) {
vpool.setStandbyJournalVarray(sourcePolicy.getStandbyJournalVarray().toString());
if (!NullColumnValueGetter.isNullURI(sourcePolicy.getStandbyJournalVpool())) {
vpool.setStandbyJournalVpool(sourcePolicy.getStandbyJournalVpool().toString());
}
}
}
}
StringMap settingsMap = new StringMap();
for (VirtualPoolProtectionVirtualArraySettingsParam settingsParam : param.getProtection().getRecoverPoint().getCopies()) {
VpoolProtectionVarraySettings setting = new VpoolProtectionVarraySettings();
setting.setId(URIUtil.createId(VpoolProtectionVarraySettings.class));
setting.setParent(new NamedURI(vpool.getId(), vpool.getLabel()));
if (settingsParam.getVpool() != null && !String.valueOf(settingsParam.getVpool()).isEmpty()) {
setting.setVirtualPool(settingsParam.getVpool());
}
if (settingsParam.getCopyPolicy() != null) {
setting.setJournalSize(settingsParam.getCopyPolicy().getJournalSize() != null ? settingsParam.getCopyPolicy().getJournalSize() : null);
setting.setJournalVarray(settingsParam.getCopyPolicy().getJournalVarray() != null ? settingsParam.getCopyPolicy().getJournalVarray() : settingsParam.getVarray());
setting.setJournalVpool(settingsParam.getCopyPolicy().getJournalVpool() != null ? settingsParam.getCopyPolicy().getJournalVpool() : settingsParam.getVpool());
}
if (settingsParam.getVarray() != null) {
settingsMap.put(settingsParam.getVarray().toString(), setting.getId().toString());
protectionSettingsMap.put(settingsParam.getVarray(), setting);
}
protectionSettingsList.add(setting);
}
vpool.setProtectionVarraySettings(settingsMap);
}
// SRDF remote protection Settings
if (null != param.getProtection().getRemoteCopies() && null != param.getProtection().getRemoteCopies().getRemoteCopySettings()) {
StringMap remoteCopysettingsMap = new StringMap();
for (VirtualPoolRemoteProtectionVirtualArraySettingsParam remoteSettings : param.getProtection().getRemoteCopies().getRemoteCopySettings()) {
VirtualArray remoteVArray = _dbClient.queryObject(VirtualArray.class, remoteSettings.getVarray());
if (null == remoteVArray || remoteVArray.getInactive()) {
throw APIException.badRequests.inactiveRemoteVArrayDetected(remoteSettings.getVarray());
}
VpoolRemoteCopyProtectionSettings remoteCopySettingsParam = new VpoolRemoteCopyProtectionSettings();
remoteCopySettingsParam.setId(URIUtil.createId(VpoolRemoteCopyProtectionSettings.class));
remoteCopySettingsParam.setVirtualArray(remoteSettings.getVarray());
if (remoteCopysettingsMap.containsKey(remoteSettings.getVarray().toString())) {
throw APIException.badRequests.duplicateRemoteSettingsDetected(remoteSettings.getVarray());
}
remoteCopysettingsMap.put(remoteSettings.getVarray().toString(), remoteCopySettingsParam.getId().toString());
// The remote virtual pool is an optional field. If it is not set, this value will be null and the source
// virtual pool will be used to provision the target storage for that remote copy.
remoteCopySettingsParam.setVirtualPool(remoteSettings.getVpool());
if (null != remoteSettings.getRemoteCopyMode()) {
if (!CopyModes.lookup(remoteSettings.getRemoteCopyMode())) {
throw APIException.badRequests.invalidCopyMode(remoteSettings.getRemoteCopyMode());
}
remoteCopySettingsParam.setCopyMode(remoteSettings.getRemoteCopyMode());
}
remoteSettingsMap.put(remoteSettings.getVarray(), remoteCopySettingsParam);
}
vpool.setProtectionRemoteCopySettings(remoteCopysettingsMap);
}
}
// Validate and set high availability.
if (param.getHighAvailability() != null) {
_log.debug("Vpool specifies high availability {}", param.getHighAvailability());
// High availability type must be specified and valid.
vpool.setHighAvailability(param.getHighAvailability().getType());
if (!VirtualPool.vPoolSpecifiesHighAvailability(vpool)) {
throw APIException.badRequests.requiredParameterMissingOrEmpty("highAvailability.type");
}
// Set the MetroPoint value.
vpool.setMetroPoint(param.getHighAvailability().getMetroPoint());
// Default if no parameter is supplied is enabled
if (param.getHighAvailability().getAutoCrossConnectExport() != null) {
vpool.setAutoCrossConnectExport(param.getHighAvailability().getAutoCrossConnectExport());
}
// user may also specify the high availability VirtualPool.
if (VirtualPool.HighAvailabilityType.vplex_distributed.name().equals(param.getHighAvailability().getType())) {
if (param.getHighAvailability().getHaVirtualArrayVirtualPool() == null || param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray() == null) {
throw APIException.badRequests.invalidParameterVirtualPoolHighAvailabilityMismatch(param.getHighAvailability().getType());
}
// High availability varray must be specified and valid.
_log.debug("HA varray VirtualPool map specifies the HA varray {}", param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray());
VirtualArray haVarray = _dbClient.queryObject(VirtualArray.class, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray());
ArgValidator.checkEntity(haVarray, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray(), false);
String haVarrayId = param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray().toString();
// Check the HA varray VirtualPool, which is not required.
String haVarrayVpoolId = null;
if ((param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool() != null) && (!param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool().toString().isEmpty())) {
_log.debug("HA varray VirtualPool map specifies the HA vpool {}", param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool());
VirtualPool haVpool = _dbClient.queryObject(VirtualPool.class, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool());
ArgValidator.checkEntity(haVpool, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool(), false);
haVarrayVpoolId = param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool().toString();
// Further validate that this VirtualPool is valid for the
// specified high availability varray.
StringSet haVpoolVarrays = haVpool.getVirtualArrays();
if ((haVpoolVarrays != null) && (!haVpoolVarrays.isEmpty()) && !haVpoolVarrays.contains(haVarrayId)) {
throw APIException.badRequests.invalidParameterVirtualPoolNotValidForArray(haVarrayVpoolId, haVarrayId);
}
} else {
_log.debug("HA varray VirtualPool map does not specify HA vpool");
haVarrayVpoolId = NullColumnValueGetter.getNullURI().toString();
}
// should be used as the RP source array for volume create.
if (param.getHighAvailability().getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite() != null && param.getHighAvailability().getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite()) {
vpool.setHaVarrayConnectedToRp(haVarrayId);
}
StringMap haVarrayVirtualPoolMap = new StringMap();
haVarrayVirtualPoolMap.put(haVarrayId, haVarrayVpoolId);
vpool.setHaVarrayVpoolMap(haVarrayVirtualPoolMap);
} else {
final VirtualArrayVirtualPoolMapEntry haVirtualArrayVirtualPool = param.getHighAvailability().getHaVirtualArrayVirtualPool();
if ((haVirtualArrayVirtualPool != null) && ((haVirtualArrayVirtualPool.getVirtualArray() != null) || (haVirtualArrayVirtualPool.getVirtualPool() != null))) {
throw APIException.badRequests.invalidParameterVirtualPoolAndVirtualArrayNotApplicableForHighAvailabilityType(param.getHighAvailability().getType());
}
}
}
// Set expandable
if (param.getExpandable() != null) {
vpool.setExpandable(param.getExpandable());
}
if (param.getFastExpansion() != null) {
vpool.setFastExpansion(param.getFastExpansion());
}
if (null != param.getAutoTieringPolicyName() && !param.getAutoTieringPolicyName().isEmpty()) {
vpool.setAutoTierPolicyName(param.getAutoTieringPolicyName());
}
if (param.getCompressionEnabled() != null) {
vpool.setCompressionEnabled(param.getCompressionEnabled());
}
if (null != param.getDriveType()) {
vpool.setDriveType(param.getDriveType());
} else {
vpool.setDriveType(NONE);
}
// Set the min/max paths an paths per initiator
validateAndSetPathParams(vpool, param.getMaxPaths(), param.getMinPaths(), param.getPathsPerInitiator());
if (null != param.getUniquePolicyNames()) {
vpool.setUniquePolicyNames(param.getUniquePolicyNames());
}
// set limit for host bandwidth
if (param.getHostIOLimitBandwidth() != null) {
vpool.setHostIOLimitBandwidth(param.getHostIOLimitBandwidth());
}
// set limit for host i/o
if (param.getHostIOLimitIOPs() != null) {
vpool.setHostIOLimitIOPs(param.getHostIOLimitIOPs());
}
// set placement policy
if (param.getPlacementPolicy() != null) {
vpool.setPlacementPolicy(param.getPlacementPolicy());
}
// set dedup capable or not
if (null != param.getDedupCapable()) {
vpool.setDedupCapable(param.getDedupCapable());
}
return vpool;
}
Aggregations