2017-05-05 17:50:06 +08:00
|
|
|
#
|
|
|
|
# Copyright 2017 Red Hat, Inc.
|
|
|
|
#
|
2018-04-04 21:35:41 +08:00
|
|
|
# This work is licensed under the GNU GPLv2 or later.
|
2018-03-21 03:00:02 +08:00
|
|
|
# See the COPYING file in the top-level directory.
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
from .device import Device
|
2018-03-21 00:27:37 +08:00
|
|
|
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
class _DeviceMemoryTarget(XMLBuilder):
|
2018-03-21 22:53:34 +08:00
|
|
|
XML_NAME = "target"
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
size = XMLProperty("./size", is_int=True)
|
|
|
|
node = XMLProperty("./node", is_int=True)
|
|
|
|
label_size = XMLProperty("./label/size", is_int=True)
|
2021-06-22 00:31:49 +08:00
|
|
|
readonly = XMLProperty("./readonly", is_bool=True)
|
2022-01-27 07:03:57 +08:00
|
|
|
block = XMLProperty("./block", is_int=True)
|
|
|
|
requested = XMLProperty("./requested", is_int=True)
|
|
|
|
current = XMLProperty("./current", is_int=True)
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
class _DeviceMemorySource(XMLBuilder):
|
2018-03-21 22:53:34 +08:00
|
|
|
XML_NAME = "source"
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
pagesize = XMLProperty("./pagesize", is_int=True)
|
|
|
|
nodemask = XMLProperty("./nodemask")
|
|
|
|
path = XMLProperty("./path")
|
2021-06-22 00:31:49 +08:00
|
|
|
alignsize = XMLProperty("./alignsize", is_int=True)
|
|
|
|
pmem = XMLProperty("./pmem", is_bool=True)
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
class DeviceMemory(Device):
|
2018-03-21 22:53:34 +08:00
|
|
|
XML_NAME = "memory"
|
2017-05-05 17:50:06 +08:00
|
|
|
|
|
|
|
MODEL_DIMM = "dimm"
|
|
|
|
MODEL_NVDIMM = "nvdimm"
|
|
|
|
models = [MODEL_DIMM, MODEL_NVDIMM]
|
|
|
|
|
|
|
|
ACCESS_SHARED = "shared"
|
|
|
|
ACCESS_PRIVATE = "private"
|
|
|
|
accesses = [ACCESS_SHARED, ACCESS_PRIVATE]
|
|
|
|
|
|
|
|
model = XMLProperty("./@model")
|
|
|
|
access = XMLProperty("./@access")
|
2021-06-22 00:31:49 +08:00
|
|
|
discard = XMLProperty("./@discard", is_yesno=True)
|
2021-07-28 01:01:14 +08:00
|
|
|
uuid = XMLProperty("./uuid")
|
2017-05-05 17:50:06 +08:00
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
source = XMLChildProperty(_DeviceMemorySource, is_single=True)
|
|
|
|
target = XMLChildProperty(_DeviceMemoryTarget, is_single=True)
|