cli: Add basic --audio type=XXX,id=Y support
Closes: #264 Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
5a6714715b
commit
cd5c34a3f3
|
@ -1575,6 +1575,16 @@ Complete details at https://libvirt.org/formatdomain.html#elementsSound
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
``--audio``
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
Configure host audio output for the guest's `--sound` hardware.
|
||||||
|
|
||||||
|
Use --audio=? to see a list of all available sub options.
|
||||||
|
Complete details at https://libvirt.org/formatdomain.html#audio-backends
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
``--watchdog``
|
``--watchdog``
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,7 @@ XML OPTIONS
|
||||||
* ``--hostdev``
|
* ``--hostdev``
|
||||||
* ``--filesystem``
|
* ``--filesystem``
|
||||||
* ``--sound``
|
* ``--sound``
|
||||||
|
* ``--audio``
|
||||||
* ``--watchdog``
|
* ``--watchdog``
|
||||||
* ``--video``
|
* ``--video``
|
||||||
* ``--smartcard``
|
* ``--smartcard``
|
||||||
|
|
|
@ -727,6 +727,8 @@
|
||||||
<codec type="duplex"/>
|
<codec type="duplex"/>
|
||||||
<codec type="output"/>
|
<codec type="output"/>
|
||||||
</sound>
|
</sound>
|
||||||
|
<audio type="spice" id="1"/>
|
||||||
|
<audio type="pulseaudio" id="2"/>
|
||||||
<video>
|
<video>
|
||||||
<model type="cirrus"/>
|
<model type="cirrus"/>
|
||||||
</video>
|
</video>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<vsock model="virtio">
|
||||||
|
<cid auto="no" address="5"/>
|
||||||
|
</vsock>
|
||||||
|
+ <audio type="none" id="1"/>
|
||||||
|
</devices>
|
||||||
|
<seclabel type="dynamic" model="selinux" relabel="yes"/>
|
||||||
|
<keywrap>
|
||||||
|
|
||||||
|
Domain 'test-for-virtxml' defined successfully.
|
||||||
|
Changes will take effect after the domain is fully powered off.
|
|
@ -703,6 +703,10 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
|
||||||
--sound codec0.type=micro,codec1.type=duplex,codec2.type=output
|
--sound codec0.type=micro,codec1.type=duplex,codec2.type=output
|
||||||
|
|
||||||
|
|
||||||
|
--audio id=1,type=spice
|
||||||
|
--audio id=2,type=pulseaudio
|
||||||
|
|
||||||
|
|
||||||
--video cirrus
|
--video cirrus
|
||||||
--video model=qxl,vgamem=1,ram=2,vram=3,heads=4,accel3d=yes,vram64=65
|
--video model=qxl,vgamem=1,ram=2,vram=3,heads=4,accel3d=yes,vram64=65
|
||||||
--video model=qxl,model.vgamem=1,model.ram=2,model.vram=3,model.heads=4,model.acceleration.accel3d=yes,model.vram64=65
|
--video model=qxl,model.vgamem=1,model.ram=2,model.vram=3,model.heads=4,model.acceleration.accel3d=yes,model.vram64=65
|
||||||
|
@ -1411,6 +1415,7 @@ c = vixml.add_category("add/rm devices", "test-for-virtxml --print-diff --define
|
||||||
c.add_compare("--add-device --seclabel model=dac", "add-seclabel")
|
c.add_compare("--add-device --seclabel model=dac", "add-seclabel")
|
||||||
c.add_compare("--add-device --host-device usb_device_483_2016_noserial", "add-host-device")
|
c.add_compare("--add-device --host-device usb_device_483_2016_noserial", "add-host-device")
|
||||||
c.add_compare("--add-device --sound pcspk", "add-sound")
|
c.add_compare("--add-device --sound pcspk", "add-sound")
|
||||||
|
c.add_compare("--add-device --audio type=none,id=1", "add-audio", predefine_check="7.4.0")
|
||||||
c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic")
|
c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic")
|
||||||
c.add_compare("--add-device --disk %(EXISTIMG1)s", "add-disk-notarget") # filling in acceptable target
|
c.add_compare("--add-device --disk %(EXISTIMG1)s", "add-disk-notarget") # filling in acceptable target
|
||||||
c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage")
|
c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage")
|
||||||
|
|
|
@ -766,6 +766,10 @@ def add_device_options(devg, sound_back_compat=False):
|
||||||
devg.add_argument("--soundhw", action="append", dest="sound",
|
devg.add_argument("--soundhw", action="append", dest="sound",
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
|
ParserAudio.register()
|
||||||
|
devg.add_argument("--audio", action="append",
|
||||||
|
help=_("Configure host audio backend for sound devices"))
|
||||||
|
|
||||||
ParserWatchdog.register()
|
ParserWatchdog.register()
|
||||||
devg.add_argument("--watchdog", action="append",
|
devg.add_argument("--watchdog", action="append",
|
||||||
help=_("Configure a guest watchdog device"))
|
help=_("Configure a guest watchdog device"))
|
||||||
|
@ -4593,6 +4597,18 @@ class ParserSound(VirtCLIParser):
|
||||||
find_inst_cb=cls.codec_find_inst_cb)
|
find_inst_cb=cls.codec_find_inst_cb)
|
||||||
|
|
||||||
|
|
||||||
|
class ParserAudio(VirtCLIParser):
|
||||||
|
cli_arg_name = "audio"
|
||||||
|
guest_propname = "devices.audio"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _init_class(cls, **kwargs):
|
||||||
|
VirtCLIParser._init_class(**kwargs)
|
||||||
|
|
||||||
|
cls.add_arg("type", "type")
|
||||||
|
cls.add_arg("id", "id")
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# --hostdev parsing #
|
# --hostdev parsing #
|
||||||
#####################
|
#####################
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# See the COPYING file in the top-level directory.
|
# See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
|
|
||||||
|
from .audio import DeviceAudio
|
||||||
from .char import DeviceChannel, DeviceConsole, DeviceParallel, DeviceSerial
|
from .char import DeviceChannel, DeviceConsole, DeviceParallel, DeviceSerial
|
||||||
from .controller import DeviceController
|
from .controller import DeviceController
|
||||||
from .device import Device
|
from .device import Device
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
# 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 DeviceAudio(Device):
|
||||||
|
XML_NAME = "audio"
|
||||||
|
|
||||||
|
type = XMLProperty("./@type")
|
||||||
|
id = XMLProperty("./@id")
|
|
@ -25,7 +25,7 @@ class _DomainDevices(XMLBuilder):
|
||||||
XML_NAME = "devices"
|
XML_NAME = "devices"
|
||||||
_XML_PROP_ORDER = ['disk', 'controller', 'filesystem', 'interface',
|
_XML_PROP_ORDER = ['disk', 'controller', 'filesystem', 'interface',
|
||||||
'smartcard', 'serial', 'parallel', 'console', 'channel',
|
'smartcard', 'serial', 'parallel', 'console', 'channel',
|
||||||
'input', 'tpm', 'graphics', 'sound', 'video', 'hostdev',
|
'input', 'tpm', 'graphics', 'sound', 'audio', 'video', 'hostdev',
|
||||||
'redirdev', 'watchdog', 'memballoon', 'rng', 'panic',
|
'redirdev', 'watchdog', 'memballoon', 'rng', 'panic',
|
||||||
'shmem', 'memory', 'vsock', 'iommu']
|
'shmem', 'memory', 'vsock', 'iommu']
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ class _DomainDevices(XMLBuilder):
|
||||||
tpm = XMLChildProperty(DeviceTpm)
|
tpm = XMLChildProperty(DeviceTpm)
|
||||||
graphics = XMLChildProperty(DeviceGraphics)
|
graphics = XMLChildProperty(DeviceGraphics)
|
||||||
sound = XMLChildProperty(DeviceSound)
|
sound = XMLChildProperty(DeviceSound)
|
||||||
|
audio = XMLChildProperty(DeviceAudio)
|
||||||
video = XMLChildProperty(DeviceVideo)
|
video = XMLChildProperty(DeviceVideo)
|
||||||
hostdev = XMLChildProperty(DeviceHostdev)
|
hostdev = XMLChildProperty(DeviceHostdev)
|
||||||
redirdev = XMLChildProperty(DeviceRedirdev)
|
redirdev = XMLChildProperty(DeviceRedirdev)
|
||||||
|
|
Loading…
Reference in New Issue