Skip to content

Commit

Permalink
core: fix async task-less execution of remove-image
Browse files Browse the repository at this point in the history
RemoveImage may lack async tasks when:
1. The image doesn't exist
2. There's a failure during delete image

With these changes, the image would be removed from the database
(rather than staying in LOCKED state) and the command would finish
successfully in the first case, and would end with failure with
the image switching to ILLEGAL state in the second case.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed Dec 4, 2022
1 parent f9d1503 commit 8b0ca88
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ protected void executeCommand() {
if (e.getErrorCode() == EngineError.ImageDoesNotExistInDomainError) {
log.info("Disk '{}' doesn't exist on storage domain '{}', rolling forward",
getDiskImage().getId(), getStorageDomainId());
endSuccessfully();
} else if (e.getErrorCode() == EngineError.ImageDeleteError && isImageRemovedFromStorage()) {
// VDSM renames the image before deleting it, so technically the image doesn't exist after renaming,
// but the actual delete can still fail with ImageDeleteError.
// In this case, Engine has to check whether image still exists on the storage or not.
log.info("Disk '{}' was deleted from storage domain '{}'", getDiskImage().getId(),
getStorageDomainId());
log.info("Failed to delete Disk '{}' from storage domain '{}', changing to illegal",
getDiskImage().getId(), getStorageDomainId());
endWithFailure();
} else {
throw e;
}
Expand Down

0 comments on commit 8b0ca88

Please sign in to comment.