1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Runtime: Only remove device on destroy if it exists

This commit is contained in:
Alexander Larsson 2013-09-09 14:18:20 +02:00 committed by Victor Vieux
parent 3343b3f8f8
commit e1c418cac3

View file

@ -287,7 +287,7 @@ func (runtime *Runtime) Destroy(container *Container) error {
if err := os.RemoveAll(container.root); err != nil { if err := os.RemoveAll(container.root); err != nil {
return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err) 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 { if err := runtime.deviceSet.RemoveDevice(container.ID); err != nil {
return fmt.Errorf("Unable to remove device for %v: %v", container.ID, err) return fmt.Errorf("Unable to remove device for %v: %v", container.ID, err)
} }