[gnome-boxes] libvirt-machine: Don't leak volume on failed stop or delete
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] libvirt-machine: Don't leak volume on failed stop or delete
- Date: Thu, 30 Aug 2012 12:15:11 +0000 (UTC)
commit d78d4313ee98bcfd8c02266623fcfec78c67cffe
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Aug 29 00:02:11 2012 +0300
libvirt-machine: Don't leak volume on failed stop or delete
If domain is already stopped, attempting to stop it will fail. Put all
clean-up operations related to deletion in their own try/catch block so
failure of one doesn't mean the others wont be executed.
https://bugzilla.gnome.org/show_bug.cgi?id=682901
src/libvirt-machine.vala | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index b819482..0d7c97f 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -389,16 +389,26 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
to avoid blocking the UI */
run_in_thread.begin ( () => {
try {
- // This undefines the domain, causing it to be transient
+ // This undefines the domain, causing it to be transient if it was running
domain.delete (DomainDeleteFlags.SAVED_STATE);
+ } catch (GLib.Error err) {
+ warning (err.message);
+ }
+
+ try {
// Ensure that the domain is stopped before we touch any data
domain.stop (0);
- // Remove any images controlled by boxes
- if (volume != null)
- volume.delete (0);
} catch (GLib.Error err) {
- warning (err.message);
+ debug (err.message); // No warning cause this can easily fail for legitimate reasons
}
+
+ // Remove any images controlled by boxes
+ if (volume != null)
+ try {
+ volume.delete (0);
+ } catch (GLib.Error err) {
+ warning (err.message);
+ }
});
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]