[virt-tools-list] [virt-manager] [PATCH 3/7] domcapabilities: Add supports_memorybacking_memfd()

Lin Ma lma at suse.com
Sun Aug 1 12:36:38 UTC 2021


Linux memfd memory backend doesn't require any host setup, We prefer to
use it as the simplest memory XML adjustments to make virtiofs works.

Signed-off-by: Lin Ma <lma at suse.com>
---
 virtinst/domcapabilities.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 978deb85..6ed6e8ac 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -110,6 +110,10 @@ class _Features(_CapsBlock):
     sev = XMLChildProperty(_SEV, is_single=True)
 
 
+class _MemoryBacking(_CapsBlock):
+    XML_NAME = "memoryBacking"
+
+
 ###############
 # CPU classes #
 ###############
@@ -370,12 +374,20 @@ class DomainCapabilities(XMLBuilder):
         types = self.devices.filesystem.get_enum("driverType").get_values()
         return bool("virtiofs" in types)
 
+    def supports_memorybacking_memfd(self):
+        """
+        Return True if libvirt advertises support for memfd memory backend
+        """
+        sourceTypes = self.memorybacking.get_enum("sourceType").get_values()
+        return bool("memfd" in sourceTypes)
+
 
     XML_NAME = "domainCapabilities"
     os = XMLChildProperty(_OS, is_single=True)
     cpu = XMLChildProperty(_CPU, is_single=True)
     devices = XMLChildProperty(_Devices, is_single=True)
     features = XMLChildProperty(_Features, is_single=True)
+    memorybacking = XMLChildProperty(_MemoryBacking, is_single=True)
 
     arch = XMLProperty("./arch")
     domain = XMLProperty("./domain")
-- 
2.26.2





More information about the virt-tools-list mailing list