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 is removed from the database (rather than
staying in LOCKED state) and the command would finish successfully in
the first case, and in the second case the command end with failure and
the image switches to ILLEGAL state.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed Dec 4, 2022
1 parent f9d1503 commit e0a1c82
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 e0a1c82

Please sign in to comment.