Bug 1754466

Summary: Can't set parameter 'parallel.connections'
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: lcheng
Component: libvirt-pythonAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: lcheng
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: jdenemar, jsuchane, mtessun, phrdina, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-python-5.6.0-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-06 07:19:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lcheng 2019-09-23 10:54:31 UTC
Description of problem:
Can't set parameter 'parallel.connections'.

Version-Release number of selected component (if applicable):
python3-libvirt-5.6.0-1.module+el8.1.0+3891+3b51c436.x86_64

How reproducible:
100%

Steps to Reproduce:
# python
Python 3.6.8 (default, Aug 29 2019, 22:00:26) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> dconn = libvirt.open("qemu+ssh://10.73.73.57/system")
>>> dom = conn.lookupByName('test')
>>> dom.migrateSetMaxSpeed(1, 0)
0
>>> params_list = {'parallel.connections': 5}
>>> flags = libvirt.VIR_MIGRATE_LIVE | libvirt.VIR_MIGRATE_PARALLEL
>>> dom.migrate3(dconn, params_list, flags)
libvirt:  error : invalid argument: invalid type 'ullong' for parameter 'parallel.connections', expected 'int'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1670, in migrate3
    if ret is None:raise libvirtError('virDomainMigrate3() failed', dom=self)
libvirt.libvirtError: invalid argument: invalid type 'ullong' for parameter 'parallel.connections', expected 'int'


Actual results:
As description

Expected results:
Can set parameter 'parallel.connections' and migration succeeds.

Comment 1 Pavel Hrdina 2019-09-23 10:58:41 UTC
Flag VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY accidentally works but is also missing from the list of hints in libvirt-python implementation.

Comment 2 Pavel Hrdina 2019-09-24 07:38:12 UTC
Upstream commits:

commit ebd352515d75036bc1dd2018669c3a5efb5bcf3d
Author: Pavel Hrdina <phrdina>
Date:   Mon Sep 23 12:59:18 2019 +0200

    virDomainMigrate3Params: add missing parallel connections param

commit 1c206858313619672d6eebd3989be13cc8281d26
Author: Pavel Hrdina <phrdina>
Date:   Mon Sep 23 12:53:01 2019 +0200

    virDomainMigrate3Params: add missing bandwidth postcopy param

Comment 8 lcheng 2019-09-26 07:34:24 UTC
Verify with python3-libvirt-5.6.0-2.module+el8.1.0+4286+bc7b622c.x86_64.  

1. Set parallel connections number and using 'netstat -tunapc | grep 4915 | grep ESTABLISHED' command to check. 
# python
Python 3.6.8 (default, Aug 29 2019, 22:00:26) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> dom = conn.lookupByName('test')
>>> dom.migrateSetMaxSpeed(100, 0)
0
>>> dconn = libvirt.open("qemu+ssh://10.16.216.141/system")
>>> dom.migrate3(dconn, {'parallel.connections': 5}, flags)    <== Migration succeeds and using 'netstat' to get connections number is 6
<libvirt.virDomain object at 0x7efd23fd74a8>

>>> dom.migrate3(dconn, {}, flags)    <== Migration succeeds and using 'netstat' to get connections number is 3
<libvirt.virDomain object at 0x7efd2413e0b8>

>>> dom.migrate3(dconn, {'parallel.connections': -1}, flags)    <== Migration succeeds and using 'netstat' to get connections number is 256
<libvirt.virDomain object at 0x7efd2413e0b8>

>>> dom.migrate3(dconn, {'parallel.connections': 255}, flags)    <== Migration succeeds and using 'netstat' to get connections number is 256
<libvirt.virDomain object at 0x7efd24802828>


2. Some negative tests.
>>> dom.migrate3(dconn, {'parallel.connections': 256}, flags)
libvirt: QEMU Driver error : internal error: unable to execute QEMU command 'migrate-set-parameters': Parameter 'multifd_channels' expects is invalid, it should be in the range of 1 to 255
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1670, in migrate3
    if ret is None:raise libvirtError('virDomainMigrate3() failed', dom=self)
libvirt.libvirtError: internal error: unable to execute QEMU command 'migrate-set-parameters': Parameter 'multifd_channels' expects is invalid, it should be in the range of 1 to 255

>>> dom.migrate3(dconn, {'parallel.connections': 0}, flags)
libvirt: QEMU Driver error : internal error: unable to execute QEMU command 'migrate-set-parameters': Parameter 'multifd_channels' expects is invalid, it should be in the range of 1 to 255
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1670, in migrate3
    if ret is None:raise libvirtError('virDomainMigrate3() failed', dom=self)
libvirt.libvirtError: internal error: unable to execute QEMU command 'migrate-set-parameters': Parameter 'multifd_channels' expects is invalid, it should be in the range of 1 to 255

>>> dom.migrate3(dconn, "{'parallel.connections': 5}", flags)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1669, in migrate3
    ret = libvirtmod.virDomainMigrate3(self._o, dconn__o, params, flags)
TypeError: migration params must be a dictionary

>>> dom.migrate3(dconn, None, flags)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/libvirt.py", line 1669, in migrate3
    ret = libvirtmod.virDomainMigrate3(self._o, dconn__o, params, flags)
TypeError: migration params must be a dictionary

Comment 9 lcheng 2019-09-26 07:47:30 UTC
Add a missing parameter for test steps.

>>> flags = libvirt.VIR_MIGRATE_LIVE | libvirt.VIR_MIGRATE_PARALLEL

Comment 10 lcheng 2019-09-26 08:44:40 UTC
Add test steps for 'bandwidth.postcopy' with python3-libvirt-5.6.0-2.module+el8.1.0+4286+bc7b622c.x86_64.

1. Start migration with 'bandwidth.postcopy' parameter. 
# python
Python 3.6.8 (default, Aug 29 2019, 22:00:26) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> dom = conn.lookupByName('test')
>>> dconn = libvirt.open("qemu+ssh://10.16.216.141/system")
>>> flags = libvirt.VIR_MIGRATE_LIVE | libvirt.VIR_MIGRATE_POSTCOPY
>>> dom.migrate3(dconn, {"bandwidth.postcopy": 4}, flags)    <== Migration succeeds.
<libvirt.virDomain object at 0x7efd24802828>

2. On other terminal, switch to postcopy mode and check migration maximum speed.
# python
Python 3.6.8 (default, Aug 29 2019, 22:00:26) 
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open()
>>> dom = conn.lookupByName('test')
>>> dom.migrateStartPostCopy(0)
0
>>> dom.migrateGetMaxSpeed(libvirt.VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY) 
4

Comment 12 errata-xmlrpc 2019-11-06 07:19:36 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:3723