summaryrefslogtreecommitdiff
path: root/virtManager/object
diff options
context:
space:
mode:
authorLin Ma <lma@suse.com>2021-08-01 20:36:42 +0800
committerCole Robinson <crobinso@redhat.com>2022-01-25 12:26:14 -0500
commitb4189a925b7b61ae7577c153abc34c3beeea960f (patch)
tree0bc2d6faabf1e54863324a76b72302dc368a77f3 /virtManager/object
parentb19f973f7859552b333ef2974e91454973a27dbe (diff)
downloadvirt-manager-b4189a925b7b61ae7577c153abc34c3beeea960f.tar.gz
details: Add new checkbox to control shared memory access
The virtiofs in domcapabilities is used as a proxy to tell us whether libvirt is new enough to allow bare memory access mode=shared', So We enable/disable this checkbox according to it. When we configure shared memory access, If the 'memfd' is available in domcaps, We configure VM to use it as memory backend because it doesn't need addtional host setup for vhost-user devices, Otherwise use 'file' as backend. If all of numa nodes explicitly defined memAccess=shared, We mark this checkbox as checked even if virtiofs isn't exposed in domcapabilities. In this case: - It doesn't matter what the value of access mode of memoryBacking is because access mode of memoryBacking will be overridden per numa node by memAccess attribute. - Although the checkbox is disabled, the checked checkbox presents actual status about shared memory access to users. Signed-off-by: Lin Ma <lma@suse.com>
Diffstat (limited to 'virtManager/object')
-rw-r--r--virtManager/object/domain.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py
index 00c990fd..f2d67e95 100644
--- a/virtManager/object/domain.py
+++ b/virtManager/object/domain.py
@@ -626,7 +626,8 @@ class vmmDomain(vmmLibvirtObject):
def define_cpu(self, vcpus=_SENTINEL,
model=_SENTINEL, secure=_SENTINEL, sockets=_SENTINEL,
- cores=_SENTINEL, threads=_SENTINEL, clear_topology=_SENTINEL):
+ cores=_SENTINEL, threads=_SENTINEL, memAccess=_SENTINEL,
+ clear_topology=_SENTINEL):
guest = self._make_xmlobj_to_define()
if vcpus != _SENTINEL:
@@ -646,6 +647,11 @@ class vmmDomain(vmmLibvirtObject):
guest.cpu.set_special_mode(guest, model)
else:
guest.cpu.set_model(guest, model)
+
+ if memAccess != _SENTINEL:
+ for cell in guest.cpu.cells:
+ cell.memAccess = memAccess
+
self._redefine_xmlobj(guest)
def define_memory(self, memory=_SENTINEL, maxmem=_SENTINEL):
@@ -657,6 +663,15 @@ class vmmDomain(vmmLibvirtObject):
guest.memory = int(maxmem)
self._redefine_xmlobj(guest)
+ def define_memorybacking(self, source_type=_SENTINEL, access_mode=_SENTINEL):
+ guest = self._make_xmlobj_to_define()
+
+ if source_type != _SENTINEL:
+ guest.memoryBacking.source_type = source_type
+ if access_mode != _SENTINEL:
+ guest.memoryBacking.access_mode = access_mode
+ self._redefine_xmlobj(guest)
+
def define_overview(self, machine=_SENTINEL, description=_SENTINEL,
title=_SENTINEL, loader=_SENTINEL,
nvram=_SENTINEL):