Thanks, I pushed with the following changes: - Add --sound to the title to make it more clear On 06/11/2018 11:48 AM, Anya Harter wrote: > 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@xxxxxxxxxx> > --- > .../compare/virt-install-singleton-config-2.xml | 10 ++++++++++ > tests/clitest.py | 1 + > virtinst/cli.py | 9 +++++++++ > virtinst/devices/sound.py | 14 +++++++++++++- > 4 files changed, 33 insertions(+), 1 deletion(-) > > diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml > index ec36f215..f4cd21ab 100644 > --- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml > +++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml > @@ -144,6 +144,11 @@ > </backend> > </tpm> > <graphics type="vnc" port="-1"/> > + <sound model="ich6"> > + <codec type="micro"/> > + <codec type="duplex"/> > + <codec type="output"/> > + </sound> > <watchdog model="ib700" action="pause"/> > <memballoon model="virtio"/> > <rng model="virtio"> > @@ -313,6 +318,11 @@ > </backend> > </tpm> > <graphics type="vnc" port="-1"/> > + <sound model="ich6"> > + <codec type="micro"/> > + <codec type="duplex"/> > + <codec type="output"/> > + </sound> > <watchdog model="ib700" action="pause"/> > <memballoon model="virtio"/> > <rng model="virtio"> > diff --git a/tests/clitest.py b/tests/clitest.py > index c84156f9..1985c32d 100644 > --- a/tests/clitest.py > +++ b/tests/clitest.py > @@ -445,6 +445,7 @@ cache.mode=emulate,cache.level=3 \ > --controller usb3 \ > --controller virtio-scsi \ > --graphics vnc \ > +--sound codec0.type=micro,codec1.type=duplex,codec2.type=output \ > --filesystem /foo/source,/bar/target \ > --memballoon virtio \ > --watchdog ib700,action=pause \ I moved this to the test-many-devices test case, it's better suited for these option strings. > diff --git a/virtinst/cli.py b/virtinst/cli.py > index 0bee94a9..00c4f1b4 100644 > --- a/virtinst/cli.py > +++ b/virtinst/cli.py > @@ -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) > > > ##################### > diff --git a/virtinst/devices/sound.py b/virtinst/devices/sound.py > index e0f710a8..7ac50914 100644 > --- a/virtinst/devices/sound.py > +++ b/virtinst/devices/sound.py > @@ -6,7 +6,17 @@ > # 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" > + _XML_PROP_ORDER = ["type"] > + > + type = XMLProperty("./@type") > _XML_PROP_ORDER isn't adding anything here with just one property defined, so I dropped it. Thanks, Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list