From 30047b636512ec1ade4c62a06f47957946384458 Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Tue, 6 Oct 2015 17:37:21 -0400 Subject: [PATCH] devmapper: Implement deferred deletion functionality Finally here is the patch to implement deferred deletion functionality. Deferred deleted devices are marked as "Deleted" in device meta file. First we try to delete the device and only if deletion fails and user has enabled deferred deletion, device is marked for deferred deletion. When docker starts up again, we go through list of deleted devices and try to delete these again. Signed-off-by: Vivek Goyal --- devicemapper/devmapper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devicemapper/devmapper.go b/devicemapper/devmapper.go index abbd28b..136dd6b 100644 --- a/devicemapper/devmapper.go +++ b/devicemapper/devmapper.go @@ -750,7 +750,11 @@ func DeleteDevice(poolName string, deviceID int) error { return fmt.Errorf("Can't set message %s", err) } + dmSawBusy = false if err := task.run(); err != nil { + if dmSawBusy { + return ErrBusy + } return fmt.Errorf("Error running DeleteDevice %s", err) } return nil