[virt-manager][PATCH] virtinst: Support missing NVDIMM knobs

Michal Privoznik mprivozn at redhat.com
Mon Jun 21 12:43:37 UTC 2021


There are two domain XML knobs specific to NVDIMMs that
virt-install doesn't allow to set: <pmem/> and <alignsize/>.
Implement them.

Closes: https://github.com/virt-manager/virt-manager/issues/267
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/data/cli/compare/virt-install-singleton-config-3.xml | 2 ++
 tests/test_cli.py                                          | 2 +-
 virtinst/cli.py                                            | 4 ++++
 virtinst/devices/memory.py                                 | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/data/cli/compare/virt-install-singleton-config-3.xml b/tests/data/cli/compare/virt-install-singleton-config-3.xml
index 41a9a347..6f366e32 100644
--- a/tests/data/cli/compare/virt-install-singleton-config-3.xml
+++ b/tests/data/cli/compare/virt-install-singleton-config-3.xml
@@ -145,6 +145,8 @@
       <address type="dimm" slot="1" base="0x100000000"/>
       <source>
         <path>/path/to/nvdimm</path>
+        <pmem/>
+        <alignsize>2097152</alignsize>
       </source>
       <target>
         <size>524288</size>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index b59eb4a1..6ce419b0 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -566,7 +566,7 @@ c.add_compare("""
 --panic default,,address.type=isa,address.iobase=0x500,address.irq=5
 --cpu topology.sockets=1,topology.cores=3,topology.threads=2,cell0.cpus=0,cell0.memory=1048576
  --memdev dimm,access=private,target.size=512,target.node=0,source.pagesize=4,source.nodemask=1-2
- --memdev nvdimm,source.path=/path/to/nvdimm,target.size=512,target.node=0,target.label_size=128,alias.name=mymemdev3,address.type=dimm,address.base=0x100000000,address.slot=1
+ --memdev nvdimm,source.path=/path/to/nvdimm,target.size=512,target.node=0,target.label_size=128,alias.name=mymemdev3,address.type=dimm,address.base=0x100000000,address.slot=1,source.pmem=on,source.alignsize=2048
 --vsock auto_cid=on
 --memballoon default
 
diff --git a/virtinst/cli.py b/virtinst/cli.py
index b0f679e6..b51f3b28 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -4018,6 +4018,8 @@ class ParserMemdev(VirtCLIParser):
         "source.pagesize": "source_pagesize",
         "source.path": "source_path",
         "source.nodemask": "source_nodemask",
+        "source.pmem": "source_pmem",
+        "source.alignsize": "source_alignsize",
     }
 
     def set_target_size(self, inst, val, virtarg):
@@ -4037,6 +4039,8 @@ class ParserMemdev(VirtCLIParser):
         cls.add_arg("source.pagesize", "source.pagesize")
         cls.add_arg("source.path", "source.path")
         cls.add_arg("source.nodemask", "source.nodemask", can_comma=True)
+        cls.add_arg("source.pmem", "source.pmem", is_onoff=True)
+        cls.add_arg("source.alignsize", "source.alignsize", cb=cls.set_target_size)
 
 
 ########################
diff --git a/virtinst/devices/memory.py b/virtinst/devices/memory.py
index 3c9a6a1a..c4ef96b7 100644
--- a/virtinst/devices/memory.py
+++ b/virtinst/devices/memory.py
@@ -23,6 +23,8 @@ class _DeviceMemorySource(XMLBuilder):
     pagesize = XMLProperty("./pagesize", is_int=True)
     nodemask = XMLProperty("./nodemask")
     path = XMLProperty("./path")
+    alignsize = XMLProperty("./alignsize", is_int=True)
+    pmem = XMLProperty("./pmem", is_bool=True)
 
 
 class DeviceMemory(Device):
-- 
2.31.1




More information about the virt-tools-list mailing list