[gnome-boxes] Remove USB redirection hacks for < Qemu 1.3
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Remove USB redirection hacks for < Qemu 1.3
- Date: Fri, 15 Jul 2016 14:54:07 +0000 (UTC)
commit 740f90b269a8267aeefd54e978a221d1beff13c6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri May 27 15:02:05 2016 +0100
Remove USB redirection hacks for < Qemu 1.3
Qemu 1.3 is now pretty old so let's just drop all code that deals with
lack of USB redirection in Qemu versions older than 1.3.
configure.ac | 9 --------
src/config.vapi | 1 -
src/libvirt-machine-properties.vala | 39 -----------------------------------
src/spice-display.vala | 2 +-
src/vm-configurator.vala | 16 +-------------
5 files changed, 2 insertions(+), 65 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1b7d76c..6bce782 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,14 +162,6 @@ LIBGD_INIT([
vapi
])
-AC_MSG_CHECKING([whether USB redirection was enabled with --enable-usbredir])
-AC_ARG_ENABLE(usbredir,
- AS_HELP_STRING([--enable-usbredir],[Enable usb redirection (requires qemu 1.3)]),,
- enable_usbredir=yes)
-AS_IF([test "x$enable_usbredir" = "xyes"],
- [AC_DEFINE([HAVE_USBREDIR], [1], [Qemu supports usbredir]) AC_MSG_RESULT([yes])],
- [AC_DEFINE([HAVE_USBREDIR], [0], [Qemu supports usbredir]) AC_MSG_RESULT([no])])
-
AC_MSG_CHECKING([whether smartcard support was enabled with --enable-smartcard])
AC_ARG_ENABLE(smartcard,
AS_HELP_STRING([--enable-smartcard],[Enable smartcard support]),,
@@ -223,7 +215,6 @@ AC_MSG_NOTICE([
prefix: ${prefix}
c compiler: ${CC} ${CFLAGS}
build from vala sources: $enable_vala
- USB redirection support: $enable_usbredir
Smartcard support: $enable_smartcard
oVirt support: $have_govirt
Installed tests: $enable_installed_tests
diff --git a/src/config.vapi b/src/config.vapi
index ccdedb6..bd66dd0 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -9,7 +9,6 @@ namespace Config {
public const string CACHEDIR;
public const string PACKAGE_BUGREPORT;
public const string PACKAGE_URL;
- public const bool HAVE_USBREDIR;
public const bool HAVE_SMARTCARD;
public const bool HAVE_OVIRT;
}
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 95b7825..c05d054 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -31,19 +31,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
}
}
- private void try_enable_usb_redir () throws GLib.Error {
- var config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
-
- // Remove any old usb configuration from old config
- VMConfigurator.remove_usb_controllers (config);
-
- // Add usb redirection channel and usb2 controllers
- VMConfigurator.add_usb_support (config);
-
- // This will take effect only after next reboot
- machine.domain.set_config (config);
- }
-
private void try_enable_smartcard () throws GLib.Error {
var config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
@@ -161,16 +148,10 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
add_cdrom_property (disk_config, ref list);
}
- bool has_usb_redir = false;
bool has_smartcard = false;
- // We look at the INACTIVE config here, because we want to show the usb
- // widgetry if usb has been added already but we have not rebooted
try {
var inactive_config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
foreach (var device in inactive_config.get_devices ()) {
- if (device is GVirConfig.DomainRedirdev) {
- has_usb_redir = true;
- }
if (device is GVirConfig.DomainSmartcard) {
has_smartcard = true;
}
@@ -181,26 +162,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
error.message);
}
- if (!has_usb_redir)
- flags |= PropertyCreationFlag.NO_USB;
-
- /* Only add usb support to guests if HAVE_USBREDIR, as older
- * qemu versions break migration with it. */
- if (!has_usb_redir && Config.HAVE_USBREDIR) {
- var button = new Gtk.Button.with_label (_("Add support to guest"));
- button.halign = Gtk.Align.START;
- var property = add_property (ref list, _("USB device support"), button);
- button.clicked.connect (() => {
- try {
- try_enable_usb_redir ();
- machine.update_domain_config ();
- property.refresh_properties ();
- property.reboot_required = true;
- } catch (GLib.Error error) {
- warning ("Failed to enable usb");
- }
- });
- }
// Only add smartcart support to guests if HAVE_SMARTCARD, as qemu built
// without smartcard support will not start vms with it.
diff --git a/src/spice-display.vala b/src/spice-display.vala
index a966e4f..b2b40e9 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -333,7 +333,7 @@ private class Boxes.SpiceDisplay: Boxes.Display {
break;
case PropertiesPage.DEVICES:
- if (PropertyCreationFlag.NO_USB in flags || !Config.HAVE_USBREDIR|| !connected)
+ if (PropertyCreationFlag.NO_USB in flags || !connected)
break;
try {
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 79442b7..9900394 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -84,9 +84,7 @@ private class Boxes.VMConfigurator {
channel.set_source (vmc);
domain.add_device (channel);
- // Only add usb support if we'er 100% sure it works, as it breaks migration (i.e. save) on older qemu
- if (Config.HAVE_USBREDIR)
- add_usb_support (domain);
+ add_usb_support (domain);
if (Config.HAVE_SMARTCARD)
add_smartcard_support (domain);
@@ -531,18 +529,6 @@ private class Boxes.VMConfigurator {
return controller;
}
- // Remove all existing usb controllers. This is used when upgrading from the old usb1 controllers to usb2
- public static void remove_usb_controllers (Domain domain) throws Boxes.Error {
- GLib.List<GVirConfig.DomainDevice> devices = null;
- foreach (var device in domain.get_devices ()) {
- if (!(device is DomainControllerUsb)) {
- devices.prepend (device);
- }
- }
- devices.reverse ();
- domain.set_devices (devices);
- }
-
private static CapabilitiesGuest get_best_guest_caps (Capabilities caps, InstallerMedia install_media)
throws VMConfiguratorError {
var guests_caps = caps.get_guests ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]