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

devmapper: Fix shutdown warnings

Shutdown contains debug warnings like:

[debug] deviceset.go:699 [deviceset docker-0:33-17945897] waitRemove(/dev/mapper/docker-0:33-17945897-pool)
[debug] deviceset.go:380 libdevmapper(3): libdm-common.c:552 (-1) Device /dev/mapper/docker-0:33-17945897-pool not found

This is because shutdown is using removeDeviceAndWait() to remove the pool device and the
wait part fails because the pool is gone.

We fix this by adding a pool specific removal function which avoids all the trickiness of the
normal remove.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
Alexander Larsson 2014-02-11 12:47:59 +01:00
parent 8228e50581
commit eab270395e

View file

@ -639,6 +639,22 @@ func (devices *DeviceSet) DeleteDevice(hash string) error {
return devices.deleteDevice(hash) return devices.deleteDevice(hash)
} }
func (devices *DeviceSet) deactivatePool() error {
utils.Debugf("[devmapper] deactivatePool()")
defer utils.Debugf("[devmapper] deactivatePool END")
devname := devices.getPoolDevName()
devinfo, err := getInfo(devname)
if err != nil {
utils.Debugf("\n--->Err: %s\n", err)
return err
}
if devinfo.Exists != 0 {
return removeDevice(devname)
}
return nil
}
func (devices *DeviceSet) deactivateDevice(hash string) error { func (devices *DeviceSet) deactivateDevice(hash string) error {
utils.Debugf("[devmapper] deactivateDevice(%s)", hash) utils.Debugf("[devmapper] deactivateDevice(%s)", hash)
defer utils.Debugf("[devmapper] deactivateDevice END") defer utils.Debugf("[devmapper] deactivateDevice END")
@ -789,11 +805,8 @@ func (devices *DeviceSet) Shutdown() error {
} }
} }
pool := devices.getPoolDevName() if err := devices.deactivatePool(); err != nil {
if devinfo, err := getInfo(pool); err == nil && devinfo.Exists != 0 { utils.Debugf("Shutdown deactivate pool , error: %s\n", err)
if err := devices.deactivateDevice("pool"); err != nil {
utils.Debugf("Shutdown deactivate %s , error: %s\n", pool, err)
}
} }
return nil return nil