Skip to content

Commit

Permalink
Make ListVolumePDBProtectedHealthyReplicas read-only
Browse files Browse the repository at this point in the history
Longhorn 2238

Signed-off-by: Eric Weber <eric.weber@suse.com>
  • Loading branch information
ejweber committed Nov 20, 2023
1 parent aa126ad commit d2583a3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controller/instance_manager_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func (imc *InstanceManagerController) canDeleteInstanceManagerPDB(im *longhorn.I
hasPDBOnAnotherNode := false
isUnusedReplicaOnCurrentNode := false

pdbProtectedHealthyReplicas, err := imc.ds.ListVolumePDBProtectedHealthyReplicas(replica.Spec.VolumeName)
pdbProtectedHealthyReplicas, err := imc.ds.ListVolumePDBProtectedHealthyReplicasRO(replica.Spec.VolumeName)
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion controller/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ func (nc *NodeController) shouldEvictReplica(node *longhorn.Node, kubeNode *core
return false, constant.EventReasonEvictionCanceled, nil
}

pdbProtectedHealthyReplicas, err := nc.ds.ListVolumePDBProtectedHealthyReplicas(replica.Spec.VolumeName)
pdbProtectedHealthyReplicas, err := nc.ds.ListVolumePDBProtectedHealthyReplicasRO(replica.Spec.VolumeName)
if err != nil {
return false, "", err
}
Expand Down
4 changes: 2 additions & 2 deletions datastore/longhorn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1451,9 +1451,9 @@ func IsAvailableHealthyReplica(r *longhorn.Replica) bool {
return true
}

func (s *DataStore) ListVolumePDBProtectedHealthyReplicas(volumeName string) (map[string]*longhorn.Replica, error) {
func (s *DataStore) ListVolumePDBProtectedHealthyReplicasRO(volumeName string) (map[string]*longhorn.Replica, error) {
pdbProtectedHealthyReplicas := map[string]*longhorn.Replica{}
replicas, err := s.ListVolumeReplicas(volumeName)
replicas, err := s.ListVolumeReplicasRO(volumeName)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d2583a3

Please sign in to comment.