Bug 1129998

Summary: numatune --mode can't work well
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: dyuan, jiahu, jmiao, juzhang, lhuang, mzhan, rbalakri, vivianzhang, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: libvirt-1.2.8-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:42:30 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 Luyao Huang 2014-08-14 06:49:21 UTC
description of problem:
 numatune --mode can't work well 

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


How reproducible:
100%

Steps to Reproduce:
1.prepare a guest with no numa set
# virsh dumpxml r7
<domain type='kvm'>
  <name>r7</name>
  <uuid>343cf2ee-2de1-4d0e-87de-15c697494f96</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>8</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <loader>/usr/share/seabios/bios.bin</loader>
    <boot dev='hd'/>
  </os>
  <features>

2.change NUMA mode (guest shut off)
# virsh numatune r7 --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

3.do it again
# virsh numatune r7 --mode 0

4.  # virsh dumpxml r7
<numatune>
    <memory mode='strict' </numatune>

5.# virsh start r7
error: Failed to start domain r7
error: (domain_definition):8: error parsing attribute name
    <memory mode='strict' </numatune>
--------------------------^



Actual results:
Can't change NUMA mode well now,
seems xml file miss placement


Expected results:
dumpxml like this:
<numatune>
    <memory mode='preferred' placement='auto'/>
  </numatune>


Additional info:

Comment 2 Erik Skultety 2014-08-25 06:58:51 UTC
Fixed upstream:

commit b9ff7393bca5df988e182b45ede34c636b0ae90d
Author: Erik Skultety <eskultet>
Date:   Fri Aug 22 16:05:37 2014 +0200

    numatune: setting --mode does not work well
    
    When trying to set numatune mode directly using virsh numatune command,
    correct error is raised, however numatune structure was not deallocated,
    thus resulting in creating an empty numatune element in the guest XML,
    if none was present before. Running the same command aftewards results
    in a successful change with broken XML structure. Patch fixes the
    deallocation problem as well as checking for invalid attribute
    combination VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO + a nonempty nodeset.
    
    Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1129998

v1.2.7-211-gb9ff739

Comment 4 zhengqin 2014-09-11 06:02:18 UTC
I could reproduce this issue with build libvirt-1.2.7-1.el7.x86_64 as bug steps mentioned.




Verify this issue with build libvirt-1.2.8-1.el7.x86_64:


Steps to Verify:
1. prepare a guest with no numa set
# virsh dumpxml r6
<domain type='kvm'>
  <name>r6</name>
  <uuid>63b566d4-40e9-4152-b784-f46cc953abb0</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static' current='1'>4</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <loader>/usr/share/seabios/bios.bin</loader>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>


2.change NUMA mode (guest shut off)
# virsh numatune r6 --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

3. Do it again:
[root@dhcp-66-71-72 ~]# virsh numatune r6 --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

4. Do it again:
[root@dhcp-66-71-72 ~]# virsh numatune r6 --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

5. Do it again:
[root@dhcp-66-71-72 ~]# virsh numatune r6 --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

6.  # virsh dumpxml r6 | grep memory
<memory unit='KiB'>1048576</memory>


7. Start the guest:
 # virsh start r6
Domain r6 started

 # virsh list
 Id    Name                           State
----------------------------------------------------
 29    r6                             running

Comment 5 vivian zhang 2014-11-28 08:54:21 UTC
I can produce this bug on build libvirt-1.1.1-29.el7.x86_64

verify this bug on build
libvirt-1.2.8-9.el7.x86_64


1. prepare a guest without numatune in shutoff
# virsh dumpxml rhel7new
<domain type='kvm'>
  <name>rhel7new</name>
  <uuid>e73cdb84-e02c-4bb3-939f-f76d8d3c140a</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <blkiotune>
    <device>
      <path>/dev/sda</path>
      <weight>90</weight>
    </device>
  </blkiotune>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>

2. run numatune command

# virsh numatune rhel7new --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

3. do it again and again
# virsh numatune rhel7new --mode 0
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

# virsh numatune rhel7new --mode strict
error: Unable to change numa parameters
error: unsupported configuration: nodeset for NUMA memory tuning must be set if 'placement' is 'static'

4.set with right config parameters
# virsh numatune rhel7new --mode strict --nodeset 0

[root@server ~]# virsh numatune rhel7new
numa_mode      : strict
numa_nodeset   : 0

[root@server ~]# virsh numatune rhel7new --mode strict --nodeset 1-2

[root@server ~]# virsh numatune rhel7new
numa_mode      : strict
numa_nodeset   : 1-2

[root@server ~]# virsh numatune rhel7new --mode 1 --nodeset 1-2

[root@server ~]# virsh numatune rhel7new
numa_mode      : preferred
numa_nodeset   : 1-2

[root@server ~]# virsh numatune rhel7new --mode 2 --nodeset 1-3

[root@server ~]# virsh numatune rhel7new
numa_mode      : interleave
numa_nodeset   : 1-3

[root@server ~]# virsh numatune rhel7new --mode 0 --nodeset 0

[root@server ~]# virsh numatune rhel7new
numa_mode      : strict
numa_nodeset   : 0

[root@server ~]# virsh start rhel7new
Domain rhel7new started

move to verified

Comment 7 errata-xmlrpc 2015-03-05 07:42: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://rhn.redhat.com/errata/RHSA-2015-0323.html