Преглед изворни кода

Runtime: Only remove device on destroy if it exists

Alexander Larsson пре 12 година
родитељ
комит
5f8e24f842
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      runtime.go

+ 1 - 1
runtime.go

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