Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block on execution of ImportVmFromConfiguration #318

Merged
merged 2 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,8 @@ protected boolean removeVmLease(Guid leaseStorageDomainId, Guid vmId) {
VmLeaseParameters params = new VmLeaseParameters(getStoragePoolId(), leaseStorageDomainId, vmId);
params.setParentCommand(getActionType());
params.setParentParameters(getParameters());
if (getParameters().getEntityInfo() == null) {
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, vmId));
}
params.setEntityInfo(getParameters().getEntityInfo() != null ? getParameters().getEntityInfo()
: new EntityInfo(VdcObjectType.VM, vmId));
ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.RemoveVmLease, params);
if (returnValue.getSucceeded()) {
getTaskIdList().addAll(returnValue.getInternalVdsmTaskIdList());
Expand Down Expand Up @@ -576,9 +575,8 @@ protected boolean addVmLease(Guid leaseStorageDomainId, Guid vmId, boolean hotPl
}
params.setParentCommand(getActionType());
params.setParentParameters(getParameters());
if (getParameters().getEntityInfo() == null) {
getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, vmId));
}
params.setEntityInfo(getParameters().getEntityInfo() != null ? getParameters().getEntityInfo()
: new EntityInfo(VdcObjectType.VM, vmId));
ActionReturnValue returnValue = runInternalActionWithTasksContext(ActionType.AddVmLease, params);
if (returnValue.getSucceeded()) {
getTaskIdList().addAll(returnValue.getInternalVdsmTaskIdList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,14 @@ public Response importVmFromConfiguration(Vm vm) {
}
return performCreate(ActionType.ImportVmFromConfiguration,
parameters,
new QueryIdResolver<Guid>(QueryType.GetVmByVmId, IdQueryParameters.class),
PollingType.JOB,
new QueryIdResolver<Guid>(QueryType.GetVmByVmId, IdQueryParameters.class));
// we don't normally to this but in case of ImportVmFromConfiguration it makes some sense to execute it as a blocking
// (sync) operation as it doesn't involve disk operations and it may only have an async operation related to vm lease
// which is relatively quick. The main reason to do this is that some backup applications rely on getting 201-Created
// response and can't cope with 202-Accepted but it also makes to do that because it is often the case that clients
// attempt to start the VM right after the execution of ImportVmFromConfiguration is completed.
true);
}

protected org.ovirt.engine.core.common.businessentities.VM getVmConfiguration(String snapshotId) {
Expand Down