Runtime: Only remove device on destroy if it exists

Upstream-commit: 5f8e24f8428bc5fb7076ec757ded44f965c48888
Component: engine
This commit is contained in:
Alexander Larsson
2013-09-09 14:18:20 +02:00
committed by Tianon Gravi
parent eb4c81b5cf
commit 0453049ffb

View File

@ -288,7 +288,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)
}