Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Advanced integration with Red Hat Enterprise Virtualization Manager (RHEV-M) - Part 1 of 2

December 12, 2013
Oved Ourfali
Related topics:
DevOps
Related products:
Red Hat Enterprise Linux

    This is part 1 of a 2-part article about Advanced Integration with RHEV-M. 

    Background

    At CloudOpen Europe 2013, in Edinburgh, I presented a talk about advanced integration with the oVirt engine. This technical article is covering the contents of this session.

    RHEV-M is a Large scale, centralized management for server and desktop virtualization. It is based on leading performance, scalability and security infrastructure technologies, focusing on KVM for best integration/performance. It provides an alternative to Center/vSphere, providing end-to-end IaaS platform.

    rhevm

    In this post I'll show you how you can integrate with the RHEV-M engine, covering both new and cool features, as well as some "old" useful features.  Let's start with the REST-based APIs. These APIs allow you to perform different operations on the engine externally. You can do anything using the REST APIs, even operations that aren't exposed through the different UI interfaces.

    REST-based APIs

    We have several REST-based APIs in the RHEV-M engine:

    • REST API - provides application programming interface for the RHEV-M engine, using basic HTTP operations
    • SDKs (Python, Java) - based on the REST API - provides python based SDK to the RHEV-M engine
    • CLI (based on the Python SDK) - provides command line utility to the RHEV-M engine

    So, what should you use?

    That depends mostly on who you are, and what you are trying to accomplish:

    • If you're a sysadmin running a virtualized environment, and you would like to troubleshoot some issues without going into the UI, then you should use the CLI.
    • If you're a developer and you would like to integrate with the RHEV-M engine in your application, and your application is Java/Python based, then you should use the proper SDK.
    • If you're a developer using other languages, then you should use the API, using some HTTP library available in your platform.
    • If you just want to automate some tasks, then you should use the Python SDK or the CLI, depending on your preferable scripting language.

    Let's dive a little deeper into the API and the SDK. I won't cover the CLI in this post. For more information on that have a look at CLI Wiki page

    REST API

    The REST API provides application programming interface for the RHEV-M engine, using basic HTTP operations:

    • GET - Requests a resource
    • POST - Creates a new resource. The new resource data is included in the body of the request
    • PUT - Modifies an existing resource. The modified resource data is included in the body of the request
    • DELETE - Deletes a resource

    The API URI structure is as follows:

    protocol://server_details/entry_point/collection/resource/sub-collection/subresource

    For example, the following URL is a representation of the disk sub-resource with ID yyy-yyy in the VM resource with ID xxx-xxx, on our (secured) RHEV-M that's installed on machine rhevm port 8443:

    https://rhevm:8443/api/vms/{xxx}/disks/{yyy}

    Some basic examples:

    1. To list all collection resources, use HTTP GET
      • GET http(s)://server:port/api/vms
    2. To retrieve a specific resource, use HTTP GET
      • GET http(s)://server:port/api/vms/{xxx}
      • curl -v -u "user@domain:password" -H "Content-type: application/xml" -X GET http(s)://server:port/api/vms/{xxx}
    3. To create a resource, use POST.
      • POST http(s)://server:port/api/vms
        <vm>...</vm>
      • curl -v -u "user@domain:password"
        -H "Content-type: application/xml"
        -d
        '<vm>
        <name>my_new_vm</name>
        <cluster><name>cluster_name</name></cluster>
        <template><name>template_name</name></template>
        </vm>' 'http(s)://server:port/api/vms'
    4. To update the resource, use PUT.
      • PUT http(s)://server:port/api/vms/{xxx}
        <vm><name>aaa</name></vm>
      • echo "<vm><name>new_name</name></vm>" > /tmp/upload.xml
        curl -v -u "user@domain:password"
        -H "Content-type: application/xml"
        -T /tmp/upload.xml
        'http(s)://server:port/api/vms/{xxx}'
    5. To remove the resource, use DELETE.
      • DELETE http(s)://server:port/api/vms/{xxx}
      • curl -v -u "user@domain:password" -X DELETE http(s)://server:port/api/vms/{xxx}

    RSDL- RESTful Service Description Language

    How do you know what arguments to use when doing different operations?

    You can use the RSDL (RESTful Service Description Language) - machine and human readable XML description of HTTP-based web applications (typically REST web services). It models the resource/s provided by a service, the relationship between them, parameters that has to be supplied for the certain operation, specifies if parameter/s has to be mandated, and describes possible overloads as parameters sets.

    RSDL is intended to simplify the reuse of web services that are based on the HTTP architecture of the Web. It is platform and language independent and aims to promote reuse of applications beyond the basic use in a web browser, by both humans and machines.

    In order to get the RSDL, just follow the basic API URI, followed by "?rsdl":

    • https://rhevm:8080/ovirt-engine/api?rsdl

    And then you'll get all the different options for each and every HTTP request you can do on each and every resource.

    For example, here you see a partial list of available parameters when adding a new VM using HTTP POST on the VMs collection:

    rsdl

    SDK

    The Python-SDK is auto-generated software development kit for the RHEV-M engine API. Let's show some examples on how to use it.

    1. First, you need to create a proxy to the API
      • api = API(url='http://localhost:8080', username='user@domain', password='password')
    2. Now, you can access the different collections, (api.vms(), api.clusters(), etc...)
    3. Create new resources, for example create a new VM:
      • cluster = api.clusters().get(name='my_cluster') #destination cluster

      • template = api.templates().get(name='my_template') #source template
      • param = params.VM(name='new_vm', cluster=cluster, template=template, memory=1073741824) #setting additional parameters

      • new_vm = api.vms().add(param) #creating the VM
    4. List resources by query (server side query)
      • vms = api.vms().list(query = 'name=my_vm')
    5. List resources by property constraint (client side filtering)
      • vms = api.vms().list(memory=1073741824)
    6. Get a resource by constraint
      • vm = api.vms().get(id='f70d7c72-0232-4859-8fd7-fdaf1fd29d6d')
    7. Access resource methods and properties
      • vm.start()
      • vm.start_time

    Depending on your development environment, you'll get auto-completion, and documentation that will ease the development process using the SDK.

    In this part you learned how to perform different operations on the engine from the outside using the API/SDK. In the next part you'll learn how you can influence the engine from the inside, using extension APIs.

    Find Part 2 of this article here.

    Last updated: January 10, 2023

    Recent Posts

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    • How EvalHub manages two-layer Kubernetes control planes

    • Tekton joins the CNCF as an incubating project

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.