GNOME Bugzilla – Bug 666366
Suspend to disk on quit for (local) session VMs
Last modified: 2016-03-31 13:56:16 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.
Created attachment 204152 [details] [review] Save and suspend libvirt machines on quit
(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.
Created attachment 204785 [details] [review] Save and suspend libvirt machines on quit
Created attachment 204945 [details] [review] Save and suspend libvirt machines on quit
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.
(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).
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).
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.
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)
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
(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!
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