virt-install: Add usbredir channels by default if using spice

Can be disabled with --redirdev none
This commit is contained in:
Cole Robinson 2014-02-05 12:58:53 -05:00
parent f635187bb8
commit 7a825d9a28
9 changed files with 54 additions and 11 deletions

View File

@ -54,5 +54,9 @@
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>

View File

@ -50,6 +50,10 @@
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>
<domain type="kvm">
@ -103,6 +107,10 @@
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>
<domain type="kvm">
@ -156,5 +164,9 @@
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>

View File

@ -35,5 +35,9 @@
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>

View File

@ -40,5 +40,9 @@
<video>
<model type="vga"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>

View File

@ -57,5 +57,9 @@
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>

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 --sound 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 --redirdev 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

@ -1389,21 +1389,15 @@ class vmmCreate(vmmGObjectUI):
else:
guest.skip_default_sound = True
guest.skip_default_usbredir = (
self.config.get_add_spice_usbredir() == "no")
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 (gdev and
self.config.get_add_spice_usbredir() == "yes" and
self.conn.check_support(self.conn.SUPPORT_CONN_USBREDIR)):
for ignore in range(4):
dev = virtinst.VirtualRedirDevice(guest.conn)
dev.bus = "usb"
dev.type = "spicevmc"
guest.add_device(dev)
if (((guest.conn.is_qemu() and guest.type == "kvm") or
guest.conn.is_test()) and
guest.os.is_x86() and

View File

@ -1733,7 +1733,6 @@ class ParserRedir(VirtCLIParser):
def _init_params(self):
self.devclass = virtinst.VirtualRedirDevice
self.remove_first = "bus"
self.check_none = True
self.set_param("bus", "bus")
self.set_param("type", "type")
@ -1744,6 +1743,12 @@ class ParserRedir(VirtCLIParser):
self.set_param(None, "server", setter_cb=set_server_cb)
def _parse(self, opts, inst):
if opts.fullopts == "none":
self.guest.skip_default_usbredir = True
return
return VirtCLIParser._parse(self, opts, inst)
#################
# --tpm parsing #

View File

@ -107,6 +107,7 @@ class Guest(XMLBuilder):
self.skip_default_console = False
self.skip_default_channel = False
self.skip_default_sound = False
self.skip_default_usbredir = False
self._os_variant = None
self._random_uuid = None
@ -875,6 +876,20 @@ class Guest(XMLBuilder):
return
self.add_default_sound_device()
def _add_spice_usbredir(self):
if self.skip_default_usbredir:
return
if self.get_devices("redirdev"):
return
if not self.conn.check_support(self.conn.SUPPORT_CONN_USBREDIR):
return
for ignore in range(4):
dev = virtinst.VirtualRedirDevice(self.conn)
dev.bus = "usb"
dev.type = "spicevmc"
self.add_device(dev)
def _set_video_defaults(self):
def has_spice():
for gfx in self.get_devices("graphics"):
@ -884,6 +899,7 @@ class Guest(XMLBuilder):
if has_spice():
self._add_spice_channels()
self._add_spice_sound()
self._add_spice_usbredir()
if has_spice() and self.os.is_x86():
video_model = "qxl"