virt-install: If using spice graphics, add <sound> by default

Can be disabled with --sound none
This commit is contained in:
Cole Robinson 2014-02-05 12:49:16 -05:00
parent e70ab961f9
commit f635187bb8
6 changed files with 31 additions and 15 deletions

View File

@ -50,6 +50,7 @@
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<sound model="ich6"/>
<video>
<model type="qxl"/>
</video>

View File

@ -53,6 +53,7 @@
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<sound model="ich6"/>
<video>
<model type="qxl"/>
</video>

View File

@ -520,7 +520,7 @@ c.add_valid("--nodisks --boot hd --paravirt --arch i686") # 32 on 64 xen
c = vinst.add_category("kvm", "--connect %(KVMURI)s --noautoconsole")
c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host --channel none --console none", "kvm-f14-url") # F14 Directory tree URL install with extra-args
c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host --channel none --console none --sound none", "kvm-f14-url") # F14 Directory tree URL install with extra-args
c.add_compare("--os-variant fedora20 --disk %(NEWIMG1)s,size=.01 --location %(TREEDIR)s --extra-args console=ttyS0 --quiet", "quiet-url") # Quiet URL install should make no noise
c.add_compare("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound --controller usb", "kvm-win2k3-cdrom") # HVM windows install with disk
c.add_compare("--os-variant fedora20 --nodisks --boot hd --paravirt", "kvm-xenner") # xenner

View File

@ -1384,15 +1384,17 @@ class vmmCreate(vmmGObjectUI):
if gdev:
guest.add_device(gdev)
if self.config.get_new_vm_sound():
guest.add_default_sound_device()
else:
guest.skip_default_sound = True
guest.add_default_video_device()
guest.add_default_input_device()
guest.add_default_console_device()
guest.add_default_usb_controller()
guest.add_default_channels()
if self.config.get_new_vm_sound():
guest.add_default_sound_device()
if (gdev and
self.config.get_add_spice_usbredir() == "yes" and
self.conn.check_support(self.conn.SUPPORT_CONN_USBREDIR)):

View File

@ -1973,9 +1973,9 @@ class ParserVideo(VirtCLIParser):
self.set_param("model", "model", ignore_default=True)
#####################
###################
# --sound parsing #
#####################
###################
class ParserSound(VirtCLIParser):
def _init_params(self):
@ -1984,6 +1984,12 @@ class ParserSound(VirtCLIParser):
self.set_param("model", "model", ignore_default=True)
def _parse(self, opts, inst):
if opts.fullopts == "none":
self.guest.skip_default_sound = True
return
return VirtCLIParser._parse(self, opts, inst)
#####################
# --hostdev parsing #

View File

@ -106,6 +106,7 @@ class Guest(XMLBuilder):
self.skip_default_console = False
self.skip_default_channel = False
self.skip_default_sound = False
self._os_variant = None
self._random_uuid = None
@ -615,9 +616,9 @@ class Guest(XMLBuilder):
self._set_disk_defaults()
self._set_net_defaults()
self._set_input_defaults()
self._set_sound_defaults()
self._set_graphics_defaults()
self._set_video_defaults()
self._set_sound_defaults()
def _set_osxml_defaults(self):
if self.os.is_container() and not self.os.init:
@ -855,21 +856,25 @@ class Guest(XMLBuilder):
gfx.type = gtype
def _add_spice_channels(self):
def has_spice_agent():
for chn in self.get_devices("channel"):
if chn.type == chn.TYPE_SPICEVMC:
return True
if self.skip_default_channel:
return
if (not has_spice_agent() and
self.conn.check_support(
self.conn.SUPPORT_CONN_CHAR_SPICEVMC)):
for chn in self.get_devices("channel"):
if chn.type == chn.TYPE_SPICEVMC:
return
if self.conn.check_support(self.conn.SUPPORT_CONN_CHAR_SPICEVMC):
agentdev = virtinst.VirtualChannelDevice(self.conn)
agentdev.type = agentdev.TYPE_SPICEVMC
self.add_device(agentdev)
def _add_spice_sound(self):
if self.skip_default_sound:
return
if self.get_devices("sound"):
return
self.add_default_sound_device()
def _set_video_defaults(self):
def has_spice():
for gfx in self.get_devices("graphics"):
@ -878,6 +883,7 @@ class Guest(XMLBuilder):
if has_spice():
self._add_spice_channels()
self._add_spice_sound()
if has_spice() and self.os.is_x86():
video_model = "qxl"