Change in ovirt-engine-sdk[master]: Add support for asynchronous requests
Code Review
gerrit at ovirt.org
Thu May 4 13:32:14 UTC 2017
>From Ondra Machacek <omachace at redhat.com>:
Ondra Machacek has submitted this change and it was merged.
Change subject: Add support for asynchronous requests
......................................................................
Add support for asynchronous requests
This patch modifies the SDK so that it uses the 'multi' interface of the
'pycurl' library. This interface supports several advanced HTTP
capabilities, like multiple connections and pipelining.
The interface of the SDK is preserved, for backwards compatibility. The
only new addition is a new 'wait' parameter, for all operations. The
default value is 'true'. When the values is 'false' the operation is
performed asynchronously, and a 'future' object is returned that can be
used to retrieve the result later. For example:
# Find the virtual machine and the service that manages it:
vm = vms_service.list(search='name=myvm')[0]
vm_service = vms_service.vm_service(vm.id)
# Find the disk attachments, asynchronously:
attachments_service = vm_service.disk_attachments_service
attachments_future = attachments_service.list(wait=False)
# Do some other tasks, for example sending some more asynchronous
# requests, so that they are queued and potentially pipelined.
# Later, wait for the result:
attachments = attachments_future.wait()
# Print the details:
for attachment in attachments:
print(attachment.disk.id)
Change-Id: I106ccc52b58cd0aca23548e21cc21beac152e9e5
Bug-Url: https://bugzilla.redhat.com/1436981
Signed-off-by: Ondra Machacek <omachace at redhat.com>
---
M generator/src/main/java/org/ovirt/sdk/python/ServicesGenerator.java
A sdk/examples/asynchronous_inventory.py
M sdk/lib/ovirtsdk4/__init__.py
M sdk/lib/ovirtsdk4/service.py
4 files changed, 420 insertions(+), 97 deletions(-)
Approvals:
Ondra Machacek: Verified; Looks good to me, approved
Juan Hernandez: Looks good to me, but someone else must approve
Jenkins CI: Passed CI tests
--
To view, visit https://gerrit.ovirt.org/76041
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I106ccc52b58cd0aca23548e21cc21beac152e9e5
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Ondra Machacek <omachace at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ondra Machacek <omachace at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
More information about the Engine-commits
mailing list