From 3176cf85443729e3d46bd5c3334e4d1a1ba64b71 Mon Sep 17 00:00:00 2001 From: Dan Zheng Date: Sun, 24 Apr 2022 08:45:20 +0800 Subject: [PATCH] memory: add new attributes and elements to nvdimm Add new elements/attributes support: - pmem in - alignsize and alignsize_unit in - readonly in Signed-off-by: Dan Zheng --- spell.ignore | 3 +++ virttest/libvirt_xml/devices/memory.py | 29 ++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/spell.ignore b/spell.ignore index 2b78e96417..58393ba281 100644 --- a/spell.ignore +++ b/spell.ignore @@ -61,6 +61,7 @@ nic usb vms addr +alignsize iothread pid scsi @@ -588,6 +589,7 @@ pickable preallocation pubkey pvresize +pmem QDev qom readed @@ -1360,6 +1362,7 @@ mkfifo mkfs mklost MLS +mmap mmio mnt modelname diff --git a/virttest/libvirt_xml/devices/memory.py b/virttest/libvirt_xml/devices/memory.py index feb66ec31b..ccb7b913e3 100644 --- a/virttest/libvirt_xml/devices/memory.py +++ b/virttest/libvirt_xml/devices/memory.py @@ -65,7 +65,7 @@ class Target(base.base.LibvirtXMLBase): __slots__ = ('size', 'size_unit', 'node', 'label', 'requested_size', 'requested_unit', 'current_size', 'current_unit', - 'block_size', 'block_unit') + 'block_size', 'block_unit', 'readonly') def __init__(self, virsh_instance=base.base.virsh): accessors.XMLElementInt('size', @@ -111,6 +111,8 @@ def __init__(self, virsh_instance=base.base.virsh): tag_name='label', subclass=self.Label, subclass_dargs={ 'virsh_instance': virsh_instance}) + accessors.XMLElementBool('readonly', self, parent_xpath='/', + tag_name='readonly') super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = '' @@ -148,12 +150,16 @@ class Source(base.base.LibvirtXMLBase): Properties: - pagesize: - int. - pagesize_unit, nodemask: - string. + pagesize: int, override the default host page size used for backing the memory device + pagesize_unit: str, the unit of pagesize + nodemask: str, override the default set of NUMA nodes where the memory would be allocated + path: str, the path in the host that backs the memory device in the guest + alignsize: int, the page size alignment used to mmap the address range for the backend path + alignsize_unit: str, the unit of alignsize + pmem:boolean, persistent memory feature is enabled """ - __slots__ = ('pagesize', 'pagesize_unit', 'nodemask', 'path') + __slots__ = ('pagesize', 'pagesize_unit', 'nodemask', 'path', + 'alignsize', 'alignsize_unit', 'pmem') def __init__(self, virsh_instance=base.base.virsh): accessors.XMLElementInt('pagesize', @@ -171,6 +177,17 @@ def __init__(self, virsh_instance=base.base.virsh): accessors.XMLElementText('path', self, parent_xpath='/', tag_name='path') + accessors.XMLElementInt('alignsize', + self, parent_xpath='/', + tag_name='alignsize') + accessors.XMLAttribute(property_name="alignsize_unit", + libvirtxml=self, + forbidden=None, + parent_xpath='/', + tag_name='alignsize', + attribute='unit') + accessors.XMLElementBool('pmem', self, parent_xpath='/', + tag_name='pmem') super(self.__class__, self).__init__(virsh_instance=virsh_instance) self.xml = ''