After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 666366 - Suspend to disk on quit for (local) session VMs
Suspend to disk on quit for (local) session VMs
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
3.3.x (unsupported)
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-12-16 15:27 UTC by Zeeshan Ali
Modified: 2016-03-31 13:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Save and suspend libvirt machines on quit (1.21 KB, patch)
2011-12-23 20:02 UTC, Zeeshan Ali
none Details | Review
Save and suspend libvirt machines on quit (1.20 KB, patch)
2012-01-06 21:48 UTC, Zeeshan Ali
none Details | Review
Save and suspend libvirt machines on quit (1.20 KB, patch)
2012-01-10 15:05 UTC, Zeeshan Ali
accepted-commit_now Details | Review
Re-use local session libvirt connection (3.75 KB, patch)
2012-01-11 23:28 UTC, Zeeshan Ali
committed Details | Review
Save default libvirt connection machines on quit (3.04 KB, patch)
2012-01-11 23:28 UTC, Zeeshan Ali
committed Details | Review

Description Zeeshan Ali 2011-12-16 15:27:50 UTC
Since the (main) target usage of Boxes (like some other GNOME3 apps) is that user will run it full-screen on a separate workspace, quiting of UI implies that user is no longer interested in using VMs for that session unless she/he decides otherwise later. Therefore we should suspend all local VMs to disk when user quits Boxes.
Comment 1 Zeeshan Ali 2011-12-23 20:02:44 UTC
Created attachment 204152 [details] [review]
Save and suspend libvirt machines on quit
Comment 2 Zeeshan Ali 2011-12-23 20:04:32 UTC
(In reply to comment #1)
> Created an attachment (id=204152) [details] [review]
> Save and suspend libvirt machines on quit

This requires my 'API to save and suspend' to libvirt-glib patch that is awaiting review on libvir-list mailing-list.
Comment 3 Zeeshan Ali 2012-01-06 21:48:13 UTC
Created attachment 204785 [details] [review]
Save and suspend libvirt machines on quit
Comment 4 Zeeshan Ali 2012-01-10 15:05:22 UTC
Created attachment 204945 [details] [review]
Save and suspend libvirt machines on quit
Comment 5 Marc-Andre Lureau 2012-01-10 15:18:32 UTC
Review of attachment 204945 [details] [review]:

Looks good, although I would do it only on local qemu:///session, that is the one we really created/manage.

Could be done in a follow-up patch.
Comment 6 Zeeshan Ali 2012-01-10 15:27:36 UTC
(In reply to comment #5)
> Review of attachment 204945 [details] [review]:
> 
> Looks good, although I would do it only on local qemu:///session, that is the
> one we really created/manage.
> 
> Could be done in a follow-up patch.

Yeah. Before we implement that, I think we should add the concept/api of 'default_domain' in the App class (a prop that gets the first connection in connection list?) and that is by default local 'qemu:///session'. We should then use it from VMCreator as well (instead of it creating a separate connection).
Comment 7 Zeeshan Ali 2012-01-11 23:28:00 UTC
Created attachment 205052 [details] [review]
Re-use local session libvirt connection

This change also introduces the concept of 'default_connection' which by
default means 'qemu:///session' but could be easily configured to use
some other libvirt connection by modifying the "QEMU Session" file
(hence the reason why connection hashtable now uses name rather than
uris as keys).
Comment 8 Zeeshan Ali 2012-01-11 23:28:05 UTC
Created attachment 205053 [details] [review]
Save default libvirt connection machines on quit

On quit, save and suspend machines belonging to default libvirt
connection. This setting can be overridden by setting boolean prop
'save-on-quit' to false in the source file. If disabled, the machines in
question are only suspended but not saved.
Comment 9 Marc-Andre Lureau 2012-01-12 01:11:47 UTC
Review of attachment 205053 [details] [review]:

small comment, ack otherwise

::: src/libvirt-machine.vala
@@ +339,3 @@
+
+    public async void suspend () throws GLib.Error {
+        (save_on_quit) ? yield domain.save_async (0, null) : domain.suspend ();

why do you add parenthesis around (save_on_quit)
Comment 10 Marc-Andre Lureau 2012-01-12 01:15:42 UTC
Review of attachment 205052 [details] [review]:

although hard coding "QEMU Session" in default_connection getter isn't so great, the direction is good, and I don't really have a good idea atm

ack
Comment 11 Zeeshan Ali 2012-01-12 01:29:44 UTC
(In reply to comment #9)
> Review of attachment 205053 [details] [review]:
> 
> small comment, ack otherwise
> 
> ::: src/libvirt-machine.vala
> @@ +339,3 @@
> +
> +    public async void suspend () throws GLib.Error {
> +        (save_on_quit) ? yield domain.save_async (0, null) : domain.suspend
> ();
> 
> why do you add parenthesis around (save_on_quit)

I tried without parens first but valac didn't like it.

> although hard coding "QEMU Session" in default_connection getter isn't so
> great, the direction is good, and I don't really have a good idea atm

Agreed!
Comment 12 Zeeshan Ali 2012-01-12 01:31:47 UTC
Attachment 205052 [details] pushed as f7de98b - Re-use local session libvirt connection
Attachment 205053 [details] pushed as 25b57ee - Save default libvirt connection machines on quit