1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

devmapper: Use deactivateDevice() instead of removeDevice() in deleteDevice()

Use deactivateDevice() instead of removeDevice() directly. This will make
sure for device deletion, deferred removal is used if user has configured
it in. Also this makes reading code litle easier as there is single function
to remove a device and that is deactivateDevice().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Vivek Goyal 2015-09-30 18:54:06 -04:00
parent 8ebd0c972a
commit 39081eb3aa

View file

@ -1477,12 +1477,10 @@ func (devices *DeviceSet) deleteDevice(info *devInfo) error {
}
}
devinfo, _ := devicemapper.GetInfo(info.Name())
if devinfo != nil && devinfo.Exists != 0 {
if err := devices.removeDevice(info.Name()); err != nil {
logrus.Debugf("Error removing device: %s", err)
return err
}
// Try to deactivate deivce in case it is active.
if err := devices.deactivateDevice(info); err != nil {
logrus.Debugf("Error deactivating device: %s", err)
return err
}
if err := devices.openTransaction(info.Hash, info.DeviceID); err != nil {