diff --git a/tests/data/cli/compare/virt-install-singleton-config-2.xml b/tests/data/cli/compare/virt-install-singleton-config-2.xml
index 121ffa41e..c5a61a1e4 100644
--- a/tests/data/cli/compare/virt-install-singleton-config-2.xml
+++ b/tests/data/cli/compare/virt-install-singleton-config-2.xml
@@ -153,7 +153,12 @@
- |
+
+
+
+
+
+ |
@@ -426,7 +431,12 @@
- |
+
+
+
+
+
+ |
diff --git a/tests/test_cli.py b/tests/test_cli.py
index c58a9ebed..d2cb44079 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -513,6 +513,8 @@ numa.cell2.id=2,numa.cell2.memory=256,numa.cell2.unit=KiB,numa.cell2.cpus=4,numa
cell0.distances.sibling0.id=0,cell0.distances.sibling0.value=10,\
cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
numa.cell1.distances.sibling0.id=0,numa.cell1.distances.sibling0.value=21,\
+numa.cell2.cache0.level=1,numa.cell2.cache0.associativity=direct,numa.cell2.cache0.policy=writeback,\
+numa.cell2.cache0.size.value=256,numa.cell2.cache0.size.unit=KiB,numa.cell2.cache0.line.value=256,numa.cell2.cache0.line.unit=KiB,\
cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10,\
cache.mode=emulate,cache.level=3
--cputune shares=2048,period=1000000,quota=-1,global_period=1000000,global_quota=-1,emulator_period=1000000,emulator_quota=-1,iothread_period=1000000,iothread_quota=-1,\
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 559ec9f7a..9fbfdc17b 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2264,7 +2264,7 @@ class ParserCPU(VirtCLIParser):
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
- def sibling_find_inst_cb(self, inst, *args, **kwargs):
+ def cell_sibling_find_inst_cb(self, inst, *args, **kwargs):
cell = self.cell_find_inst_cb(inst, *args, **kwargs)
inst = cell
@@ -2273,6 +2273,15 @@ class ParserCPU(VirtCLIParser):
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(inst, *args, **kwargs)
+ def cell_cache_find_inst_cb(self, inst, *args, **kwargs):
+ cell = self.cell_find_inst_cb(inst, *args, **kwargs)
+ inst = cell
+
+ cliarg = "cache" # cell[0-9]*.cache[0-9]*
+ list_propname = "caches" # cell.caches
+ cb = self._make_find_inst_cb(cliarg, list_propname)
+ return cb(inst, *args, **kwargs)
+
def set_model_cb(self, inst, val, virtarg):
if val == "host":
val = inst.SPECIAL_MODE_HOST_MODEL
@@ -2342,9 +2351,24 @@ class ParserCPU(VirtCLIParser):
find_inst_cb=cls.cell_find_inst_cb)
cls.add_arg("numa.cell[0-9]*.distances.sibling[0-9]*.id", "id",
- find_inst_cb=cls.sibling_find_inst_cb)
+ find_inst_cb=cls.cell_sibling_find_inst_cb)
cls.add_arg("numa.cell[0-9]*.distances.sibling[0-9]*.value", "value",
- find_inst_cb=cls.sibling_find_inst_cb)
+ find_inst_cb=cls.cell_sibling_find_inst_cb)
+
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.level", "level",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.associativity", "associativity",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.policy", "policy",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.size.value", "size_value",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.size.unit", "size_unit",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.line.value", "line_value",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
+ cls.add_arg("numa.cell[0-9]*.cache[0-9]*.line.unit", "line_unit",
+ find_inst_cb=cls.cell_cache_find_inst_cb)
#####################
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index a6a3ab3e7..08dfcaf96 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -10,9 +10,10 @@ from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
from .. import xmlutil
-class _CPUCellSibling(XMLBuilder):
+class _NUMACellSibling(XMLBuilder):
"""
- Class for generating nodes
+ Class for generating child nodes ,
+ describing the distances to other NUMA cells.
"""
XML_NAME = "sibling"
_XML_PROP_ORDER = ["id", "value"]
@@ -21,9 +22,30 @@ class _CPUCellSibling(XMLBuilder):
value = XMLProperty("./@value", is_int=True)
-class _CPUCell(XMLBuilder):
+class _NUMACellCache(XMLBuilder):
"""
- Class for generating child XML
+ Class for generating child nodes , describing
+ caches for NUMA cells.
+ """
+ XML_NAME = "cache"
+ _XML_PROP_ORDER = ["level", "associativity", "policy",
+ "size_value", "size_unit", "line_value", "line_unit"]
+
+ level = XMLProperty("./@level", is_int=True)
+ associativity = XMLProperty("./@associativity")
+ policy = XMLProperty("./@policy")
+
+ size_value = XMLProperty("./size/@value", is_int=True)
+ size_unit = XMLProperty("./size/@unit")
+
+ line_value = XMLProperty("./line/@value", is_int=True)
+ line_unit = XMLProperty("./line/@unit")
+
+
+class _NUMACell(XMLBuilder):
+ """
+ Class for generating child nodes XML, describing NUMA
+ cells.
"""
XML_NAME = "cell"
_XML_PROP_ORDER = ["id", "cpus", "memory", "memAccess", "discard"]
@@ -34,7 +56,8 @@ class _CPUCell(XMLBuilder):
unit = XMLProperty("./@unit")
memAccess = XMLProperty("./@memAccess")
discard = XMLProperty("./@discard", is_yesno=True)
- siblings = XMLChildProperty(_CPUCellSibling, relative_xpath="./distances")
+ siblings = XMLChildProperty(_NUMACellSibling, relative_xpath="./distances")
+ caches = XMLChildProperty(_NUMACellCache)
class _CPUCache(XMLBuilder):
@@ -204,7 +227,7 @@ class DomainCpu(XMLBuilder):
feature.policy = policy
features = XMLChildProperty(_CPUFeature)
- cells = XMLChildProperty(_CPUCell, relative_xpath="./numa")
+ cells = XMLChildProperty(_NUMACell, relative_xpath="./numa")
cache = XMLChildProperty(_CPUCache, is_single=True)
def copy_host_cpu(self, guest):
| | | |