Skip to main content

Python SDK for oVirt Engine API

Project description

= oVirt Engine API Python SDK

== Introduction

This project contains the Python SDK for the oVirt Engine API.

== Important

Note that most of the code of this SDK is automatically generated. If
you just installed the package then you will have everything already,
but if you downloaded the source then you will need to generate it,
follow the instructions in the `README.adoc` file of the parent
directory.

== Usage

To use the SDK import the `ovirtsdk4` module. That will give you
access to all the classes of the SDK, and in particular to the
`Connection` class. This is the entry point of the SDK,
and gives you access to the root of the tree of services of the API:

[source,python]
----
import ovirtsdk4 as sdk

# Create a connection to the server:
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username=admin@internal',
password='...',
ca_file='ca.pem',
)

# Get the reference to the system service:
system_service = connection.system_service()

# Always remember to close the connection when finished:
connection.close()
----

The `ca.pem` file is required when connecting to a server protected
with TLS. In an usual oVirt installation it will be in
`/etc/pki/ovirt-engine/ca.pem`. If you don't specify `ca_file`, then
system wide CA certificate store will be used.

Once you have the reference to the system service you can use it to get
references to other services, and call their methods. For example, to
retrieve the list of virtual machines of the system you can use the
`vms_service()` method, which returns a reference to the service that
manages the virtual machines:

[source,python]
----
# Get the reference to the "vms" service:
vms_service = system_service.vms_service()
----

This service is an instance of `VmsService`, and it has a `list` method
that returns an array of virtual machines, which are instances of the
`Vm` class:

[source,python]
----
# Retrieve the virtual machines:
vms = vms_service.list()

# Print the names and identifiers of the virtual machines:
for vm in vms:
print("%s: %s" % (vm.name, vm.id))
----

You will find more usage examples in the `examples` directory.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ovirt-engine-sdk-python-4.0.0a3.tar.gz (21.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page