Unable to set virtual machine custom compatibilty version using python SDK

Solution Verified - Updated -

Issue

Unable to change 'custom_compatibility_version' virtual machine's attribute using 'ovirt-engine-sdk-python'.

Execute the following script to change 'custom_compatibilty_version' attribute from 'myvm' virtual machine:

#! /usr/bin/python
# -*- coding: utf-8 -*-

from time import sleep, gmtime, strftime
from ovirtsdk.api import API
from ovirtsdk.xml import params
from ovirtsdk.infrastructure.errors import RequestError, ConnectionError


RHEV_URL = "https://rhvm.example.com/ovirt-engine/api"
RHEV_USERNAME = "admin@internal"
RHEV_PASSWORD = "******"


if __name__ == '__main__':

      api = API(url=RHEV_URL,
        username=RHEV_USERNAME,
        password=RHEV_PASSWORD,
        ca_file="rhvm-ca.pem", debug=True)

      vm = api.vms.get(name = 'myvm')
      version = params.Version(major=4, minor=1)
      #version = None
      vm.custom_compatibility_version = version
      try:
        vm.update()
        print "VM Updated"
      except RequestError as ex:
        print "Unexpected error: %s" % ex
        pass

The script finishes with no error but the VM's 'custom_compatibility_version' attribute is not changed.

Environment

  • Red Hat Enterprise Virtualization 3.6
  • Red Hat Virtualization 4.0
  • Red Hat Virtualization 4.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content