Skip to content

Commit

Permalink
Add Unmount() function for mountpath without ID
Browse files Browse the repository at this point in the history
Signed-off-by: Vignesh Laxman <[email protected]>
  • Loading branch information
vlaxman-px committed Oct 16, 2023
1 parent e9c0a53 commit 31bb89a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/server/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ func (d *driver) unmount(w http.ResponseWriter, r *http.Request) {
}

mountpoint := d.mountpath(nameWithID)
mountpointWithoutID := d.mountpath(name)
id := vol.Id
if vol.Spec.Scale > 1 {
id = v.MountedAt(ctx, mountpoint)
Expand All @@ -886,6 +887,15 @@ func (d *driver) unmount(w http.ResponseWriter, r *http.Request) {
opts := make(map[string]string)
opts[options.OptionsDeleteAfterUnmount] = "true"

errWithoutID := v.Unmount(correlation.TODO(), id, mountpointWithoutID, opts)
if errWithoutID != nil {
d.logRequest(method, request.Name).Warnf(
"Cannot unmount volume %v, %v",
mountpointWithoutID, err)
d.errorResponse(method, w, err)
return
}

err = v.Unmount(correlation.TODO(), id, mountpoint, opts)
if err != nil {
d.logRequest(method, request.Name).Warnf(
Expand Down

0 comments on commit 31bb89a

Please sign in to comment.