cli: add --sound codec support
Add codec support to virt-install so that it can accommodate multiple instances of codec configuration. The commandline argument: --sound codec0.type=micro,codec1.type=duplex,codec2.type=output maps to the sound XML below: <sound model="es1370"> <codec type="micro"/> <codec type="duplex"/> <codec type="output"/> </sound> Signed-off-by: Anya Harter <aharter@redhat.com>
This commit is contained in:
parent
02635d3358
commit
846e2f711a
|
@ -300,6 +300,11 @@
|
|||
</graphics>
|
||||
<sound model="ich6"/>
|
||||
<sound model="ac97"/>
|
||||
<sound model="ich6">
|
||||
<codec type="micro"/>
|
||||
<codec type="duplex"/>
|
||||
<codec type="output"/>
|
||||
</sound>
|
||||
<video>
|
||||
<model type="cirrus"/>
|
||||
</video>
|
||||
|
|
|
@ -533,6 +533,7 @@ c.add_compare(""" \
|
|||
\
|
||||
--soundhw default \
|
||||
--sound ac97 \
|
||||
--sound codec0.type=micro,codec1.type=duplex,codec2.type=output \
|
||||
\
|
||||
--video cirrus \
|
||||
--video model=qxl,vgamem=1,ram=2,vram=3,heads=4,accel3d=yes,vram64=65 \
|
||||
|
|
|
@ -2754,9 +2754,18 @@ class ParserSound(VirtCLIParser):
|
|||
return
|
||||
return VirtCLIParser._parse(self, inst)
|
||||
|
||||
def codec_find_inst_cb(self, *args, **kwargs):
|
||||
cliarg = "codec" # codec[0-9]*
|
||||
objpropname = "codecs"
|
||||
cb = self._make_find_inst_cb(cliarg, objpropname)
|
||||
return cb(*args, **kwargs)
|
||||
|
||||
_register_virt_parser(ParserSound)
|
||||
_add_device_address_args(ParserSound)
|
||||
ParserSound.add_arg("model", "model", ignore_default=True)
|
||||
# Options for sound.codecs config
|
||||
ParserSound.add_arg("type", "codec[0-9]*.type",
|
||||
find_inst_cb=ParserSound.codec_find_inst_cb)
|
||||
|
||||
|
||||
#####################
|
||||
|
|
|
@ -6,7 +6,16 @@
|
|||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .device import Device
|
||||
from ..xmlbuilder import XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
|
||||
|
||||
class _Codec(XMLBuilder):
|
||||
"""
|
||||
Class for generating <sound> child <codec> XML
|
||||
"""
|
||||
XML_NAME = "codec"
|
||||
|
||||
type = XMLProperty("./@type")
|
||||
|
||||
|
||||
class DeviceSound(Device):
|
||||
|
@ -25,3 +34,5 @@ class DeviceSound(Device):
|
|||
model = XMLProperty("./@model",
|
||||
default_cb=lambda s: "es1370",
|
||||
default_name=MODEL_DEFAULT)
|
||||
|
||||
codecs = XMLChildProperty(_Codec)
|
||||
|
|
Loading…
Reference in New Issue