diff --git a/core/orchestrator_core.go b/core/orchestrator_core.go index 97fc92004..2bf02e557 100644 --- a/core/orchestrator_core.go +++ b/core/orchestrator_core.go @@ -4340,7 +4340,7 @@ func (o *TridentOrchestrator) addVolumePublication( // UpdateVolumePublication updates a volume publication on the specified node with the provided value func (o *TridentOrchestrator) UpdateVolumePublication( - ctx context.Context, volumeName, nodeName string, notSafeToDetach *bool, + ctx context.Context, volumeName, nodeName string, notSafeToAttach *bool, ) (err error) { if o.bootstrapError != nil { return o.bootstrapError @@ -4352,19 +4352,19 @@ func (o *TridentOrchestrator) UpdateVolumePublication( defer o.mutex.Unlock() defer o.updateMetrics() - return o.updateVolumePublication(ctx, volumeName, nodeName, notSafeToDetach) + return o.updateVolumePublication(ctx, volumeName, nodeName, notSafeToAttach) } func (o *TridentOrchestrator) updateVolumePublication( - ctx context.Context, volumeName, nodeName string, notSafeToDetach *bool, + ctx context.Context, volumeName, nodeName string, notSafeToAttach *bool, ) error { vPub, err := o.getVolumePublication(volumeName, nodeName) if err != nil { return err } - if notSafeToDetach != nil { - vPub.NotSafeToDetach = *notSafeToDetach + if notSafeToAttach != nil { + vPub.NotSafeToAttach = *notSafeToAttach } if err := o.unpublishVolume(ctx, volumeName, nodeName); err != nil { diff --git a/core/orchestrator_core_test.go b/core/orchestrator_core_test.go index ecc6788ee..032863fc5 100644 --- a/core/orchestrator_core_test.go +++ b/core/orchestrator_core_test.go @@ -2772,7 +2772,7 @@ func TestUpdateVolumePublication(t *testing.T) { VolumeName: vol1, ReadOnly: true, AccessMode: 1, - NotSafeToDetach: true, + NotSafeToAttach: true, } fakeName2 := utils.GenerateVolumePublishName(vol2, node2) @@ -2782,7 +2782,7 @@ func TestUpdateVolumePublication(t *testing.T) { VolumeName: vol2, ReadOnly: true, AccessMode: 1, - NotSafeToDetach: false, + NotSafeToAttach: false, } fakeName3 := utils.GenerateVolumePublishName(vol3, node3) @@ -2792,7 +2792,7 @@ func TestUpdateVolumePublication(t *testing.T) { VolumeName: vol3, ReadOnly: true, AccessMode: 1, - NotSafeToDetach: false, + NotSafeToAttach: false, } pubs := map[string]*utils.VolumePublication{ @@ -2839,7 +2839,7 @@ func TestUpdateVolumePublication(t *testing.T) { assert.Nil(t, err, "update volume publication did not return an error") aPub, err := orchestrator.getVolumePublication(arg.Vol, arg.Node) assert.Nil(t, err, "get volume publication error was not nil") - assert.Equal(t, arg.Expected, aPub.NotSafeToDetach, "value of updated field did not match the desired value") + assert.Equal(t, arg.Expected, aPub.NotSafeToAttach, "value of updated field did not match the desired value") err = orchestrator.deleteVolumePublication(context.Background(), arg.Vol, arg.Node) assert.Nil(t, err, "delete volume publication did not return an error") }) diff --git a/core/types.go b/core/types.go index 114c66c3d..63539fb32 100644 --- a/core/types.go +++ b/core/types.go @@ -78,7 +78,7 @@ type Orchestrator interface { PeriodicallyReconcileNodeAccessOnBackends() AddVolumePublication(ctx context.Context, vp *utils.VolumePublication) error - UpdateVolumePublication(ctx context.Context, nodeName, volumeName string, notSafeToDetach *bool) error + UpdateVolumePublication(ctx context.Context, nodeName, volumeName string, notSafeToAttach *bool) error GetVolumePublication(ctx context.Context, volumeName, nodeName string) (*utils.VolumePublication, error) ListVolumePublications(ctx context.Context) ([]*utils.VolumePublicationExternal, error) ListVolumePublicationsForVolume( diff --git a/frontend/rest/controller_handlers.go b/frontend/rest/controller_handlers.go index f8824f5c9..e5d73d38e 100644 --- a/frontend/rest/controller_handlers.go +++ b/frontend/rest/controller_handlers.go @@ -965,8 +965,8 @@ func UpdateVolumePublication(w http.ResponseWriter, r *http.Request) { response := &VolumePublicationsResponse{} UpdateGeneric(w, r, response, func(vars map[string]string, _ []byte) int { - notSafeToDetach := vars["notSafeToDetach"] == "true" - err := orchestrator.UpdateVolumePublication(r.Context(), vars["volume"], vars["node"], ¬SafeToDetach) + notSafeToAttach := vars["notSafeToAttach"] == "true" + err := orchestrator.UpdateVolumePublication(r.Context(), vars["volume"], vars["node"], ¬SafeToAttach) if err != nil { response.Error = err.Error() } diff --git a/utils/types.go b/utils/types.go index 6856a6aa7..892df356b 100644 --- a/utils/types.go +++ b/utils/types.go @@ -75,7 +75,7 @@ type VolumePublication struct { // The access mode values are defined by CSI // See https://github.com/container-storage-interface/spec/blob/release-1.5/lib/go/csi/csi.pb.go#L135 AccessMode int32 `json:"accessMode"` - NotSafeToDetach bool `json:"notSafeToDetach"` + NotSafeToAttach bool `json:"notSafeToAttach"` } type VolumePublicationExternal struct { @@ -86,7 +86,7 @@ type VolumePublicationExternal struct { // The access mode values are defined by CSI // See https://github.com/container-storage-interface/spec/blob/release-1.5/lib/go/csi/csi.pb.go#L135 AccessMode int32 `json:"accessMode"` - NotSafeToDetach bool `json:"notSafeToDetach"` + NotSafeToAttach bool `json:"notSafeToAttach"` } func (v *VolumePublication) ConstructExternal() *VolumePublicationExternal { @@ -96,7 +96,7 @@ func (v *VolumePublication) ConstructExternal() *VolumePublicationExternal { VolumeName: v.VolumeName, ReadOnly: v.ReadOnly, AccessMode: v.AccessMode, - NotSafeToDetach: v.NotSafeToDetach, + NotSafeToAttach: v.NotSafeToAttach, } }