Przeglądaj źródła

Runtime: Only remove device on destroy if it exists

Alexander Larsson 12 lat temu
rodzic
commit
e1c418cac3
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      runtime.go

+ 1 - 1
runtime.go

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