diff --git a/SOURCES/gnome-boxes-fix-mixing-vm-widgets.patch b/SOURCES/gnome-boxes-fix-mixing-vm-widgets.patch new file mode 100644 index 0000000..e673fa1 --- /dev/null +++ b/SOURCES/gnome-boxes-fix-mixing-vm-widgets.patch @@ -0,0 +1,77 @@ +From a9e6da0a18db07b94af30ced5e8c8b56737c9408 Mon Sep 17 00:00:00 2001 +From: Felipe Borges +Date: Wed, 8 Jul 2020 16:56:02 +0200 +Subject: [PATCH] machine: Prevent displays from overlapping each other + +When a machine display get connected/disconnected, we need to account +for what's the current_item being shown and only perform the widget +replacement when the current_item is the one that received those +signals. + +This is not an ideal solution if we later decide to support multiple +monitors, but it fixes various issues users have now with managing +multiple machines at the same time. + +To reproduce the most common of these issues you need: +1. Run at least two VMs simultaneously +2. Restart one VM +3. Jump to another VM +4. See the restarting VM take over the display (replacing the +current one). +--- + src/machine.vala | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/src/machine.vala b/src/machine.vala +index 795058f2..7526bdd3 100644 +--- a/src/machine.vala ++++ b/src/machine.vala +@@ -161,6 +161,7 @@ protected void show_display () { + var widget = display.get_display (0); + widget_remove (widget); + window.display_page.show_display (display, widget); ++ window.topbar.status = this.name; + widget.grab_focus (); + + store_auth_credentials (); +@@ -203,10 +204,13 @@ protected void show_display () { + // Translators: The %s will be expanded with the name of the vm + window.topbar.status = _("Connecting to %s").printf (name); + +- show_id = _display.show.connect ((id) => { show_display (); }); ++ show_id = _display.show.connect ((id) => { ++ if (window != null && window.current_item == this) ++ show_display (); ++ }); + + hide_id = _display.hide.connect ((id) => { +- if (window != null) ++ if (window != null && window.current_item == this) + window.display_page.remove_display (); + }); + +@@ -235,8 +239,9 @@ protected void show_display () { + } + + load_screenshot (); +- +- disconnect_display (); ++ if (!stay_on_display) { ++ disconnect_display (); ++ } + }); + + need_password_id = _display.notify["need-password"].connect (handle_auth); +@@ -402,7 +407,8 @@ public virtual void disconnect_display () { + } + } + +- window.display_page.remove_display (); ++ if (window.current_item == this) ++ window.display_page.remove_display (); + if (!display.should_keep_alive ()) { + display.disconnect_it (); + display = null; +-- +2.28.0 + diff --git a/SOURCES/gnome-boxes-pass-discard-unmap-to-disk.patch b/SOURCES/gnome-boxes-pass-discard-unmap-to-disk.patch new file mode 100644 index 0000000..45b4fca --- /dev/null +++ b/SOURCES/gnome-boxes-pass-discard-unmap-to-disk.patch @@ -0,0 +1,51 @@ +From 780525f32851c0daaf4250dc734ba73d1571c1c1 Mon Sep 17 00:00:00 2001 +From: Felipe Borges +Date: Mon, 2 Nov 2020 15:35:36 +0100 +Subject: [PATCH] vm-configurator: Pass discard "unmap" to virtio-blk disks + +Ever since QEMU 4.0, virtio-blk disks have discard support[0]. For +this reason, we don't need to migrate to virtio-scsi[1] to benefit from +discard support. + +See also https://chrisirwin.ca/posts/discard-with-kvm-2020/ + +[0] https://bugzilla.redhat.com/1672680 +[1] https://bugzilla.redhat.com/1152037 + +Fixes #35 +--- + src/vm-configurator.vala | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala +index ee8cf133..f2a50bb8 100644 +--- a/src/vm-configurator.vala ++++ b/src/vm-configurator.vala +@@ -343,16 +343,21 @@ public static void set_target_media_config (Domain domain, + var disk = new DomainDisk (); + disk.set_type (DomainDiskType.FILE); + disk.set_guest_device_type (DomainDiskGuestDeviceType.DISK); +- disk.set_driver_name ("qemu"); +- disk.set_driver_format (DomainDiskFormat.QCOW2); + disk.set_source (target_path); +- disk.set_driver_cache (DomainDiskCacheType.WRITEBACK); ++ ++ var driver = new DomainDiskDriver (); ++ driver.set_name ("qemu"); ++ driver.set_format (DomainDiskFormat.QCOW2); ++ driver.set_cache (DomainDiskCacheType.WRITEBACK); ++ disk.set_driver (driver); + + var dev_letter_str = ((char) (dev_index + 97)).to_string (); + if (install_media.supports_virtio_disk || install_media.supports_virtio1_disk) { + debug ("Using virtio controller for the main disk"); + disk.set_target_bus (DomainDiskBus.VIRTIO); + disk.set_target_dev ("vd" + dev_letter_str); ++ ++ driver.set_discard (DomainDiskDriverDiscard.UNMAP); + } else { + if (install_media.prefers_q35) { + debug ("Using SATA controller for the main disk"); +-- +2.26.2 + diff --git a/SPECS/gnome-boxes.spec b/SPECS/gnome-boxes.spec index 8e39f3b..597ed9f 100644 --- a/SPECS/gnome-boxes.spec +++ b/SPECS/gnome-boxes.spec @@ -31,7 +31,7 @@ ExclusiveArch: x86_64 Name: gnome-boxes Version: 3.36.5 -Release: 6%{?dist} +Release: 8%{?dist} Summary: A simple GNOME 3 application to access remote or virtual systems License: LGPLv2+ @@ -45,6 +45,10 @@ Patch1: gnome-boxes-dont-be-critical.patch # https://bugzilla.redhat.com/1856717 Patch2: gnome-boxes-disable-3d-acceleration.patch Patch3: gnome-boxes-download-on-activate-signal.patch +# https://bugzilla.redhat.com/1639163 +Patch4: gnome-boxes-fix-mixing-vm-widgets.patch +# https://bugzilla.redhat.com/1152037 +Patch5: gnome-boxes-pass-discard-unmap-to-disk.patch BuildRequires: gettext >= 0.19.8 BuildRequires: meson @@ -121,6 +125,8 @@ gnome-boxes lets you easily create, setup, access, and use: %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build %meson \ @@ -160,6 +166,14 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.Boxes.deskt %{_datadir}/metainfo/org.gnome.Boxes.appdata.xml %changelog +* Mon Nov 02 2020 Felipe Borges - 3.36.5-8 +- Pass discard "unmap" to supported disk drivers +- Related: #1152037 + +* Mon Nov 02 2020 Felipe Borges - 3.36.5-7 +- Fix mixing VM widgets +- Related: #1639163 + * Mon Aug 10 2020 Felipe Borges - 3.36.5-6 - Start downloads on the Assistant when pressing ENTER - Related: #1851089