mirror of https://github.com/docker/docs.git
Merge pull request #4499 from alexlarsson/fix-remove-fail
DeviceMapper: Succeed immediately when removing non-existant devices
This commit is contained in:
commit
af3ff044a2
|
@ -90,6 +90,13 @@ func (d *Driver) Create(id, parent string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Remove(id string) error {
|
func (d *Driver) Remove(id string) error {
|
||||||
|
if !d.DeviceSet.HasDevice(id) {
|
||||||
|
// Consider removing a non-existing device a no-op
|
||||||
|
// This is useful to be able to progress on container removal
|
||||||
|
// if the underlying device has gone away due to earlier errors
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Sink the float from create in case no Get() call was made
|
// Sink the float from create in case no Get() call was made
|
||||||
if err := d.DeviceSet.UnmountDevice(id, UnmountSink); err != nil {
|
if err := d.DeviceSet.UnmountDevice(id, UnmountSink); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue