mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
cpu_conf: Allow specification of 'units' for @memory on numa nodes.
CPU numa topology implicitly allows memory specification in 'KiB'. Enabling this to accept the 'unit' in which memory needs to be specified. This now allows users to specify memory in units of choice, and lists the same in 'KiB' -- just like other 'memory' elements in XML. <numa> <cell cpus='0-3' memory='1024' unit='MiB' /> <cell cpus='4-7' memory='1024' unit='MiB' /> </numa> Also augment test cases to correctly model NUMA memory specification. This adds the tag 'unit="KiB"' for memory attribute in NUMA cells. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
ae5ecd76f1
commit
e3c44f0d36
@ -1153,8 +1153,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
...
|
...
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0-3' memory='512000'/>
|
<cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
|
||||||
<cell id='1' cpus='4-7' memory='512000' memAccess='shared'/>
|
<cell id='1' cpus='4-7' memory='512000' unit='KiB' memAccess='shared'/>
|
||||||
</numa>
|
</numa>
|
||||||
...
|
...
|
||||||
</cpu>
|
</cpu>
|
||||||
@ -1165,6 +1165,9 @@
|
|||||||
<code>cpus</code> specifies the CPU or range of CPUs that are
|
<code>cpus</code> specifies the CPU or range of CPUs that are
|
||||||
part of the node. <code>memory</code> specifies the node memory
|
part of the node. <code>memory</code> specifies the node memory
|
||||||
in kibibytes (i.e. blocks of 1024 bytes).
|
in kibibytes (i.e. blocks of 1024 bytes).
|
||||||
|
<span class="since">Since 1.2.11</span> one can use an additional <a
|
||||||
|
href="#elementsMemoryAllocation"><code>unit</code></a> attribute to
|
||||||
|
define units in which <code>memory</code> is specified.
|
||||||
<span class="since">Since 1.2.7</span> all cells should
|
<span class="since">Since 1.2.7</span> all cells should
|
||||||
have <code>id</code> attribute in case referring to some cell is
|
have <code>id</code> attribute in case referring to some cell is
|
||||||
necessary in the code, otherwise the cells are
|
necessary in the code, otherwise the cells are
|
||||||
|
@ -4143,6 +4143,11 @@
|
|||||||
<attribute name="memory">
|
<attribute name="memory">
|
||||||
<ref name="memoryKB"/>
|
<ref name="memoryKB"/>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<optional>
|
||||||
|
<attribute name="unit">
|
||||||
|
<ref name="unit"/>
|
||||||
|
</attribute>
|
||||||
|
</optional>
|
||||||
<optional>
|
<optional>
|
||||||
<attribute name="memAccess">
|
<attribute name="memAccess">
|
||||||
<choice>
|
<choice>
|
||||||
|
@ -184,6 +184,7 @@ virCPUDefParseXML(xmlNodePtr node,
|
|||||||
{
|
{
|
||||||
virCPUDefPtr def;
|
virCPUDefPtr def;
|
||||||
xmlNodePtr *nodes = NULL;
|
xmlNodePtr *nodes = NULL;
|
||||||
|
xmlNodePtr oldnode = ctxt->node;
|
||||||
int n;
|
int n;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *cpuMode;
|
char *cpuMode;
|
||||||
@ -440,7 +441,7 @@ virCPUDefParseXML(xmlNodePtr node,
|
|||||||
def->ncells = n;
|
def->ncells = n;
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
char *cpus, *memory, *memAccessStr;
|
char *cpus, *memAccessStr;
|
||||||
int ret, ncpus = 0;
|
int ret, ncpus = 0;
|
||||||
unsigned int cur_cell;
|
unsigned int cur_cell;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
@ -489,21 +490,10 @@ virCPUDefParseXML(xmlNodePtr node,
|
|||||||
goto error;
|
goto error;
|
||||||
def->cells_cpus += ncpus;
|
def->cells_cpus += ncpus;
|
||||||
|
|
||||||
memory = virXMLPropString(nodes[i], "memory");
|
ctxt->node = nodes[i];
|
||||||
if (!memory) {
|
if (virDomainParseMemory("./@memory", "./@unit", ctxt,
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
&def->cells[cur_cell].mem, true, false) < 0)
|
||||||
_("Missing 'memory' attribute in NUMA cell"));
|
goto cleanup;
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem);
|
|
||||||
if (ret == -1) {
|
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
||||||
_("Invalid 'memory' attribute in NUMA cell"));
|
|
||||||
VIR_FREE(memory);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
VIR_FREE(memory);
|
|
||||||
|
|
||||||
memAccessStr = virXMLPropString(nodes[i], "memAccess");
|
memAccessStr = virXMLPropString(nodes[i], "memAccess");
|
||||||
if (memAccessStr) {
|
if (memAccessStr) {
|
||||||
@ -526,6 +516,7 @@ virCPUDefParseXML(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
ctxt->node = oldnode;
|
||||||
VIR_FREE(fallback);
|
VIR_FREE(fallback);
|
||||||
VIR_FREE(vendor_id);
|
VIR_FREE(vendor_id);
|
||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
@ -704,6 +695,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|||||||
virBufferAsprintf(buf, " id='%zu'", i);
|
virBufferAsprintf(buf, " id='%zu'", i);
|
||||||
virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
|
virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
|
||||||
virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem);
|
virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem);
|
||||||
|
virBufferAddLit(buf, " unit='KiB'");
|
||||||
if (memAccess)
|
if (memAccess)
|
||||||
virBufferAsprintf(buf, " memAccess='%s'",
|
virBufferAsprintf(buf, " memAccess='%s'",
|
||||||
virMemAccessTypeToString(memAccess));
|
virMemAccessTypeToString(memAccess));
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0-3,8-11' memory='109550'/>
|
<cell id='0' cpus='0-3,8-11' memory='109550' unit='KiB'/>
|
||||||
<cell id='1' cpus='4-7,12-15' memory='109550'/>
|
<cell id='1' cpus='4-7,12-15' memory='109550' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0-7' memory='109550' memAccess='shared'/>
|
<cell id='0' cpus='0-7' memory='109550' unit='KiB' memAccess='shared'/>
|
||||||
<cell id='1' cpus='8-15' memory='109550' memAccess='private'/>
|
<cell id='1' cpus='8-15' memory='109550' unit='KiB' memAccess='private'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell cpus='0-7' memory='109550'/>
|
<cell cpus='0-7' memory='109550' unit='KiB'/>
|
||||||
<cell cpus='8-15' memory='109550'/>
|
<cell cpus='8-15' memory='109550' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='1' cpus='8-15' memory='109550'/>
|
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
|
||||||
<cell id='0' cpus='0-7' memory='109550'/>
|
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='1' cpus='0-7' memory='109550'/>
|
<cell id='1' cpus='0-7' memory='109550' unit='KiB'/>
|
||||||
<cell id='2' cpus='8-15' memory='109550'/>
|
<cell id='2' cpus='8-15' memory='109550' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='1048576'/>
|
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='1048576'/>
|
<cell id='1' cpus='1' memory='1048576' unit='KiB'/>
|
||||||
<cell id='2' cpus='2' memory='1048576'/>
|
<cell id='2' cpus='2' memory='1048576' unit='KiB'/>
|
||||||
<cell id='3' cpus='3' memory='1048576'/>
|
<cell id='3' cpus='3' memory='1048576' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='262144'/>
|
<cell id='0' cpus='0' memory='262144' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='786432'/>
|
<cell id='1' cpus='1' memory='786432' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='262144'/>
|
<cell id='0' cpus='0' memory='262144' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='786432'/>
|
<cell id='1' cpus='1' memory='786432' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='1048576'/>
|
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='1048576'/>
|
<cell id='1' cpus='1' memory='1048576' unit='KiB'/>
|
||||||
<cell id='2' cpus='2' memory='1048576'/>
|
<cell id='2' cpus='2' memory='1048576' unit='KiB'/>
|
||||||
<cell id='3' cpus='3' memory='1048576'/>
|
<cell id='3' cpus='3' memory='1048576' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='1048576'/>
|
<cell id='0' cpus='0' memory='1048576' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='1048576' memAccess='shared'/>
|
<cell id='1' cpus='1' memory='1048576' unit='KiB' memAccess='shared'/>
|
||||||
<cell id='2' cpus='2' memory='1048576' memAccess='private'/>
|
<cell id='2' cpus='2' memory='1048576' unit='KiB' memAccess='private'/>
|
||||||
<cell id='3' cpus='3' memory='1048576'/>
|
<cell id='3' cpus='3' memory='1048576' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='65536'/>
|
<cell id='0' cpus='0' memory='65536' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='32768'/>
|
<cell id='0' cpus='0' memory='32768' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='32768'/>
|
<cell id='1' cpus='1' memory='32768' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='20002'/>
|
<cell id='0' cpus='0' memory='20002' unit='KiB'/>
|
||||||
<cell id='1' cpus='1-27,29' memory='660066'/>
|
<cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/>
|
||||||
<cell id='2' cpus='28-31,^29' memory='24002400'/>
|
<cell id='2' cpus='28-31,^29' memory='24002400' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='32768'/>
|
<cell id='0' cpus='0' memory='32768' unit='KiB'/>
|
||||||
<cell id='1' cpus='1' memory='32768'/>
|
<cell id='1' cpus='1' memory='32768' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0-7' memory='109550'/>
|
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
|
||||||
<cell id='1' cpus='8-15' memory='109550'/>
|
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
<cpu>
|
<cpu>
|
||||||
<topology sockets='2' cores='4' threads='2'/>
|
<topology sockets='2' cores='4' threads='2'/>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0-7' memory='109550'/>
|
<cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
|
||||||
<cell id='1' cpus='8-15' memory='109550'/>
|
<cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='65536'/>
|
<cell id='0' cpus='0' memory='65536' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
</os>
|
</os>
|
||||||
<cpu>
|
<cpu>
|
||||||
<numa>
|
<numa>
|
||||||
<cell id='0' cpus='0' memory='20002'/>
|
<cell id='0' cpus='0' memory='20002' unit='KiB'/>
|
||||||
<cell id='1' cpus='1-27,29' memory='660066'/>
|
<cell id='1' cpus='1-27,29' memory='660066' unit='KiB'/>
|
||||||
<cell id='2' cpus='28-31,^29' memory='24002400'/>
|
<cell id='2' cpus='28-31,^29' memory='24002400' unit='KiB'/>
|
||||||
</numa>
|
</numa>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset='utc'/>
|
<clock offset='utc'/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user