Bug 1047234 - virsh command numatune accept integer as mode type.
virsh command numatune accept integer as mode type.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
x86_64 Linux
medium Severity medium
: rc
: 7.0
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-29 21:19 EST by Hao Liu
Modified: 2014-06-17 21:01 EDT (History)
8 users (show)

See Also:
Fixed In Version: libvirt-1.1.1-18.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 08:49:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hao Liu 2013-12-29 21:19:29 EST
Description of problem:
virsh command numatune accept integer as mode type.

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

How reproducible:
100%

Steps to Reproduce:
With a shut-off vm test-vm,

1. Change NUMA mode using numatune and an integer <N> as mode type.
# virsh numatune test-vm --mode <N>

2. Check NUMA mode <mode>
# virsh numatune test-vm
numa_mode      : <mode>
numa_nodeset   : 

Actual Result:
<N> = 0: <mode> = strict
<N> = 1: <mode> = preferred
<N> = 2: <mode> = interleave
else: <mode> = (null)

Expected Result:
error: Invalid mode: <N>
Comment 2 Peter Krempa 2014-01-06 10:21:56 EST
Fixed upstream with:

commit 6e7490c734a538983f9c5ae680cdb36edbaffe65
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Mon Jan 6 14:26:14 2014 +0100

    qemu: range check numa memory placement mode
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1047234
    
    Add a range check for supported numa memory placement modes provided by
    the user before setting them in the domain definition. Without the check
    the user is able to provide a (yet) unknown mode which is then stored in
    the domain definition. This potentially causes a NULL dereference when
    the defintion is formatted into the XML.
    
    To reproduce run:
     virsh numatune DOMNAME --mode 6 --nodeset 0
    
    The XML will then contain:
      <numatune>
          <memory mode='(null)' nodeset='0'/>
      </numatune>
    
    With this fix, the command fails:
     error: Unable to change numa parameters
     error: invalid argument: unsupported numa_mode: '6'

commit 8b573a6b0d1ee9d99862104f28fee8bc7f949a9d
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Mon Jan 6 14:11:42 2014 +0100

    qemu: Clean up qemuDomainSetNumaParameters
    
    Add whitespace to separate logical code blocks, reformat error messages
    and clean up code flow.
    
    This patch changes error handling in some cases where the the loop would
    be continued to jump to cleanup instead and error out rather than modify
    the domain any further.
Comment 5 Hao Liu 2014-01-12 21:08:01 EST
This fix is VERIFIED on libvirt-1.1.1-18.el7.x86_64:

Verifying steps:
# virsh numatune test-vm
numa_mode      : strict
numa_nodeset   :


# virsh numatune test-vm --mode 0


# virsh numatune test-vm
numa_mode      : strict
numa_nodeset   : 


# virsh numatune test-vm --mode 1


# virsh numatune test-vm
numa_mode      : preferred
numa_nodeset   : 


# virsh numatune test-vm --mode 2


# virsh numatune test-vm
numa_mode      : interleave
numa_nodeset   : 


# virsh numatune test-vm --mode 3
error: Unable to change numa parameters
error: invalid argument: unsupported numa_mode: '3'


# virsh numatune test-vm
numa_mode      : interleave
numa_nodeset   : 


# virsh numatune test-vm --mode -1
error: Unable to change numa parameters
error: invalid argument: unsupported numa_mode: '-1'


# virsh numatune test-vm
numa_mode      : interleave
numa_nodeset   : 

numatune on longer permit unsupported numa modes. so it's VERIFIED.
Comment 6 zhengqin 2014-02-20 01:22:15 EST
Could reproduce it with above steps for libvirt-1.1.1-16.el7.x86_64.

Have fixed and verified libvirt-1.1.1-23.el7.x86_64:
# virsh numatune test-vm
numa_mode      : strict
numa_nodeset   :


# virsh numatune test-vm --mode 0


# virsh numatune test-vm
numa_mode      : strict
numa_nodeset   : 


# virsh numatune test-vm --mode 1


# virsh numatune test-vm
numa_mode      : preferred
numa_nodeset   : 


# virsh numatune test-vm --mode 2


# virsh numatune test-vm
numa_mode      : interleave
numa_nodeset   : 


# virsh numatune test-vm --mode 3
error: Unable to change numa parameters
error: invalid argument: unsupported numa_mode: '3'


# virsh numatune test-vm
numa_mode      : interleave
numa_nodeset   : 


# virsh numatune test-vm --mode -1
error: Unable to change numa parameters
error: invalid argument: unsupported numa_mode: '-1'


# virsh numatune test-vm
numa_mode      : interleave
numa_nodeset   :
Comment 7 Ludek Smid 2014-06-13 08:49:25 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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