Skip to content

Commit

Permalink
skip filtering using sid with replicationClass
Browse files Browse the repository at this point in the history
skip filtering using sid with replicationClass if peerclass
is not found

Signed-off-by: rakeshgm <rakeshgm@redhat.com>
  • Loading branch information
rakeshgm committed Sep 20, 2024
1 parent b27af18 commit a654e19
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/controller/volumereplicationgroup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ func (v *VRGInstance) separatePVCsUsingStorageClassProvisioner(pvcList *corev1.P

switch len(v.instance.Spec.Async.PeerClasses) {
case 0:
v.log.Info("validate using sc provisioner")
v.log.Info("validate using only sc provisioner")

replicationClassMatchFound := false

Expand Down
23 changes: 17 additions & 6 deletions internal/controller/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,8 @@ func (v *VRGInstance) selectVolumeReplicationClass(
return nil, fmt.Errorf("missing storageID label in storageclass of pvc %s", namespacedName)
}

peerClasses := len(v.instance.Spec.Async.PeerClasses)

matchingReplicationClassList := []*volrep.VolumeReplicationClass{}

for index := range v.replClassList.Items {
Expand All @@ -1285,13 +1287,22 @@ func (v *VRGInstance) selectVolumeReplicationClass(
continue
}

sIDFromReplicationClass, exists := replicationClass.GetLabels()[StorageIDLabel]
if !exists {
continue
}
// if peerClasses does not exist, replicationClasses would not have sid in
// older ramen versions, this check is neeed because we need to handle upgrade
// scenario where sid is not present in replicatioClass.

if sIDFromReplicationClass != sID {
continue
// if peerClass exist, continue to check if sid matches, or skip the check and proceed
// to append to matchingReplicationClassList
if peerClasses != 0 {

sIDFromReplicationClass, exists := replicationClass.GetLabels()[StorageIDLabel]
if !exists {
continue
}

if sIDFromReplicationClass != sID {
continue
}
}

matchingReplicationClassList = append(matchingReplicationClassList, replicationClass)
Expand Down

0 comments on commit a654e19

Please sign in to comment.