Merge pull request #4055 from alexlarsson/remove-devmapper-dirs

devmapper: Remove directory when removing devicemapper device
This commit is contained in:
Michael Crosby 2014-02-11 17:05:56 -05:00
commit a66124ec6a
1 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/dotcloud/docker/graphdriver"
"github.com/dotcloud/docker/utils"
"io/ioutil"
"os"
"path"
)
@ -94,7 +95,16 @@ func (d *Driver) Remove(id string) error {
return err
}
// This assumes the device has been properly Get/Put:ed and thus is unmounted
return d.DeviceSet.DeleteDevice(id)
if err := d.DeviceSet.DeleteDevice(id); err != nil {
return err
}
mp := path.Join(d.home, "mnt", id)
if err := os.RemoveAll(mp); err != nil && !os.IsNotExist(err) {
return err
}
return nil
}
func (d *Driver) Get(id string) (string, error) {