Merge pull request #896 in YUNIONIO/onecloud from ~QUXUAN/onecloud:hotfix/qx-delete-image to release/2.5.0

* commit 'de2f6c219f1a7c5f4879200fb8bbbb4cc39652ee':
  避免删除非正常状态下image再次恢复时,镜像使用时会出现非预期状态
This commit is contained in:
邱剑
2019-01-05 19:16:39 +08:00
+3
View File
@@ -533,6 +533,9 @@ func (self *SImage) CustomizeDelete(ctx context.Context, userCred mcclient.Token
overridePendingDelete = jsonutils.QueryBoolean(query, "override_pending_delete", false)
purge = jsonutils.QueryBoolean(query, "purge", false)
}
if self.Status != IMAGE_STATUS_ACTIVE {
overridePendingDelete = true
}
return self.startDeleteImageTask(ctx, userCred, "", purge, overridePendingDelete)
}