| Summary: | 'SystemService' object has no attribute 'instance_type_service' in SDK | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Virtualization Manager | Reporter: | Robert McSwain <rmcswain> |
| Component: | ovirt-engine-sdk-python | Assignee: | Ondra Machacek <omachace> |
| Status: | CLOSED NOTABUG | QA Contact: | Pavel Stehlik <pstehlik> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.0.4 | CC: | gklein |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-21 08:48:48 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | Infra | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
Robert McSwain
2016-11-18 19:03:53 UTC
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
|