Chapter 1. Overview

Version 4 of the Python software development kit is a collection of classes that allows you to interact with the Red Hat Virtualization Manager in Python-based projects. By downloading these classes and adding them to your project, you can access a range of functionality for high-level automation of administrative tasks.

Note

Version 3 of the SDK is no longer supported. For more information, consult the RHV 4.3 version of this guide.

Python 3.7 and async

In Python 3.7 and later versions, async is a reserved keyword. You cannot use the async parameter in methods of services that previously supported it, as in the following example, because async=True will cause an error:

dc = dc_service.update(
    types.DataCenter(
        description='Updated description',
    ),
    async=True,
)

The solution is to add an underscore to the parameter (async_):

dc = dc_service.update(
    types.DataCenter(
        description='Updated description',
    ),
    async_=True,
)
Note

This limitation applies only to Python 3.7 and later. Earlier versions of Python do not require this modification.

1.1. Prerequisites

To install the Python software development kit, you must have:

  • A system where Red Hat Enterprise Linux 8 is installed. Both the Server and Workstation variants are supported.
  • A subscription to Red Hat Virtualization entitlements.
Important

The software development kit is an interface for the Red Hat Virtualization REST API. Use the version of the software development kit that corresponds to the version of your Red Hat Virtualization environment. For example, if you are using Red Hat Virtualization 4.3, use V4 Python software development kit.

1.2. Installing the Python Software Development Kit

To install the Python software development kit:

  1. Enable the repositories that are appropriate for your hardware platform. For example, for x86-64 hardware, enable:

    # subscription-manager repos \
        --enable=rhel-8-for-x86_64-baseos-rpms \
        --enable=rhel-8-for-x86_64-appstream-rpms \
        --enable=rhv-4.4-manager-for-rhel-8-x86_64-rpms
    
    # subscription-manager repos \
            --enable=rhel-8-for-x86_64-baseos-eus-rpms \
            --enable=rhel-8-for-x86_64-appstream-eus-rpms
    
    # subscription-manager release --set=8.6
  2. Install the required packages:

    # dnf install python3-ovirt-engine-sdk4

The Python software development kit is installed into the Python 3 site-packages directory, and the accompanying documentation and example are installed to /usr/share/doc/python3-ovirt-engine-sdk4.