From: Michal Privoznik Date: Thu, 12 Jun 2014 09:14:20 +0000 (+0200) Subject: virNodeDevCapPCIDevParseXML: Initialize numa_node variable X-Git-Tag: v1.2.6-rc1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bab45585473628e9353ed3dca0869ae376714fb5;p=thirdparty%2Flibvirt.git virNodeDevCapPCIDevParseXML: Initialize numa_node variable With one of my recent patches (1c70277) libvirt's capable of reporting NUMA node locality for PCI devices. The node ID is stored in pci_dev.numa_node variable. However, since zero is valid NUMA node ID, the default is -1 as it is in kernel too. So, if the PCI device is not tied to any specific NUMA node, the default is then NOT printed into XML. Therefore, when parsing node device XML, the element is optional. But currently, if it's not there, we must set sane default, otherwise after parsing in the memory representation doesn't match the XML. We are already doing this in other place: udevProcessPCI(). Signed-off-by: Michal Privoznik --- diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 6153aa17c1..12e40e66ff 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1145,6 +1145,8 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt, } } + /* The default value is -1 since zero is valid NUMA node number */ + data->pci_dev.numa_node = -1; if (virNodeDevCapsDefParseIntOptional("number(./numa[1]/@node)", ctxt, &data->pci_dev.numa_node, def, _("invalid NUMA node ID supplied for '%s'")) < 0)