Skip to content

Commit

Permalink
Remove another rollback step from Unmount request handler
Browse files Browse the repository at this point in the history
  • Loading branch information
amogh09 committed Dec 21, 2023
1 parent 005717f commit 7e4bf35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion ecs-init/volumes/ecs_volume_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func (a *AmazonECSVolumePlugin) Unmount(r *volume.UnmountRequest) error {
if len(vol.Mounts) == 0 {
seelog.Infof("No active mounts left on volume %s, unmounting it", r.Name)
if err := volDriver.Remove(&driver.RemoveRequest{Name: r.Name}); err != nil {
vol.AddMount(r.ID)
seelog.Errorf("Failed to unmount volume %v: %v", r.Name, err)
return fmt.Errorf("failed to unmount volume %v: %w", r.Name, err)
}
Expand Down
9 changes: 2 additions & 7 deletions ecs-init/volumes/ecs_volume_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,16 +1028,11 @@ func TestPluginUnmount(t *testing.T) {
req: &volume.UnmountRequest{Name: volName, ID: reqMountID},
expectedError: "failed to unmount volume volume: some error",
assertPluginState: func(t *testing.T, plugin *AmazonECSVolumePlugin) {
// Mount should still exist in the plugin state
mounts := map[string]*string{reqMountID: nil}
// Mount should not exist in the plugin state
mounts := map[string]*string{}
assert.Equal(t,
map[string]*types.Volume{volName: {Path: volPath, Mounts: mounts}},
plugin.volumes)
assert.Equal(t,
&VolumeState{
Volumes: map[string]*VolumeInfo{volName: {Path: volPath, Mounts: mounts}},
},
plugin.state.VolState)
},
},
{
Expand Down

0 comments on commit 7e4bf35

Please sign in to comment.