Source:
<code>protected boolean validate() { if (!super.validate()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (getGlusterVolume().getVolumeType().isReplicatedType()) { if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount() + 1) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT_MORE_THAN_ONE); } else if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT); } } if (getGlusterVolume().getVolumeType().isStripedType()) { if (getParameters().getStripeCount() > getGlusterVolume().getStripeCount() + 1) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_STRIPE_COUNT_MORE_THAN_ONE); } else if (getParameters().getStripeCount() < getGlusterVolume().getStripeCount()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_STRIPE_COUNT); } } if (getGlusterVolume().getVolumeType().isDispersedType()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_ADD_BRICK_TO_DISPERSE_VOLUME_NOT_SUPPORTED); return false; } boolean ret = updateBrickServerAndInterfaceNames(getParameters().getBricks(), true) && validateDuplicateBricks(getParameters().getBricks()); if (getCluster().supportsGlusterService() && getCluster().supportsVirtService()) { ret = ret && <START> validateNotSameServer(getParameters().getBricks(), getParameters().getReplicaCount()); <END> } return ret; }</code><technical_language>In case of Add Bricks increasing replica count, getParameters().getBricks() newly added bricks added existing replica set. Consider this case. I replica 2 volume increasing replica 3 bringing in a new 3rd host. I add replicas new host. bricks in this list newly added host</technical_language>

Target:
protected boolean validate() { if (!super.validate()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { failValidation(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } if (getGlusterVolume().getVolumeType().isReplicatedType()) { if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount() + 1) { failValidation(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT_MORE_THAN_ONE); } else if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount()) { failValidation(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT); } } if (getGlusterVolume().getVolumeType().isStripedType()) { if (getParameters().getStripeCount() > getGlusterVolume().getStripeCount() + 1) { failValidation(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_STRIPE_COUNT_MORE_THAN_ONE); } else if (getParameters().getStripeCount() < getGlusterVolume().getStripeCount()) { failValidation(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_STRIPE_COUNT); } } if (getGlusterVolume().getVolumeType().isDispersedType()) { failValidation(EngineMessage.ACTION_TYPE_FAILED_ADD_BRICK_TO_DISPERSE_VOLUME_NOT_SUPPORTED); } boolean ret = updateBrickServerAndInterfaceNames(getParameters().getBricks(), true) && validateDuplicateBricks(getParameters().getBricks()); if (getCluster().supportsGlusterService() && getCluster().supportsVirtService() && getGlusterVolume().getVolumeType().isReplicatedType()) { ret = ret && validateNotSameServer(getParameters().getBricks(), getGlusterVolume(), getParameters().getReplicaCount()); } return ret; }