Skip to content

Commit

Permalink
core: fix monitoring of RemoveVm
Browse files Browse the repository at this point in the history
Previously, RemoveVm and RemoveAllVmImages didn't have a callback so they
didn't wait for all instances of RemoveImage to finish before finishing
RemoveVm and therefore the job of RemoveVm may have been completed while
the images are still locked in the database.

Now, RemoveVm is completed after RemoveImage completes and the images are
removed from the database.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed Nov 3, 2022
1 parent ae817da commit c7b51e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,6 @@ public Guid createTask(Guid taskId,

@Override
public CommandCallback getCallback() {
return getParameters().isUseCinderCommandCallback() ? callbackProvider.get() : null;
return callbackProvider.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
import java.util.List;
import java.util.Set;

import javax.enterprise.inject.Instance;
import javax.inject.Inject;

import org.ovirt.engine.core.bll.ConcurrentChildCommandsExecutionCallback;
import org.ovirt.engine.core.bll.InternalCommandAttribute;
import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
import org.ovirt.engine.core.bll.VmCommand;
import org.ovirt.engine.core.bll.context.CommandContext;
import org.ovirt.engine.core.bll.tasks.interfaces.CommandCallback;
import org.ovirt.engine.core.common.action.ActionReturnValue;
import org.ovirt.engine.core.common.action.ActionType;
import org.ovirt.engine.core.common.action.RemoveAllVmImagesParameters;
Expand Down Expand Up @@ -47,6 +50,8 @@ public class RemoveAllVmImagesCommand<T extends RemoveAllVmImagesParameters> ext
private DiskImageDao diskImageDao;
@Inject
private ImageDao imageDao;
@Inject
private Instance<ConcurrentChildCommandsExecutionCallback> callbackProvider;

public RemoveAllVmImagesCommand(T parameters, CommandContext cmdContext) {
super(parameters, cmdContext);
Expand Down Expand Up @@ -142,4 +147,8 @@ protected void endVmCommand() {
super.endVmCommand();
}
}

public CommandCallback getCallback() {
return callbackProvider.get();
}
}

0 comments on commit c7b51e3

Please sign in to comment.