Bug 1311242 - "UserWarnings" outputted during api.hosts.get()
Summary: "UserWarnings" outputted during api.hosts.get()
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: Core
Version: 3.6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: ---
: ---
Assignee: Juan Hernández
QA Contact: Pavel Stehlik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-23 17:13 UTC by jniederm
Modified: 2016-02-23 17:44 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-23 17:44:40 UTC
oVirt Team: Infra
rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?


Attachments (Terms of Use)

Description jniederm 2016-02-23 17:13:46 UTC
Description of problem:
Following warnings are outputted during api.hosts.get(id=<hostId>) call.

/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py:46773: UserWarning: Value "gauge" does not match xsd enumeration restriction on StatisticKind
  warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on StatisticKind' % {"value" : value.encode("utf-8")} )
/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py:46785: UserWarning: Value "integer" does not match xsd enumeration restriction on ValueType
  warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on ValueType' % {"value" : value.encode("utf-8")} )
/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py:46797: UserWarning: Value "bytes" does not match xsd enumeration restriction on StatisticUnit
  warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on StatisticUnit' % {"value" : value.encode("utf-8")} )
/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py:46785: UserWarning: Value "decimal" does not match xsd enumeration restriction on ValueType
  warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on ValueType' % {"value" : value.encode("utf-8")} )
/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py:46797: UserWarning: Value "percent" does not match xsd enumeration restriction on StatisticUnit
  warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on StatisticUnit' % {"value" : value.encode("utf-8")} )
/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py:46797: UserWarning: Value "none" does not match xsd enumeration restriction on StatisticUnit
  warnings_.warn('Value "%(value)s" does not match xsd enumeration restriction on StatisticUnit' % {"value" : value.encode("utf-8")} )

Version-Release number of selected component (if applicable):
ovirt-engine-sdk-python.noarch 4.0.0.0-0.2.20151123.git8ba204b.fc22 @ovirt-master-snapshot
engine: self-build, 4.0 master, 904ab61 master
(it differs from bugzilla version field because appropriate version was not offered)

How reproducible:
100% when host is freshly added, 0% when host is in state 'up'

Steps to Reproduce:
def createHost(api, name, ipAddress):
    print 'Creating host'
    host = api.hosts.get(name)
    if host is None:
        host = api.hosts.add(params.Host(
            name=name,
            cluster=api.clusters.get(name='Default'),
            address=ipAddress,
            root_password='a'))
        print 'Host created'
    else:
        print 'Host already exists'
    while not (host.get_status().state == 'up'):
        print 'host status: %s' % host.get_status().state
        time.sleep(1)
        host = api.hosts.get(id=host.id) # <--------------------------
    print 'host status: %s' % host.get_status().state
    return host

Actual results:
warning printed

Expected results:
no warnings printed

Additional info:
in worked ok in 3.6

Comment 1 Juan Hernández 2016-02-23 17:44:40 UTC
One of the changes that was done in the master branch of the Python SDK was the upgrade of the "generateDS.py" tool used to generate Python code from the XML schema, from 2.12a to 2.15b. One of the improvements of 2.15b is that it validates the values of enumerated types received from the server. In this particular case it is validating the values of the enumerated types used for statistics, and it is detecting that the values are lower case, instead of upper case, as described by the XML schema. This happens only when adding the host because the statistics are only reported in certain situations, like when adding the host, or when using the "All-Content: true" header.

Anyhow, the Python SDK for version 4 of the API is undergoing big changes, which will make this issue irrelevant (one of those changes is that we will stop using generateDS.py).

I suggest that you stop using the SDK from the master branch, and use instead the one from the 3.6 branch. The engine already supports versions 3 and 4 of the API, and the latest realease of the 3.6 SDK (3.6.3.0) automatically and explicitly selects version 3 of the API.


Note You need to log in before you can comment on or make changes to this bug.