diff --git a/controller/instance_manager_controller.go b/controller/instance_manager_controller.go index a899067e8e..ebddf2e41c 100644 --- a/controller/instance_manager_controller.go +++ b/controller/instance_manager_controller.go @@ -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 } diff --git a/controller/node_controller.go b/controller/node_controller.go index c843344c3b..2a2a941b8a 100644 --- a/controller/node_controller.go +++ b/controller/node_controller.go @@ -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 } diff --git a/datastore/longhorn.go b/datastore/longhorn.go index 8d67f1dd62..402ecb6557 100644 --- a/datastore/longhorn.go +++ b/datastore/longhorn.go @@ -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 }