[gnome-boxes] Remove smartcard hacks for old Qemu



commit 6bf871c4e220cb4c32f7d96c143618e6f5b680cb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri May 27 15:02:05 2016 +0100

    Remove smartcard hacks for old Qemu
    
    Just like the previous patch, where we removed hacks for lack of USB
    direction in Qemu < 1.3, in this patch we do the same for smartcards. I do
    not know when smartcard support was added in Qemu but it was definitely
    even before USB redirection so this is even safer than USB redirection
    patch.

 configure.ac                        |    9 -------
 src/config.vapi                     |    1 -
 src/libvirt-machine-properties.vala |   42 -----------------------------------
 src/vm-configurator.vala            |    4 +--
 4 files changed, 1 insertions(+), 55 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6bce782..19b0f66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,14 +162,6 @@ LIBGD_INIT([
   vapi
 ])
 
-AC_MSG_CHECKING([whether smartcard support was enabled with --enable-smartcard])
-AC_ARG_ENABLE(smartcard,
-       AS_HELP_STRING([--enable-smartcard],[Enable smartcard support]),,
-        enable_smartcard=no)
-AS_IF([test "x$enable_smartcard" = "xyes"],
-      [AC_DEFINE([HAVE_SMARTCARD], [1], [Qemu supports smartcard]) AC_MSG_RESULT([yes])],
-      [AC_DEFINE([HAVE_SMARTCARD], [0], [Qemu supports smartcard]) AC_MSG_RESULT([no])])
-
 dnl Strict compiler
 AC_ARG_ENABLE([strict-cc],
   AS_HELP_STRING([--enable-strict-cc],[Enable strict C compiler]))
@@ -215,7 +207,6 @@ AC_MSG_NOTICE([
         prefix:                   ${prefix}
         c compiler:               ${CC} ${CFLAGS}
         build from vala sources:  $enable_vala
-        Smartcard support:        $enable_smartcard
         oVirt support:            $have_govirt
         Installed tests:          $enable_installed_tests
 ])
diff --git a/src/config.vapi b/src/config.vapi
index bd66dd0..36e7065 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -9,6 +9,5 @@ namespace Config {
         public const string CACHEDIR;
         public const string PACKAGE_BUGREPORT;
         public const string PACKAGE_URL;
-        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 c05d054..3c06b76 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -31,15 +31,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
         }
     }
 
-    private void try_enable_smartcard () throws GLib.Error {
-        var config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
-
-        VMConfigurator.add_smartcard_support (config);
-
-        // This will take effect only after next reboot
-        machine.domain.set_config (config);
-    }
-
     private string collect_logs () {
         var builder = new StringBuilder ();
 
@@ -148,39 +139,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
                     add_cdrom_property (disk_config, ref list);
             }
 
-            bool has_smartcard = false;
-            try {
-                var inactive_config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
-                foreach (var device in inactive_config.get_devices ()) {
-                    if (device is GVirConfig.DomainSmartcard) {
-                        has_smartcard = true;
-                    }
-                }
-            } catch (GLib.Error error) {
-                warning ("Failed to fetch configuration for domain '%s': %s",
-                         machine.domain.get_name (),
-                         error.message);
-            }
-
-
-            // Only add smartcart support to guests if HAVE_SMARTCARD, as qemu built
-            // without smartcard support will not start vms with it.
-            if (!has_smartcard && Config.HAVE_SMARTCARD) {
-                var button = new Gtk.Button.with_label (_("Add support to guest"));
-                button.halign = Gtk.Align.START;
-                var property = add_property (ref list, _("Smartcard support"), button);
-                button.clicked.connect (() => {
-                    try {
-                        try_enable_smartcard ();
-                        machine.update_domain_config ();
-                        property.refresh_properties ();
-                        property.reboot_required = true;
-                    } catch (GLib.Error error) {
-                        warning ("Failed to enable smartcard");
-                    }
-                });
-            }
-
             break;
 
         case PropertiesPage.SNAPSHOTS:
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 9900394..3efe1e6 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -85,9 +85,7 @@ private class Boxes.VMConfigurator {
         domain.add_device (channel);
 
         add_usb_support (domain);
-
-        if (Config.HAVE_SMARTCARD)
-            add_smartcard_support (domain);
+        add_smartcard_support (domain);
 
         set_video_config (domain, install_media);
         set_sound_config (domain, install_media);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]