Skip to content

Commit

Permalink
api: block on execution of ImportVmFromConfiguration
Browse files Browse the repository at this point in the history
we don't normally to this but in case of ImportVmFromConfiguration it makes
some sense to invoke it as a blocking (sync) operation since it doesn't involve
disk operation so if may only have async operation related to vm leases which are
relatively quick. The main reason to do this is that some backup applications
relied on getting Created response and can't cope with Accepted but it also makes
to do that because it is often the case that clients try to start the VM right
after the execution of ImportVmFromConfiguration is completed.

Bug-Url: https://bugzilla.redhat.com/2074112
Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed May 2, 2022
1 parent 90f3662 commit 38d5120
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 38d5120

Please sign in to comment.