The virtio-fs device needs shared access of memory for talking to its vhost-user backend. We need to set memory access mode manually in the XML editor. After the patch, The memory access mode will be set automatically in memory backing element or in numa node element. Signed-off-by: Lin Ma <lma@xxxxxxxx> --- virtManager/details/details.py | 16 ++++++++++++++++ virtManager/object/domain.py | 15 ++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/virtManager/details/details.py b/virtManager/details/details.py index 27f2ecb7..6c194d2f 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -12,6 +12,7 @@ import libvirt import virtinst from virtinst import log +from virtinst import DeviceFilesystem from ..lib import uiutil from ..addhardware import vmmAddHardware @@ -1640,6 +1641,21 @@ class vmmDetails(vmmGObjectUI): kwargs = {} if self._edited(EDIT_FS): + fsdriver = uiutil.get_list_selection( + self.fsDetails.widget("fs-driver-combo")) + if fsdriver == DeviceFilesystem.DRIVER_VIRTIOFS: + guest = self.vm.xmlobj + if guest.cpu.has_private_memAccess_cells(): + embeded_kwargs = {} + embeded_kwargs["memAccess"] = "shared" + self._change_config( + self.vm.define_cpu, embeded_kwargs) + elif (not guest.cpu.all_shared_memAccess_cells() and + not guest.memoryBacking.is_access_shared()): + embeded_kwargs = {} + embeded_kwargs["access_mode"] = "shared" + self._change_config( + self.vm.define_memorybacking, embeded_kwargs) kwargs["newdev"] = self.fsDetails.update_device(devobj) return self._change_config( diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py index 6c734df9..6e451ba0 100644 --- a/virtManager/object/domain.py +++ b/virtManager/object/domain.py @@ -624,7 +624,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: @@ -644,6 +645,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): @@ -655,6 +661,13 @@ class vmmDomain(vmmLibvirtObject): guest.memory = int(maxmem) self._redefine_xmlobj(guest) + def define_memorybacking(self, access_mode=_SENTINEL): + guest = self._make_xmlobj_to_define() + + 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): -- 2.26.2