From 39bdf601f6bea3c189d8e189e13c7e48b6f66b43 Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Thu, 5 Jan 2017 15:02:21 -0500 Subject: [PATCH] devmapper: Return device id in error message I often get complains that container removal failed and users got following error message. "Driver devicemapper failed to remove root filesystem 18a69ba82aaf7a039ce7d44156215012d703001643079775190ac7dd6c6acf56:Device is Busy" This error message talks about container id but does not give any info about which particular device id is busy. Most likely device is mounted in some other mount namespace and if one knows the device id, they can try to do some debugging figuring which process and which mount namespace is keeping the device busy and how did we reach that stage. Without that information, it becomes almost impossible to debug the problem. So to improve the debuggability, when device removal fails, also return device id in error message. Now new message looks as follows. "Driver devicemapper failed to remove root filesystem 18a69ba82aaf7a039ce7d44156215012d703001643079775190ac7dd6c6acf56: Failed to remove device dbc15bdf9994a17c613d8ef9e924f3cffbf67f91e4f709295c901ad628377991:Device is Busy" Signed-off-by: Vivek Goyal --- daemon/graphdriver/devmapper/driver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/graphdriver/devmapper/driver.go b/daemon/graphdriver/devmapper/driver.go index 7cf422ce6a..43c03eb3eb 100644 --- a/daemon/graphdriver/devmapper/driver.go +++ b/daemon/graphdriver/devmapper/driver.go @@ -151,7 +151,7 @@ func (d *Driver) Remove(id string) error { // This assumes the device has been properly Get/Put:ed and thus is unmounted if err := d.DeviceSet.DeleteDevice(id, false); err != nil { - return err + return fmt.Errorf("failed to remove device %v:%v", id, err) } mp := path.Join(d.home, "mnt", id)