Runtime: Only remove device on destroy if it exists

Upstream-commit: e1c418cac3cf06d453c7ac10dd54b2b0f617f1f6
Component: engine
This commit is contained in:
Alexander Larsson
2013-09-09 14:18:20 +02:00
committed by Victor Vieux
parent 8b38bd9ddf
commit 122f65c42a

View File

@ -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)
}