Chapter 4. Python Quick Start Example
- 4.1. Python Quick Start Introduction
- 4.2. Example: Accessing the API Entry Point using Python
- 4.3. Example: Listing the Data Center Collection using Python
- 4.4. Example: Listing the Cluster Collection using Python
- 4.5. Example: Listing the Logical Networks Collection using Python
- 4.6. Example: Listing the Host Collection using Python
- 4.7. Example: Approving a Host using Python
- 4.8. Example: Creating NFS Data Storage using Python
- 4.9. Example: Creating NFS ISO Storage using Python
- 4.10. Example: Attaching Storage Domains to a Data Center using Python
- 4.11. Example: Activating Storage Domains using Python
- 4.12. Example: Creating a Virtual Machine using Python
- 4.13. Example: Creating a Virtual Machine NIC using Python
- 4.14. Example: Creating a Virtual Machine Storage Disk using Python
- 4.15. Example: Attaching an ISO Image to a Virtual Machine using Python
- 4.16. Example: Starting a Virtual Machine using Python
- 4.17. Example: Checking System Events using Python
4.1. Python Quick Start Introduction
This chapter provides a series of examples demonstrating the steps to create a virtual machine within a basic Red Hat Enterprise Virtualization environment, using the Python SDK.
These examples use the ovirtsdk Python library provided by the rhevm-sdk package. This package is available to systems subscribed to a
Red Hat Enterprise Virtualization entitlement pool if using certificate-based Red Hat Network, or the Red Hat Enterprise Virtualization Manager channel if using Red Hat Network classic. See the Red Hat Enterprise Virtualization Installation Guide for more information on subscribing your system(s) to download software from these locations.
Note
Refer to the Red Hat Enterprise Virtualization Manager Release Notes for specific channel names current to your system.
You will also need:
- A networked installation of Red Hat Enterprise Virtualization Manager.
- A networked and configured Red Hat Enterprise Virtualization Hypervisor.
- An ISO image file containing an operating system for installation on a virtual machine.
- A working understanding of both the logical and physical objects that make up a Red Hat Enterprise Virtualization environment.
- A working understanding of the Python programming language.
Important
All Python examples include placeholders for authentication details (USER for user name, and PASS for password). Ensure all requests performed with Python fulfill the authentication requirements of your environment.
Note
Red Hat Enterprise Virtualization Manager generates a globally unique identifier (GUID) for the
id attribute for each resource. Identifier codes in these examples might appear different to the identifier codes in your Red Hat Enterprise Virtualization environment.
Note
These Python examples contain only basic exception and error handling logic. For more information on the exception handling specific to the SDK refer to the
pydoc for the ovirtsdk.infrastructure.errors module.