private void validateRecoverPoint(String formName) {
    Validation.required(formName + ".rpJournalSize", rpJournalSize);
    if (!RPCopyForm.isValidJournalSize(rpJournalSize, rpJournalSizeUnit)) {
      Validation.addError(formName + ".rpJournalSize", "validation.invalid");
    }

    Set<String> varrayIds = Sets.newHashSet();
    Set<String> vpoolIds = Sets.newHashSet();

    boolean hasCopies = false;
    for (RPCopyForm rpCopy : rpCopies) {
      if (rpCopy != null && rpCopy.isEnabled()) {
        hasCopies = true;
        rpCopy.validate(formName + ".rpCopies");

        if (StringUtils.isNotBlank(rpCopy.virtualArray)) {
          if (!varrayIds.add(rpCopy.virtualArray)) {
            Validation.addError(formName + ".rpCopies", "rpCopy.virtualArray.error.duplicate");
          }
        }
        if (StringUtils.isNotBlank(rpCopy.virtualPool)) {
          vpoolIds.add(rpCopy.virtualPool);
        }
      }
    }
    if (!hasCopies) {
      Validation.required(formName + ".rpCopies", null);
    }

    // Extra validation when mixed with high availability
    if (HighAvailability.isHighAvailability(highAvailability)) {
      if (!Boolean.TRUE.equals(multiVolumeConsistency)) {
        Validation.addError(
            formName + ".multiVolumeConsistency", "vpool.rp.error.notMultiVolumeConsistent");
      }
    }
  }
  private BlockVirtualPoolUpdateBuilder apply(BlockVirtualPoolUpdateBuilder builder) {
    applyCommon(builder);
    builder.setSnapshots(defaultInt(maxSnapshots));
    builder.setContinuousCopies(maxContinuousCopies, uri(continuousCopyVirtualPool));

    // Only allow updating these fields if not locked
    if (!isLocked()) {
      builder.setMinPaths(defaultInt(minPaths, 1));
      builder.setMaxPaths(defaultInt(maxPaths, 1));
      builder.setPathsPerInitiator(defaultInt(initiatorPaths, 1));
      builder.setAutoTieringPolicyName(autoTierPolicy);
      builder.setDriveType(driveType);
      builder.setExpandable(defaultBoolean(expandable));
      builder.setFastExpansion(defaultBoolean(fastExpansion));
      builder.setThinVolumePreAllocationPercentage(thinPreAllocationPercent);
      builder.setUniquePolicyNames(defaultBoolean(uniqueAutoTierPolicyNames));
      builder.setMultiVolumeConsistency(defaultBoolean(multiVolumeConsistency));
      builder.setRaidLevels(defaultSet(raidLevels));
      builder.setHostIOLimitBandwidth(defaultInt(hostIOLimitBandwidth, 0));
      builder.setHostIOLimitIOPs(defaultInt(hostIOLimitIOPs, 0));

      if (ProtectionSystemTypes.isRecoverPoint(remoteProtection)) {
        builder.setRecoverPointJournalSize(
            RPCopyForm.formatJournalSize(rpJournalSize, rpJournalSizeUnit));
        builder.setRecoverPointRemoteCopyMode(rpRemoteCopyMode);
        builder.setRecoverPointRpo(rpRpoValue, rpRpoType);
        Set<VirtualPoolProtectionVirtualArraySettingsParam> copies = Sets.newLinkedHashSet();
        for (RPCopyForm rpCopy : rpCopies) {
          if (rpCopy != null && rpCopy.isEnabled()) {
            copies.add(rpCopy.write());
          }
        }
        builder.setRecoverPointCopies(copies);
        builder.setJournalVarrayAndVpool(uri(sourceJournalVArray), uri(sourceJournalVPool));
      } else {
        builder.disableRecoverPoint();
      }

      if (ProtectionSystemTypes.isSRDF(remoteProtection)) {
        Set<VirtualPoolRemoteProtectionVirtualArraySettingsParam> copies = Sets.newHashSet();
        for (SrdfCopyForm srdfCopyForm : srdfCopies) {
          if (srdfCopyForm != null && srdfCopyForm.isEnabled()) {
            copies.add(srdfCopyForm.write(srdfCopyMode));
          }
        }
        builder.setRemoteCopies(copies);
      } else {
        builder.disableRemoteCopies();
      }

      if (HighAvailability.isHighAvailability(highAvailability)) {
        boolean activeProtectionAtHASite = BooleanUtils.isTrue(protectHASite);
        boolean metroPoint = false;
        if (BooleanUtils.isTrue(protectSourceSite) && BooleanUtils.isTrue(protectHASite)) {
          metroPoint = true;
          activeProtectionAtHASite =
              StringUtils.equalsIgnoreCase(activeSite, HighAvailability.VPLEX_HA);
          builder.setJournalVarrayAndVpool(uri(sourceJournalVArray), uri(sourceJournalVPool));
          builder.setStandByJournalVArrayVpool(uri(haJournalVArray), uri(haJournalVPool));
        } else {
          if (activeProtectionAtHASite) {
            builder.setJournalVarrayAndVpool(uri(haJournalVArray), uri(haJournalVPool));
          } else {
            builder.setJournalVarrayAndVpool(uri(sourceJournalVArray), uri(sourceJournalVPool));
          }
        }
        builder.setHighAvailability(
            highAvailability,
            enableAutoCrossConnExport,
            uri(haVirtualArray),
            uri(haVirtualPool),
            activeProtectionAtHASite,
            metroPoint);
      } else {
        builder.disableHighAvailability();
      }
    }

    return builder;
  }