Hide Forgot
Description of problem: "According to /ovirt-engine/api/model#services/instance_type This service within the Python SDK should exist: connection.system_service().instance_types_service() However I get: AttributeError: 'SystemService' object has no attribute 'instance_type_service' " Perhaps I need to re-phrase my question as, "How am I supposed to be able to add/update/remove an Instance Type in RHVM with python-ovirt-engine-sdk4?" I tried this, but it's failing. Error message below... [root@drrhvm ~]# yum info python-ovirt-engine-sdk4 Loaded plugins: search-disabled-repos, versionlock Installed Packages Name : python-ovirt-engine-sdk4 Arch : x86_64 Version : 4.0.1 Release : 1.el7ev Size : 4.3 M Repo : installed From repo : rhel-7-server-rhv-4.0-rpms Summary : Python SDK for version 4 of the oVirt Engine API URL : http://ovirt.org/wiki/SDK License : ASL 2.0 Description : This package contains the Python SDK for version 4 of the oVirt Engine : API. Python: import ovirtsdk4 as sdk import ovirtsdk4.types as types connection = sdk.Connection(url='https://drrhvm.capella.edu/ovirt-engine/api',username=' admin@internal',password='**********************',insecure=True,debug=False ) test = connection.system_service().instance_type_service() # RETURNS: --- AttributeError: 'SystemService' object has no attribute 'instance_type_service' Version-Release number of selected component (if applicable): RHEV 4.0.4 How reproducible: 100% Actual results: Errors out due to the error AttributeError: 'SystemService' object has no attribute 'instance_type_service' Expected results: Succeeds
In your output you refer to incorrect naming. Usually the name of the service which manages the collections have plural names. The services which manages specific entity use singular names. So check the following output: # Get the reference to the instance types service: instance_types_service = connection.system_service().instance_types_service() # Use the "add" method to create a instance type: instance_types_service.add( types.InstanceType( name='myinstancetype', description='My instance type', ), ) # Find the instace type: instance_type = instance_types_service.list()[0] # Locate the service that manages the virtual machine, as that is where # the action methods are defined: instance_type_service = instance_types_service.instance_type_service(instance_type.id) # Remove instance type: instance_type_service.remove() In your example, you've refered to 'instance_type_service', but it should be 'instance_types_service'. I've also created an full example here: https://gerrit.ovirt.org/#/c/67098/2/sdk/examples/add_instance_type.py