瀏覽代碼

Runtime: Delete corresponding devices when deleting container

Alexander Larsson 11 年之前
父節點
當前提交
19ba0b851b
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      runtime.go

+ 5 - 0
runtime.go

@@ -282,6 +282,11 @@ 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 err := runtime.deviceSet.RemoveDevice(container.ID); err != nil {
+			return fmt.Errorf("Unable to remove device for %v: %v", container.ID, err)
+		}
+	}
 	return nil
 }