Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
=======================
When trying to edit the <cpu> field in the domain xml using virsh edit, I get the following error:
[root@rhos-compute-node-10 ~]# virsh edit rhel71
error: XML error: Missing 'memory' attribute in NUMA cell
Failed. Try again? [y,n,f,?]:
I edited the <cpu> field like this:
<cpu mode='host-passthrough'>
<numa>
<cell id='0' cpus='0,1'/>
<cell id='1' cpus='2,3'/>
</numa>
</cpu>
However, this should be allowable on this libvirt version:
[root@rhos-compute-node-10 ~]# rpm -qa | grep libvirt
libvirt-daemon-config-network-1.2.8-16.el7_1.2.x86_64
libvirt-client-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-storage-1.2.8-16.el7_1.2.x86_64
libvirt-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-nodedev-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-kvm-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-config-nwfilter-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-nwfilter-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-interface-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-qemu-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-lxc-1.2.8-16.el7_1.2.x86_64
libvirt-python-1.2.8-7.el7_1.1.x86_64
libvirt-daemon-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-network-1.2.8-16.el7_1.2.x86_64
libvirt-daemon-driver-secret-1.2.8-16.el7_1.2.x86_64
Version-Release number of selected component:
=============================================
1.2.8-16_1.2
How reproducible
================
Always
Steps to Reproduce:
===================
1. Create a VM
2. virsh edit instance-name
3. In the editor, make the <cpu> field look like this (assuming 4 vcpus and 2 NUMA nodes):
<cpu mode='host-passthrough'>
<numa>
<cell id='0' cpus='0,1'/>
<cell id='1' cpus='2,3'/>
</numa>
</cpu>
Actual results
==============
error: XML error: Missing 'memory' attribute in NUMA cell
Failed. Try again? [y,n,f,?]:
Selecting 'f' will not force, and the <cpu> looks like this still:
<cpu mode='host-passthrough'>
</cpu>
Expected results
================
The domain xml should be written out with numa cells not having a 'memory' attribute specified.
Additional info
===============
When you are going to enable a NUMA topology you need to specify the memory for each NUMA cell since that can't be inferred from the total memory size in a sane way.
As of the 'f' key in "virsh edit". The force option tries to define the XML again. Since it's invalid it will fail since the parser can't be forced to accept an invalid XML.
Closing as NOTABUG, the memory attribute for the <cell> element is mandatory.
The XML given was slightly misleading as to the problem - what Sean was actually trying todo was to create 2 numa nodes, one of which has all the RAM and the other which has no RAM.
eg
<numa>
<cell id='0' cpus='0,1' memory='131072' unit='KiB'/>
<cell id='1' cpus='2,3'/>
</numa>
Of course nothing is actually preventing use of memory='0', so this can in fact be achieved.
<numa>
<cell id='0' cpus='0,1' memory='131072' unit='KiB'/>
<cell id='1' cpus='2,3' memory='0' unit='KiB'/>
</numa>
I'm actually re-opening this as I think we should address it.
In the capabilities XML, if you have a node we no memory, libvirt leaves out the memory='0' attribute. Given this, I think that in the guest XML, if a NUMA node has no memory= attribute, it should be treated the same as if it had memory='0'.
There is a corresponding problem with CPUs. it is impossible to leave out the 'cpus=' attribute in the domain XML, and you also cannot set it to the empty string, as libvirt complains it cannot parse the bitmap.
Essentially, we should be free to create NUMA nodes which have zero CPUs, or zero memory, and libvirt is preventing that entirely for CPUs and unnecessarily mandating memory= attribute.
I've posted a patch [1] that adds syntax sugar to allow specifying 0 memory for a numa node by omitting 'memory' attribute. Unfortunately while qemu accepts the command line (with or without the patch) the resulting NUMA topology from guest's point of view is broken. I'll clone this bug later so that that issue can be fixed.
Until that is fixed it doesn't really make much sense to push that patch.
CPU-less NUMA nodes are now possible:
Libvirt now allows to hotplug or hotunplug individual vcpus. Together with the ability to configure them in the XML ( http://libvirt.org/formatdomain.html#elementsCPUAllocation ) this should provide features requested by this BZ:
commit bd8f10c62aa4d0fa09bf74bc5f337a3a28b0d694
Author: Peter Krempa <pkrempa>
Date: Fri Feb 10 17:14:22 2017 +0100
test: qemuhotplugtest: Add testing of individual vcpu hotplug
Test that the vcpu entity selection code works properly
commit f557b3351e0b6dee07b434ef65c81887c243d406
Author: Peter Krempa <pkrempa>
Date: Tue Jun 21 17:17:41 2016 +0200
qemu: Implement individual vcpu hotplug API
Add code that validates user's selection of cores and then uses the
existing code to plug in the vCPU.
commit f0326d6dd921a9b30437c0bc1f4aa98ec5a31272
Author: Peter Krempa <pkrempa>
Date: Tue Jun 21 10:55:30 2016 +0200
virsh: Implement command for virDomainSetVcpu called setvcpu
Add a simple virsh command handler which makes use of the new API.
commit 8f657259bb9c8310b1f232249174f06f30089755
Author: Peter Krempa <pkrempa>
Date: Tue Jun 21 10:44:51 2016 +0200
lib: Add API for specific vCPU hot(un)plug
Similarly to domainSetGuestVcpus this commit adds API which allows to
modify state of individual vcpus rather than just setting the count.
This allows to enable CPUs in specific guest NUMA nodes to achieve any
necessary configuration.
[1] https://www.redhat.com/archives/libvir-list/2017-February/msg01087.html
Comment 9Jaroslav Suchanek
2019-04-24 12:29:08 UTC
This bug is going to be addressed in next major release within existing cloned bug.
Description of problem: ======================= When trying to edit the <cpu> field in the domain xml using virsh edit, I get the following error: [root@rhos-compute-node-10 ~]# virsh edit rhel71 error: XML error: Missing 'memory' attribute in NUMA cell Failed. Try again? [y,n,f,?]: I edited the <cpu> field like this: <cpu mode='host-passthrough'> <numa> <cell id='0' cpus='0,1'/> <cell id='1' cpus='2,3'/> </numa> </cpu> However, this should be allowable on this libvirt version: [root@rhos-compute-node-10 ~]# rpm -qa | grep libvirt libvirt-daemon-config-network-1.2.8-16.el7_1.2.x86_64 libvirt-client-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-storage-1.2.8-16.el7_1.2.x86_64 libvirt-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-nodedev-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-kvm-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-config-nwfilter-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-nwfilter-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-interface-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-qemu-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-lxc-1.2.8-16.el7_1.2.x86_64 libvirt-python-1.2.8-7.el7_1.1.x86_64 libvirt-daemon-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-network-1.2.8-16.el7_1.2.x86_64 libvirt-daemon-driver-secret-1.2.8-16.el7_1.2.x86_64 Version-Release number of selected component: ============================================= 1.2.8-16_1.2 How reproducible ================ Always Steps to Reproduce: =================== 1. Create a VM 2. virsh edit instance-name 3. In the editor, make the <cpu> field look like this (assuming 4 vcpus and 2 NUMA nodes): <cpu mode='host-passthrough'> <numa> <cell id='0' cpus='0,1'/> <cell id='1' cpus='2,3'/> </numa> </cpu> Actual results ============== error: XML error: Missing 'memory' attribute in NUMA cell Failed. Try again? [y,n,f,?]: Selecting 'f' will not force, and the <cpu> looks like this still: <cpu mode='host-passthrough'> </cpu> Expected results ================ The domain xml should be written out with numa cells not having a 'memory' attribute specified. Additional info ===============