RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1224587 - Improve error report for virsh allocpages command
Summary: Improve error report for virsh allocpages command
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-25 02:10 UTC by vivian zhang
Modified: 2015-11-19 06:39 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.17-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:39:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description vivian zhang 2015-05-25 02:10:00 UTC
Description:
For virsh allocpages command, using some negative values test, report error should be improved

Version-Release number of selected component (if applicable):
libvirt-1.2.15-2.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64
3.10.0-243.el7.x86_64


How reproducible:
100%

Steps:

1. check NUMA host virsh capabilities,two cells exist
# virsh capabilities |grep cell 
...
<cells num='2'>
        <cell id='0'>
          <memory unit='KiB'>67086628</memory>
          <pages unit='KiB' size='4'>16246345</pages>
          <pages unit='KiB' size='2048'>2</pages>
          <pages unit='KiB' size='1048576'>2</pages>
          <distances>
            <sibling id='0' value='10'/>
            <sibling id='1' value='11'/>
          </distances>
          <cpus num='8'>
            <cpu id='0' socket_id='0' core_id='1' siblings='0'/>
            <cpu id='1' socket_id='0' core_id='2' siblings='1'/>
            <cpu id='2' socket_id='0' core_id='8' siblings='2'/>
            <cpu id='3' socket_id='0' core_id='9' siblings='3'/>
            <cpu id='4' socket_id='0' core_id='16' siblings='4'/>
            <cpu id='5' socket_id='0' core_id='17' siblings='5'/>
            <cpu id='6' socket_id='0' core_id='18' siblings='6'/>
            <cpu id='7' socket_id='0' core_id='24' siblings='7'/>
          </cpus>
        </cell>
        <cell id='1'>
          <memory unit='KiB'>67108864</memory>
          <pages unit='KiB' size='4'>15996928</pages>
          <pages unit='KiB' size='2048'>500</pages>
          <pages unit='KiB' size='1048576'>2</pages>
          <distances>
            <sibling id='0' value='11'/>
            <sibling id='1' value='10'/>
          </distances>
          <cpus num='8'>
            <cpu id='8' socket_id='3' core_id='0' siblings='8'/>
            <cpu id='9' socket_id='3' core_id='1' siblings='9'/>
            <cpu id='10' socket_id='3' core_id='2' siblings='10'/>
            <cpu id='11' socket_id='3' core_id='8' siblings='11'/>
            <cpu id='12' socket_id='3' core_id='17' siblings='12'/>
            <cpu id='13' socket_id='3' core_id='18' siblings='13'/>
            <cpu id='14' socket_id='3' core_id='24' siblings='14'/>
            <cpu id='15' socket_id='3' core_id='25' siblings='15'/>
          </cpus>
        </cell>
      </cells>
...

2. allocate some pages for cell with positive values, command success
# virsh allocpages --pagesize 2048 --pagecount 5 --cellno 1

# virsh allocpages --pagesize 2048 --pagecount 4 --all

3. set cellno with negative value, for -1, no error report

# virsh allocpages --pagesize 2048 --pagecount 5 --cellno -1

# echo $?
0

3. set cellno with negative value, for -2 or others, error report, but it should be improved to show more clearly and reasonable

# virsh allocpages --pagesize 2048 --pagecount 5 --cellno -2
error: Failed to open file '/sys/devices/system/node/node-2/hugepages/hugepages-2048kB/nr_hugepages': No such file or directory

[root@ibm-x3850x5-04 ~]# echo $?
1

4. the same error as below should be improved also
# virsh allocpages --pagesize 2049 --pagecount 4   <---- pagesize 2049 not supported, but report error should be improved
error: Failed to open file '/sys/kernel/mm/hugepages/hugepages-2049kB/nr_hugepages': No such file or directory

# virsh allocpages --pagesize -1 --pagecount 4    
error: pagesize has to be a number
error: numerical overflow: value too large: 18446744073709551615


# virsh allocpages --pagesize 2048 --pagecount -1 --cellno 0
error: pagecount has to be a number


Actual result:
Report errors are not suitable

Expect result:
Report error for virsh allocpages should be improved more clearly

Comment 2 Michal Privoznik 2015-06-08 12:41:33 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2015-June/msg00310.html

Comment 3 Michal Privoznik 2015-06-10 15:47:59 UTC
Patch pushed upstream:

commit 1c24cfe9d8016f7561af7b295835f4d1973243b2
Author:     Michal Privoznik <mprivozn>
AuthorDate: Mon Jun 8 14:05:25 2015 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Wed Jun 10 17:27:16 2015 +0200

    virNumaSetPagePoolSize: Produce friendlier error message
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1224587
    
    The function takes two important arguments (among many others): @node
    and @page_size. From these two a path under /sys is constructed. The
    path is then used to read and write the desired size of huge pages
    pool. However, if the path does not exists due to either @node or
    @page_size having nonexistent value (e.g. there's no such NUMA node or
    no page size like -2), an cryptic error message is produced:
    
      virsh # allocpages --pagesize 2049 --pagecount 8 --cellno -2
      error: Failed to open file '/sys/devices/system/node/node-2/hugepages/hugepages-2049kB/nr_hugepages': No such file or directory
    
    Add two more checks to catch this and therefore produce much more
    friendlier error messages.
    
    Signed-off-by: Michal Privoznik <mprivozn>

v1.2.16-122-g1c24cfe

Comment 5 Luyao Huang 2015-07-13 09:11:53 UTC
I can reproduce this issue with libvirt-1.2.15-2.el7.x86_64:

1.
# virsh allocpages --cellno -2 --pagesize 2048 --pagecount 1
error: Failed to open file '/sys/devices/system/node/node-2/hugepages/hugepages-2048kB/nr_hugepages': No such file or directory

2.
# virsh allocpages --cellno 0 --pagesize 2049 --pagecount 1
error: Failed to open file '/sys/devices/system/node/node0/hugepages/hugepages-2049kB/nr_hugepages': No such file or directory

3.
# virsh allocpages --cellno 0 --pagesize -1 --pagecount 1
error: pagesize has to be a number
error: numerical overflow: value too large: 18446744073709551615

4.
# virsh allocpages --cellno 0 --pagesize 2048 --pagecount -1
error: pagecount has to be a number


And verify this bug with libvirt-1.2.17-2.el7.x86_64:

1. 
# virsh allocpages --cellno -2 --pagesize 2048 --pagecount 1
error: operation failed: NUMA node -2 is not available

2.
# virsh allocpages --cellno 0 --pagesize 2049 --pagecount 1
error: operation failed: page size or NUMA node not available

3.
# virsh allocpages --cellno 0 --pagesize -1 --pagecount 1
error: Numeric value '-1' for <pagesize> option is malformed or out of range

4.
# virsh allocpages --cellno 0 --pagesize 2048 --pagecount -1
error: Numeric value '-1' for <pagecount> option is malformed or out of range

Comment 8 errata-xmlrpc 2015-11-19 06:39:03 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://rhn.redhat.com/errata/RHBA-2015-2202.html


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