Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create RS irrespective of PV mount status. #1724

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions internal/controller/volsync/vshandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,11 @@ func (v *VSHandler) validatePVCBeforeRS(rsSpec ramendrv1alpha1.VolSyncReplicatio
}

if !inUseByReadyPod {
l.Info("PVC is not in use by ready pod, not creating RS yet ...")

return false, nil
l.Info("PVC is not in use by ready pod, yet creating RS ...")
} else {
l.Info("PVC is use by ready pod, proceeding to create RS ...")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use same log, just change the part describing the pvc:

PVC is use by ready pod, proceeding to create RS"
PVC is not used by ready pod, proceeding to create RS"

The "..." part is not helpful, so you can remove it while changing the logs. It can also be done in a preparation commit to keep one logic change for every commit.

Since we don't skip if inUseByReadyPod is false, we can use more natual check:

if inUseByReadyPod {
    log for used pvc...
} else {
    log for unused pvc ...
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just replace all lines from line 370 to 399 and replace it with this:

_, err := v.getRS(getReplicationSourceName(rsSpec.ProtectedPVC.Name), rsSpec.ProtectedPVC.Namespace)
if err != nil {
    if !kerrors.IsNotFound(err) {
        return false, err
    }
}

return true, nil


l.Info("PVC is use by ready pod, proceeding to create RS ...")

return true, nil
}

Expand Down
Loading