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:
parent
8228e50581
commit
eab270395e
1 changed files with 18 additions and 5 deletions
|
@ -639,6 +639,22 @@ func (devices *DeviceSet) DeleteDevice(hash string) error {
|
|||
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 {
|
||||
utils.Debugf("[devmapper] deactivateDevice(%s)", hash)
|
||||
defer utils.Debugf("[devmapper] deactivateDevice END")
|
||||
|
@ -789,11 +805,8 @@ func (devices *DeviceSet) Shutdown() error {
|
|||
}
|
||||
}
|
||||
|
||||
pool := devices.getPoolDevName()
|
||||
if devinfo, err := getInfo(pool); err == nil && devinfo.Exists != 0 {
|
||||
if err := devices.deactivateDevice("pool"); err != nil {
|
||||
utils.Debugf("Shutdown deactivate %s , error: %s\n", pool, err)
|
||||
}
|
||||
if err := devices.deactivatePool(); err != nil {
|
||||
utils.Debugf("Shutdown deactivate pool , error: %s\n", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue