Skip to main content

Common utils for RHVH automation project

Prerequisite

  • Python == "^3.7"

use poetry for dependency management and packaging

For dev

  • install dependencies
dnf install -y python3-devel libcurl-devel libxml-devel libxslt-devel
  • install poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
  • then follow the Document for next setup

  • cd to $PROJECT root

$> poetry install && poetry shell

for detail usage, please see Document

use this package for other project

$> poetry add rhvhauto-common-utils

or

$> pip install rhvhauto-common-utils

common_utils/rhv

a simple ovirt-sdk4 wrapper

HE Dashboard
  • add host
  • migrate vm
Upgrade
  • add data-center
  • remove data-center
  • add cluster
  • remove cluster
  • add host
  • list host
  • deactivate host
  • remove host
  • check_update_available
  • upgrade_host
  • update_network
  • add_plain_storage_domain
  • remove_storage_domain
  • create_vm_from_tpl
  • list_vm(self, vm_name)
  • start_vm(self, vm_name)
  • operate_vm(self, vm_name, operation)
  • remove_vm(self, vm_name)
  • create_vm_image_disk(self, vm_name, sd_name, disk_name, disk_size
  • attach_disk_to_vm(self, disk_name, vm_name, bootable=False)
  • migrate_vm(self, vm_name)

Examples

Basic Usage
from rhvhauto_common_utils.rhv.base import BaseRhvAPI

if __name__ == '__main__':
    url = "https://FQDN/ovirt-engine/api"
    api = BaseRhvAPI(url)

    ret = api.add_data_center("atv_dc_01", local=False, wait=True)
    print(ret)

    ret = api.del_data_center("atv_dc_01")
    print(ret)

    ret = api.add_cluster(
        "atv_cl_01",
        data_center_name="atv_dc_01",
        cpu_type="Intel Skylake Server Family"
    )
    print(ret)

    ret = api.del_cluster("atv_cl_03")
    print(ret)

    ret = api.add_host(
        "atv_host_01",
        address="10.73.73.69",
        root_password="redhat",
        cluster_name="atv_cl_01",
        deploy_hosted_engine=False
    )
    print(ret)

    ret = api.deactivate_host("atv_host_01")
    print(ret)

    ret = api.activate_host('atv_host_01')
    print(ret)
    
    ret = api.add_iscsi_storage("name",
                                data_center_name="dc_name",
                                host_name="host_name",
                                lun_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                                address="0.0.0.0",
                                target="iqn.xxxxxxx:xxxx.xxxxxx.xxxxx",
                                port=3260)
    print(ret)
    

Release files for rhvhauto-common-utils 0.1.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for rhvhauto-common-utils 0.1.17
File Interpreter ABI Platform
rhvhauto_common_utils-0.1.17-py3-none-any.whl Python 3 none any Details

Release files / rhvhauto_common_utils-0.1.17-py3-none-any.whl

Download URL rhvhauto_common_utils-0.1.17-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb3e5d6027add8bcb3d51f9f4be3d3302c7c3d206c075244feb39f28c215d78e
BLAKE2b-256 checksum
How to use checksums
6c3e95529b23fbc44a4955c89d1d627deb6bad6a96aabf4b97a2ea2d12f3bf25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.2 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.1.17 This release

1 release file

0.1.16

1 release file

0.1.15

1 release file

0.1.14

1 release file

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page