Bug 1680546 - Cannot use setIOThreadParams() to set poll_shrink.
Summary: Cannot use setIOThreadParams() to set poll_shrink.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt-python
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.0
Assignee: Pavel Hrdina
QA Contact: lcheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-25 10:04 UTC by lcheng
Modified: 2020-11-14 05:08 UTC (History)
4 users (show)

Fixed In Version: libvirt-python-5.0.0-3.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-29 16:05:30 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:1293 0 None None None 2019-05-29 16:05:42 UTC

Description lcheng 2019-02-25 10:04:38 UTC
Description of problem:
Cannot use setIOThreadParams() to set poll_shrink.

Version-Release number of selected component (if applicable):
python3-libvirt-5.0.0-2.module+el8+2780+89be6baf.x86_64
libvirt-5.0.0-3.module+el8+2807+8bbe0a41.x86_64

How reproducible
100%

Steps to Reproduce:
# python
Python 3.6.8 (default, Jan 11 2019, 02:17:16)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> dom = conn.lookupByName('test')
>>> dom.addIOThread(200, 0)
0
>>> dom_stats = conn.domainListGetStats([dom], libvirt.VIR_DOMAIN_STATS_IOTHREAD, 0)
>>> dom_stats
[(<libvirt.virDomain object at 0x7f9dd15bb550>, {'iothread.count': 1, 'iothread.200.poll-max-ns': 32768, 'iothread.200.poll-grow': 0, 'iothread.200.poll-shrink': 0})]
>>> dom.setIOThreadParams(200, {'poll_shrink': 6}, 0)
libvirt:  error : invalid argument: invalid type 'ullong' for parameter 'poll_shrink', expected 'uint'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 2250, in setIOThreadParams
    if ret == -1: raise libvirtError ('virDomainSetIOThreadParams() failed', dom=self)
libvirt.libvirtError: invalid argument: invalid type 'ullong' for parameter 'poll_shrink', expected 'uint'
>>>

Actual results:
Set failed.

Expected results:
Set poll_shrink successful.

Additional info:
The type of poll_shrink in libvirt-python is different in libvirt.

Line 1687 in libvirt-python-5.0.0-2/libvirt-override.c.
static virPyTypedParamsHint virPyDomainSetIOThreadParams[] = {
    { VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, VIR_TYPED_PARAM_ULLONG },
    { VIR_DOMAIN_IOTHREAD_POLL_GROW, VIR_TYPED_PARAM_UINT },
    { VIR_DOMAIN_IOTHREAD_POLL_SHRINK, VIR_TYPED_PARAM_ULLONG },
};



Line 6156 in libvirt/src/qemu/qemu_driver.c.
6144qemuDomainIOThreadParseParams(virTypedParameterPtr params,
6145                              int nparams,
6146                              qemuMonitorIOThreadInfoPtr iothread)
...
6150    if (virTypedParamsValidate(params, nparams,
6151                               VIR_DOMAIN_IOTHREAD_POLL_MAX_NS,
6152                               VIR_TYPED_PARAM_ULLONG,
6153                               VIR_DOMAIN_IOTHREAD_POLL_GROW,
6154                               VIR_TYPED_PARAM_UINT,
6155                               VIR_DOMAIN_IOTHREAD_POLL_SHRINK,
6156                               VIR_TYPED_PARAM_UINT,
6157                               NULL) < 0)

Comment 1 Pavel Hrdina 2019-02-25 12:07:02 UTC
Upstream commit:

commit 878446e7f9fc1086b074d52c881e207021a11486
Author: Pavel Hrdina <phrdina>
Date:   Mon Feb 25 13:04:05 2019 +0100

    Fix virDomainPinIOThread typed params check

Comment 4 lcheng 2019-03-13 09:16:01 UTC
Verified on python3-libvirt-5.0.0-3.module+el8+2836+c71eecaf.x86_64. The result is expected. Move to VERIFIED.

# python
Python 3.6.8 (default, Jan 11 2019, 02:17:16) 
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> dom = conn.lookupByName('test')
>>> dom.addIOThread(200, 0)
0
>>> conn.domainListGetStats([dom], libvirt.VIR_DOMAIN_STATS_IOTHREAD, 0)
[(<libvirt.virDomain object at 0x7fe15db6a9b0>, {'iothread.count': 1, 'iothread.200.poll-max-ns': 32768, 'iothread.200.poll-grow': 0, 'iothread.200.poll-shrink': 0})]
>>> dom.setIOThreadParams(200, {'poll_shrink': 6}, 0)
0
>>> conn.domainListGetStats([dom], libvirt.VIR_DOMAIN_STATS_IOTHREAD, 0)
[(<libvirt.virDomain object at 0x7fe15da50208>, {'iothread.count': 1, 'iothread.200.poll-max-ns': 32768, 'iothread.200.poll-grow': 0, 'iothread.200.poll-shrink': 6})]

Comment 6 errata-xmlrpc 2019-05-29 16:05:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:1293


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