[gnome-boxes/delete-efi-guests] libvirt-machine: Properly undefine/delete EFI guests




commit 4384a821410ed7bba82c674720b75f2863fb92ae
Author: Felipe Borges <felipeborges gnome org>
Date:   Fri Jul 31 11:05:36 2020 +0200

    libvirt-machine: Properly undefine/delete EFI guests
    
    Requires https://gitlab.com/libvirt/libvirt-glib/-/commit/fdd05bcbf
    
    We need a libvirt-glib release https://gitlab.com/libvirt/libvirt-glib/-/issues/1
    to be able to drop the FLATPAK specifics and be able to undefine
    nvram domains everywhere.
    
    Fixes #588

 ...libvirt-glib-add-gvir-domain-delete-nvram.patch | 31 ++++++++++++++++++++++
 build-aux/flatpak/org.gnome.Boxes.json             |  4 +++
 src/libvirt-machine.vala                           |  7 +++++
 3 files changed, 42 insertions(+)
---
diff --git a/build-aux/flatpak/libvirt-glib-add-gvir-domain-delete-nvram.patch 
b/build-aux/flatpak/libvirt-glib-add-gvir-domain-delete-nvram.patch
new file mode 100644
index 00000000..89eafc7f
--- /dev/null
+++ b/build-aux/flatpak/libvirt-glib-add-gvir-domain-delete-nvram.patch
@@ -0,0 +1,31 @@
+From fdd05bcbf2b0f037daf0b1178c0538350e4cd7b6 Mon Sep 17 00:00:00 2001
+From: Felipe Borges <felipeborges gnome org>
+Date: Wed, 25 Mar 2020 16:49:43 +0100
+Subject: [PATCH] GVirDomain: Add GVIR_DOMAIN_DELETE_{REMOVE,KEEP}_NVRAM
+
+These are mapped respectively to VIR_DOMAIN_UNDEFINE_NVRAM and
+VIR_DOMAIN_UNDEFINE_KEEP_NVRAM.
+
+Fixes issues such as https://bugzilla.redhat.com/1817031
+
+Signed-off-by: Felipe Borges <feborges redhat com>
+---
+ libvirt-gobject/libvirt-gobject-domain.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
+index 099cde3..8e55d17 100644
+--- a/libvirt-gobject/libvirt-gobject-domain.h
++++ b/libvirt-gobject/libvirt-gobject-domain.h
+@@ -104,6 +104,8 @@ typedef enum {
+     GVIR_DOMAIN_DELETE_NONE               = 0,
+     GVIR_DOMAIN_DELETE_SAVED_STATE        = VIR_DOMAIN_UNDEFINE_MANAGED_SAVE,
+     GVIR_DOMAIN_DELETE_SNAPSHOTS_METADATA = VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
++    GVIR_DOMAIN_DELETE_REMOVE_NVRAM       = VIR_DOMAIN_UNDEFINE_NVRAM,
++    GVIR_DOMAIN_DELETE_KEEP_NVRAM         = VIR_DOMAIN_UNDEFINE_KEEP_NVRAM,
+ } GVirDomainDeleteFlags;
+ 
+ /**
+-- 
+2.26.2
+
diff --git a/build-aux/flatpak/org.gnome.Boxes.json b/build-aux/flatpak/org.gnome.Boxes.json
index e8244e4b..8b53caed 100644
--- a/build-aux/flatpak/org.gnome.Boxes.json
+++ b/build-aux/flatpak/org.gnome.Boxes.json
@@ -183,6 +183,10 @@
                     "type" : "archive",
                     "url" : "https://libvirt.org/sources/glib/libvirt-glib-3.0.0.tar.gz";,
                     "sha256" : "7fff8ca9a2b723dbfd04223b1c7624251c8bf79eb57ec27362a7301b2dd9ebfe"
+                },
+                {
+                    "type" : "patch",
+                    "path" : "libvirt-glib-add-gvir-domain-delete-nvram.patch"
                 }
             ]
         },
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 8fe653ff..28fa7878 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -515,8 +515,15 @@ public override void delete (bool by_user = true) {
             App.app.async_launcher.launch.begin ( () => {
                 try {
                     // This undefines the domain, causing it to be transient if it was running
+#if FLATPAK
+                    domain.delete (DomainDeleteFlags.SAVED_STATE |
+                                   DomainDeleteFlags.SNAPSHOTS_METADATA |
+                                   DomainDeleteFlags.REMOVE_NVRAM);
+#else
+                    // This can go away once libvirt-glib gets a new release 
https://gitlab.com/libvirt/libvirt-glib/-/issues/1
                     domain.delete (DomainDeleteFlags.SAVED_STATE |
                                    DomainDeleteFlags.SNAPSHOTS_METADATA);
+#endif
                 } catch (GLib.Error err) {
                     warning (err.message);
                 }


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