mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
cli: --shmem: added support for shared memory devices
This includes support for the following suboptions: * name (<shmem name=X>) * role (<shmem role=X>) * model.type (<shmem><model type=X/>) * size (<shmem><size>X) * size.unit (<shmem><size unit=X/>) * server.path (<shmem><server path=X/>) * msi.vectors (<shmem><msi vectors=X/>) * msi.ioeventfd (<shmem><msi ioeventfd=X/>)
This commit is contained in:
parent
4017e761c2
commit
20d2376b18
@ -1886,6 +1886,19 @@ Complete details at https://libvirt.org/formatdomain.html#elementsPanic
|
||||
|
||||
|
||||
|
||||
``--shmem``
|
||||
^^^^^^^^^^^
|
||||
|
||||
**Syntax:** ``--shmem`` NAME[,OPTS]
|
||||
|
||||
Attach a shared memory device to the guest. The name must not contain ``/`` and must
|
||||
not be directory-specific to ``.`` or ``..``
|
||||
|
||||
Use --shmem=? to see a list of all available sub options.
|
||||
Complete details at https://libvirt.org/formatdomain.html#shared-memory-device
|
||||
|
||||
|
||||
|
||||
``--memdev``
|
||||
^^^^^^^^^^^^
|
||||
|
||||
|
@ -243,6 +243,7 @@ XML OPTIONS
|
||||
* ``--tpm``
|
||||
* ``--rng``
|
||||
* ``--panic``
|
||||
* ``--shmem``
|
||||
* ``--memdev``
|
||||
|
||||
These options alter the XML for a single class of XML elements. More complete documentation is found in virt-install(1).
|
||||
|
@ -647,6 +647,16 @@
|
||||
<panic model="isa">
|
||||
<address type="isa" iobase="507"/>
|
||||
</panic>
|
||||
<shmem name="my_shmem0" role="peer">
|
||||
<model type="ivshmem-plain"/>
|
||||
<size unit="M">4</size>
|
||||
</shmem>
|
||||
<shmem name="shmem_server">
|
||||
<model type="ivshmem-doorbell"/>
|
||||
<size unit="M">2</size>
|
||||
<server path="/tmp/socket-shmemm"/>
|
||||
<msi vectors="32" ioeventfd="on"/>
|
||||
</shmem>
|
||||
<vsock model="virtio">
|
||||
<cid address="17"/>
|
||||
</vsock>
|
||||
|
@ -88,6 +88,7 @@
|
||||
<rng model="virtio">
|
||||
<backend model="random">/dev/random</backend>
|
||||
</rng>
|
||||
<shmem name="shmem0"/>
|
||||
<vsock model="virtio">
|
||||
<cid auto="yes"/>
|
||||
</vsock>
|
||||
|
@ -214,6 +214,10 @@
|
||||
<panic model="isa">
|
||||
<address type="isa" iobase="0x506"/>
|
||||
</panic>
|
||||
<shmem name="shmem0" role="master">
|
||||
<model type="ivshmem-plain"/>
|
||||
<size unit="M">8</size>
|
||||
</shmem>
|
||||
<iommu model="intel">
|
||||
<driver aw_bits="48" intremap="off" caching_mode="on" eim="off" iotlb="off"/>
|
||||
</iommu>
|
||||
@ -461,6 +465,10 @@
|
||||
<panic model="isa">
|
||||
<address type="isa" iobase="0x506"/>
|
||||
</panic>
|
||||
<shmem name="shmem0" role="master">
|
||||
<model type="ivshmem-plain"/>
|
||||
<size unit="M">8</size>
|
||||
</shmem>
|
||||
<iommu model="intel">
|
||||
<driver aw_bits="48" intremap="off" caching_mode="on" eim="off" iotlb="off"/>
|
||||
</iommu>
|
||||
|
@ -498,6 +498,7 @@ c.add_compare("""
|
||||
--watchdog default
|
||||
--tpm /dev/tpm0
|
||||
--rng /dev/random
|
||||
--shmem shmem0
|
||||
--vsock default
|
||||
""", "singleton-config-1")
|
||||
|
||||
@ -548,6 +549,7 @@ memnode0.cellid=1,memnode0.mode=strict,memnode0.nodeset=2
|
||||
--tpm passthrough,model=tpm-crb,path=/dev/tpm0,backend.encryption.secret=11111111-2222-3333-4444-5555555555,backend.persistent_state=yes
|
||||
--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind,backend_connect_host=foo,backend_connect_service=708,rate.bytes=1234,rate.period=1000,model=virtio
|
||||
--panic iobase=0x506
|
||||
--shmem shmem0,role=master,model.type=ivshmem-plain,size=8,size.unit=M
|
||||
--iommu model=intel,driver.aw_bits=48,driver.caching_mode=on,driver.eim=off,driver.intremap=off,driver.iotlb=off
|
||||
""", "singleton-config-2")
|
||||
|
||||
@ -717,6 +719,9 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
|
||||
|
||||
--panic iobase=507
|
||||
|
||||
--shmem name=my_shmem0,role=peer,model.type=ivshmem-plain,size=4,size.unit=M
|
||||
--shmem name=shmem_server,model.type=ivshmem-doorbell,size=2,size.unit=M,server.path=/tmp/socket-shmemm,msi.vectors=32,msi.ioeventfd=on
|
||||
|
||||
--vsock cid=17
|
||||
|
||||
--tpm emulator,model=tpm-crb,version=2.0
|
||||
|
@ -796,6 +796,10 @@ def add_device_options(devg, sound_back_compat=False):
|
||||
devg.add_argument("--panic", action="append",
|
||||
help=_("Configure a guest panic device. Ex:\n"
|
||||
"--panic default"))
|
||||
ParserShMem.register()
|
||||
devg.add_argument("--shmem", action="append",
|
||||
help=_("Configure a guest shared memory device. Ex:\n"
|
||||
"--shmem name=shmem0"))
|
||||
ParserMemdev.register()
|
||||
devg.add_argument("--memdev", action="append",
|
||||
help=_("Configure a guest memory device. Ex:\n"
|
||||
@ -4107,6 +4111,33 @@ class ParserPanic(VirtCLIParser):
|
||||
cls.add_arg("model", "model", ignore_default=True)
|
||||
|
||||
|
||||
###################
|
||||
# --shmem parsing #
|
||||
###################
|
||||
|
||||
class ParserShMem(VirtCLIParser):
|
||||
cli_arg_name = "shmem"
|
||||
guest_propname = "devices.shmem"
|
||||
remove_first = "name"
|
||||
|
||||
@classmethod
|
||||
def _init_class(cls, **kwargs):
|
||||
VirtCLIParser._init_class(**kwargs)
|
||||
_add_common_device_args(cls)
|
||||
|
||||
cls.add_arg("name", "name")
|
||||
cls.add_arg("role", "role")
|
||||
|
||||
cls.add_arg("model.type", "type")
|
||||
|
||||
cls.add_arg("size", "size")
|
||||
cls.add_arg("size.unit", "size_unit")
|
||||
|
||||
cls.add_arg("server.path", "server_path")
|
||||
cls.add_arg("msi.vectors", "msi_vectors")
|
||||
cls.add_arg("msi.ioeventfd", "msi_ioeventfd")
|
||||
|
||||
|
||||
###################
|
||||
# --vsock parsing #
|
||||
###################
|
||||
|
@ -17,10 +17,11 @@ from .iommu import DeviceIommu
|
||||
from .memballoon import DeviceMemballoon
|
||||
from .memory import DeviceMemory
|
||||
from .panic import DevicePanic
|
||||
from .smartcard import DeviceSmartcard
|
||||
from .sound import DeviceSound
|
||||
from .redirdev import DeviceRedirdev
|
||||
from .rng import DeviceRng
|
||||
from .shmem import DeviceShMem
|
||||
from .smartcard import DeviceSmartcard
|
||||
from .sound import DeviceSound
|
||||
from .tpm import DeviceTpm
|
||||
from .video import DeviceVideo
|
||||
from .vsock import DeviceVsock
|
||||
|
@ -148,6 +148,7 @@ class Device(XMLBuilder):
|
||||
"tpm": ["type", "xmlindex"],
|
||||
"rng": ["backend_model", "xmlindex"],
|
||||
"panic": ["model", "xmlindex"],
|
||||
"shmem": ["name", "xmlindex"],
|
||||
"vsock": ["model", "xmlindex"],
|
||||
"memballoon": ["model", "xmlindex"],
|
||||
"iommu": ["model", "xmlindex"],
|
||||
|
36
virtinst/devices/shmem.py
Normal file
36
virtinst/devices/shmem.py
Normal file
@ -0,0 +1,36 @@
|
||||
#
|
||||
# This work is licensed under the GNU GPLv2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .device import Device
|
||||
from ..xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class DeviceShMem(Device):
|
||||
XML_NAME = "shmem"
|
||||
_XML_PROP_ORDER = [
|
||||
"name", "role",
|
||||
"type", "size", "size_unit",
|
||||
"server_path", "msi_vectors", "msi_ioeventfd",
|
||||
]
|
||||
|
||||
MODEL_IVSHMEM = "ivshmem"
|
||||
MODEL_IVSHMEM_PLAIN = "ivshmem-plain"
|
||||
MODEL_IVSHMEM_DOORBELL = "ivshmem-doorbell"
|
||||
MODELS = [MODEL_IVSHMEM, MODEL_IVSHMEM_PLAIN, MODEL_IVSHMEM_DOORBELL]
|
||||
|
||||
ROLE_MASTER = "master"
|
||||
ROLE_PEER = "peer"
|
||||
ROLES = [ROLE_MASTER, ROLE_PEER]
|
||||
|
||||
name = XMLProperty("./@name")
|
||||
role = XMLProperty("./@role")
|
||||
|
||||
type = XMLProperty("./model/@type")
|
||||
|
||||
size = XMLProperty("./size", is_int=True)
|
||||
size_unit = XMLProperty("./size/@unit")
|
||||
|
||||
server_path = XMLProperty("./server/@path")
|
||||
msi_vectors = XMLProperty("./msi/@vectors", is_int=True)
|
||||
msi_ioeventfd = XMLProperty("./msi/@ioeventfd", is_onoff=True)
|
@ -27,7 +27,7 @@ class _DomainDevices(XMLBuilder):
|
||||
'smartcard', 'serial', 'parallel', 'console', 'channel',
|
||||
'input', 'tpm', 'graphics', 'sound', 'video', 'hostdev',
|
||||
'redirdev', 'watchdog', 'memballoon', 'rng', 'panic',
|
||||
'memory', 'vsock', 'iommu']
|
||||
'shmem', 'memory', 'vsock', 'iommu']
|
||||
|
||||
|
||||
disk = XMLChildProperty(DeviceDisk)
|
||||
@ -50,6 +50,7 @@ class _DomainDevices(XMLBuilder):
|
||||
memballoon = XMLChildProperty(DeviceMemballoon)
|
||||
rng = XMLChildProperty(DeviceRng)
|
||||
panic = XMLChildProperty(DevicePanic)
|
||||
shmem = XMLChildProperty(DeviceShMem)
|
||||
memory = XMLChildProperty(DeviceMemory)
|
||||
vsock = XMLChildProperty(DeviceVsock)
|
||||
iommu = XMLChildProperty(DeviceIommu)
|
||||
|
Loading…
Reference in New Issue
Block a user