[virt-tools-list] [PATCH] cli: add memory backing access_mode & source_type

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Sep 17 10:59:06 UTC 2018


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Allow to set some memory backing options, ex:
--memorybacking access_mode=shared,source_type=anonymous

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 .../cli-test-xml/compare/virt-install-singleton-config-2.xml  | 4 ++++
 tests/clitest.py                                              | 2 +-
 virtinst/cli.py                                               | 2 ++
 virtinst/domain/memorybacking.py                              | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
index 4e14ef04..b166a889 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
@@ -29,6 +29,8 @@
     <hugepages>
       <page size="1" unit="G" nodeset="1,2-5"/>
     </hugepages>
+    <access mode="shared"/>
+    <source type="memfd"/>
   </memoryBacking>
   <vcpu>4</vcpu>
   <numatune>
@@ -212,6 +214,8 @@
     <hugepages>
       <page size="1" unit="G" nodeset="1,2-5"/>
     </hugepages>
+    <access mode="shared"/>
+    <source type="memfd"/>
   </memoryBacking>
   <vcpu>4</vcpu>
   <numatune>
diff --git a/tests/clitest.py b/tests/clitest.py
index bdc916a7..daf7f9de 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -390,7 +390,7 @@ cache.mode=emulate,cache.level=3 \
 --numatune 1-3,4,mode=strict \
 --memtune hard_limit=10,soft_limit=20,swap_hard_limit=30,min_guarantee=40 \
 --blkiotune weight=100,device_path=/home/test/1.img,device_weight=200 \
---memorybacking size=1,unit='G',nodeset='1,2-5',nosharepages=yes,locked=yes \
+--memorybacking size=1,unit='G',nodeset='1,2-5',nosharepages=yes,locked=yes,access_mode=shared,source_type=memfd \
 --features acpi=off,eoi=on,privnet=on,hyperv_synic=on,hyperv_reset=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234,vmport=off,pmu=off,vmcoreinfo=on \
 --clock offset=utc,hpet_present=no,rtc_tickpolicy=merge \
 --sysinfo type=smbios,bios_vendor="Acme LLC",bios_version=1.2.3,bios_date=01/01/1970,bios_release=10.22 \
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 3986bef8..e6ef5f68 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1417,6 +1417,8 @@ ParserMemoryBacking.add_arg("page_unit", "unit")
 ParserMemoryBacking.add_arg("page_nodeset", "nodeset", can_comma=True)
 ParserMemoryBacking.add_arg("nosharepages", "nosharepages", is_onoff=True)
 ParserMemoryBacking.add_arg("locked", "locked", is_onoff=True)
+ParserMemoryBacking.add_arg("access_mode", "access_mode")
+ParserMemoryBacking.add_arg("source_type", "source_type")
 
 
 #################
diff --git a/virtinst/domain/memorybacking.py b/virtinst/domain/memorybacking.py
index cef95337..c0967687 100644
--- a/virtinst/domain/memorybacking.py
+++ b/virtinst/domain/memorybacking.py
@@ -22,3 +22,5 @@ class DomainMemoryBacking(XMLBuilder):
     page_nodeset = XMLProperty("./hugepages/page/@nodeset")
     nosharepages = XMLProperty("./nosharepages", is_bool=True)
     locked = XMLProperty("./locked", is_bool=True)
+    access_mode = XMLProperty("./access/@mode")
+    source_type = XMLProperty("./source/@type")
-- 
2.19.0




More information about the virt-tools-list mailing list