Files
virt-manager/virtinst/domain/memorybacking.py
T
Cole Robinson 9c45f4a2e9 details: Strip back 'Enable shared memory' to only cover memfd
Strip back the logic to:

* Only try to toggle source_type=memfd and access_mode=shared
* Disable the field if guest has any <numa> config
* Disable the field if domcaps does not report virtiofs and memfd

This is the simplest future proof case, though it will exclude some
legit guest configs and some libvirt+qemu back compat.

My feeling is the <numa> stuff in particular is pretty advanced, so if
users have it configured they can toggle shared memory via the XML
without too much trouble.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:43:32 -05:00

39 lines
1.1 KiB
Python

#
# Copyright 2014 Fujitsu Limited.
# Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
#
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
class _HugepagesPage(XMLBuilder):
"""
Class representing <memoryBacking><hugepages><page> elements
"""
XML_NAME = "page"
size = XMLProperty("./@size")
unit = XMLProperty("./@unit")
nodeset = XMLProperty("./@nodeset")
class DomainMemoryBacking(XMLBuilder):
"""
Class for generating <memoryBacking> XML
"""
XML_NAME = "memoryBacking"
_XML_PROP_ORDER = ["hugepages", "nosharepages", "locked", "pages"]
hugepages = XMLProperty("./hugepages", is_bool=True)
nosharepages = XMLProperty("./nosharepages", is_bool=True)
locked = XMLProperty("./locked", is_bool=True)
discard = XMLProperty("./discard", is_bool=True)
access_mode = XMLProperty("./access/@mode")
source_type = XMLProperty("./source/@type")
allocation_mode = XMLProperty("./allocation/@mode")
pages = XMLChildProperty(_HugepagesPage, relative_xpath="./hugepages")