Bug 1356769

Summary: The integers in output of some virt-admin commands should not be signed
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Lili Zhu <lizhu>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: dyuan, jdenemar, lizhu, mzhan, rbalakri, xuzhang, yafu, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-2.5.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 17:11:42 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 Fangge Jin 2016-07-15 02:35:57 UTC
Description of problem:
Some virt-admin commands outputs negative values when the variable is more than 2147483647(2^31-1). See the steps.

Version-Release number of selected component (if applicable):
libvirt-2.0.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
# virt-admin srv-threadpool-set libvirtd --max-workers  2147483648

# virt-admin srv-threadpool-info libvirtd
minWorkers     : 5
maxWorkers     : -2147483648  ===> should be 2147483648
nWorkers       : 5
freeWorkers    : 5
prioWorkers    : 50
jobQueueDepth  : 0

2.
# virt-admin srv-clients-set libvirtd --max-clients 2147483649

# virt-admin srv-clients-info libvirtd
nclients_max        : -2147483647  ===> should be 2147483649
nclients            : 0
nclients_unauth_max : 30
nclients_unauth     : 0


Actual results:
As steps

Expected results:
As steps

Comment 2 Erik Skultety 2016-07-26 07:44:17 UTC
Fixed upstream by:

commit a8962f705d5b7973e322b81c38e46eb542cb1ad4
Author:     Erik Skultety <eskultet>
AuthorDate: Mon Jul 18 10:45:17 2016 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Tue Jul 19 13:27:45 2016 +0200

    virt-admin: Output srv-threadpool-info data as unsigned int rather than signed
    
    Internally, all the data are represented as unsigned int, it is also documented
    in the header file that users should use our exported constants that also
    indicate that the data should be unsigned int. However, when polling for the
    current server threadpool's configuration, virt-admin uses an incorrect
    formatting parameter '%d' for printf. Instead, virt-admin should use formatting
    parameter '%u'.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1356769
    
    Signed-off-by: Erik Skultety <eskultet>

v2.0.0-195-ga8962f7

Comment 5 Lili Zhu 2016-09-04 11:16:08 UTC
srv-clients-set still does not work well for libvirt-2.0.0-6.el7.x86_64

# virt-admin srv-clients-set libvirtd --max-clients 2147483649

# virt-admin srv-clients-info libvirtd
nclients_max        : -2147483647  ===> should be 2147483649
nclients            : 1
nclients_unauth_max : 20
nclients_unauth     : 0

Comment 7 Erik Skultety 2016-09-07 12:25:33 UTC
Fixed upstream (this time for good) by:

commit e2c63714a87696e820313d50e005a6b9e53bad19
Author:     Erik Skultety <eskultet>
AuthorDate: Mon Sep 5 13:51:21 2016 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Wed Sep 7 14:07:18 2016 +0200

    virt-admin: Output srv-clients-set data as unsigned int rather than signed
    
    Unfortunately, commit a8962f70 only fixed first half of the reported issue of
    virt-admin outputting negative values where unsigned int is expected by
    BZ below, so this commit represents the other missing half of the fix.
    
    resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1356769
    
    Signed-off-by: Erik Skultety <eskultet>

v2.2.0-38-ge2c6371

Comment 10 Lili Zhu 2017-06-12 04:56:19 UTC
Reproduce the bug with libvirt-2.0.0-2.el7.x86_64

Steps to reproduce
#  virt-admin srv-threadpool-set libvirtd --max-workers  2147483648

# virt-admin srv-threadpool-info libvirtd
minWorkers     : 5
maxWorkers     : -2147483648
nWorkers       : 5
freeWorkers    : 5
prioWorkers    : 5
jobQueueDepth  : 0


# virt-admin srv-clients-set libvirtd --max-clients 2147483649

#  virt-admin srv-clients-info libvirtd
nclients_max        : -2147483647
nclients            : 0
nclients_unauth_max : 20
nclients_unauth     : 0


Verify the bug with libvirt-3.2.0-9.el7.x86_64
# virt-admin server-threadpool-set libvirtd --max-workers  2147483648

# virt-admin server-threadpool-info libvirtd
minWorkers     : 5
maxWorkers     : 2147483648
nWorkers       : 5
freeWorkers    : 5
prioWorkers    : 5
jobQueueDepth  : 0

# virt-admin server-clients-set libvirtd --max-clients  2147483648

# virt-admin server-clients-info libvirtd
nclients_max        : 2147483648
nclients            : 0
nclients_unauth_max : 20
nclients_unauth     : 0

As the result matches the expectation, mark it as verified

Comment 11 errata-xmlrpc 2017-08-01 17:11:42 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/RHEA-2017:1846

Comment 12 errata-xmlrpc 2017-08-01 23:53:19 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/RHEA-2017:1846