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.1.0.tar.gz (218.7 kB view details)

Uploaded Source

File details

Details for the file ovirt-engine-sdk-python-4.1.0.tar.gz.

File metadata

File hashes

Hashes for ovirt-engine-sdk-python-4.1.0.tar.gz
Algorithm Hash digest
SHA256 d44378cf2aaac00ab6afd8e67fd7137e60c35aacf74e4a7fe6b5cb403ff334e2
MD5 c1df7f25ed1dff58ca19c37e2d7b0315
BLAKE2b-256 e5adf85911856cff312032306a00ad352b20fdd309b1267c8682c3a5ddb50048

See more details on using hashes here.

Supported by

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