Bug 1186199

Summary: Per-node memory binding lost when 'auto' vcpu placement without <memory> placement
Product: Red Hat Enterprise Linux 7 Reporter: Jincheng Miao <jmiao>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, honzhang, lhuang, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 06:08:48 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 Jincheng Miao 2015-01-27 09:52:49 UTC
Description of problem:
when there is no numatune for memory, 'auto' placement vcpu will add 'auto' placement memory numatune automatically.
But user specified memnode for each guest NUMA node in numatune, when 'auto' placement vcpu without memory placement. The libvirtd will add memory placement to 'auto' and remove memnode.

Although this configuration doesn't align vcpus, but it should be valid.

Version-Release number of selected component (if applicable):
libvirt-1.2.8-15.el7.x86_64
qemu-kvm-rhev-2.1.2-21.el7.x86_64
3.10.0-223.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.  prepare guest xml
# cat dummy.xml
<domain type='qemu'>
  <name>dummy</name>
  <memory unit='KiB'>2097152</memory>
  <vcpu placement='auto'>4</vcpu>
  <numatune>
    <memnode cellid="0" mode="strict" nodeset="1"/>
    <memnode cellid="1" mode="preferred" nodeset="0"/>
  </numatune>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
  </os>
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='1048576'/>
      <cell id='1' cpus='2-3' memory='1048576'/>
    </numa>
  </cpu>
</domain>

# virsh define dummy.xml


2. then check xml, the <memnode> is lost
# virsh dumpxml dummy
<domain type='qemu'>
  <name>dummy</name>
  <uuid>1fd33000-27cb-425c-94f9-c7454914acdb</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='auto'>4</vcpu>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.1.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <cpu>
    <numa>
      <cell id='0' cpus='0-1' memory='1048576'/>
      <cell id='1' cpus='2-3' memory='1048576'/>
    </numa>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Expect result:
memnode is an other memory placement configuration, 'auto' vcpu placement should not remove it.

Comment 1 Peter Krempa 2015-03-04 13:43:23 UTC
Fixed upstream:

commit 638e3d270fc4b1ebeab0d139c2b4e54f590eb8b5
Author: Peter Krempa <pkrempa>
Date:   Thu Feb 12 16:04:45 2015 +0100

    conf: numa: Refactor logic in virDomainNumatuneParseXML
    
    Shuffling around the logic will allow to simplify the code quite a bit.
    As an additional bonus the change in the logic now reports an error if
    automatic placement is selected and individual placement is configured.

v1.2.12-174-g638e3d2

Comment 3 Luyao Huang 2015-05-19 03:43:44 UTC
I can reproduce this issue with libvirt-1.2.8-16.el7.x86_64:

1. add <memnode> in numatune settings:

# virsh edit test3 

...
  <vcpu placement='auto'>4</vcpu>
  <numatune>
    <memnode cellid="0" mode="strict" nodeset="1"/>
    <memnode cellid="1" mode="preferred" nodeset="0"/>
  </numatune>
...

2. recheck the xml:

# virsh dumpxml test3
...
  <vcpu placement='auto' current='1'>2</vcpu>
  <numatune>
    <memory mode='strict' placement='auto'/>
  </numatune>
...

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

1. try to add  <memnode> in numatune settings and set numa placement is auto:

# virsh edit test3

  <vcpu placement='auto'>4</vcpu>
  <numatune>
    <memnode cellid="0" mode="strict" nodeset="1"/>
    <memnode cellid="1" mode="preferred" nodeset="0"/>
  </numatune>

error: unsupported configuration: Per-node binding is not compatible with automatic NUMA placement.
Failed. Try again? [y,n,i,f,?]:

Comment 6 errata-xmlrpc 2015-11-19 06:08:48 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