diff options
author | Anusha Ragunathan <anusha.ragunathan@docker.com> | 2016-09-23 10:37:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-23 10:37:28 -0700 |
commit | b8265e55508db99aea632033b2f5008f921b11e2 (patch) | |
tree | b3f546c0034f8c15c1bbb191225242d0f8cf8111 /container/container_windows.go | |
parent | 047400c64c9a19fe9c20176dc9ca5d86301a91ae (diff) | |
parent | d576509d8ad1ef4770cb3959a792748c8658b0be (diff) | |
download | docker-b8265e55508db99aea632033b2f5008f921b11e2.tar.gz |
Merge pull request #26843 from anusha-ragunathan/vol-unmount-win
Call "VolumeDriver.Unmount" during container stop.
Diffstat (limited to 'container/container_windows.go')
-rw-r--r-- | container/container_windows.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/container/container_windows.go b/container/container_windows.go index 736c7e95d8..93c9aaaa35 100644 --- a/container/container_windows.go +++ b/container/container_windows.go @@ -49,6 +49,40 @@ func (container *Container) IpcMounts() []Mount { // UnmountVolumes explicitly unmounts volumes from the container. func (container *Container) UnmountVolumes(forceSyscall bool, volumeEventLog func(name, action string, attributes map[string]string)) error { + var ( + volumeMounts []volume.MountPoint + err error + ) + + for _, mntPoint := range container.MountPoints { + dest, err := container.GetResourcePath(mntPoint.Destination) + if err != nil { + return err + } + volumeMounts = append(volumeMounts, volume.MountPoint{Destination: dest, Volume: mntPoint.Volume, ID: mntPoint.ID}) + + } + + // atm, this is a no-op. + if volumeMounts, err = appendNetworkMounts(container, volumeMounts); err != nil { + return err + } + + for _, volumeMount := range volumeMounts { + if volumeMount.Volume != nil { + if err := volumeMount.Volume.Unmount(volumeMount.ID); err != nil { + return err + } + volumeMount.ID = "" + + attributes := map[string]string{ + "driver": volumeMount.Volume.DriverName(), + "container": container.ID, + } + volumeEventLog(volumeMount.Volume.Name(), "unmount", attributes) + } + } + return nil } |