From e1c418cac3cf06d453c7ac10dd54b2b0f617f1f6 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 9 Sep 2013 14:18:20 +0200 Subject: [PATCH] Runtime: Only remove device on destroy if it exists --- runtime.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime.go b/runtime.go index 30250e713b..54071e96a9 100644 --- a/runtime.go +++ b/runtime.go @@ -287,7 +287,7 @@ func (runtime *Runtime) Destroy(container *Container) error { if err := os.RemoveAll(container.root); err != nil { return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err) } - if runtime.GetMountMethod() == MountMethodDeviceMapper { + if runtime.GetMountMethod() == MountMethodDeviceMapper && runtime.deviceSet.HasDevice(container.ID) { if err := runtime.deviceSet.RemoveDevice(container.ID); err != nil { return fmt.Errorf("Unable to remove device for %v: %v", container.ID, err) }