[gnome-boxes] libvirt-machine-props: Allow rebooting saved VMs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] libvirt-machine-props: Allow rebooting saved VMs
- Date: Tue, 2 Apr 2013 14:08:54 +0000 (UTC)
commit 61d28c7e7a067eadd9e80e1b3270a3f3746edbc3
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Mar 15 16:56:48 2013 +0200
libvirt-machine-props: Allow rebooting saved VMs
Currently, if user changes the properties of a saved VM that require
reboot to take effect, we don't offer user the option to reboot. As a
result the properties are not in effect when user restores the VM, which
is contrary to what she/he will expect.
This patch:
* offers user the option to reboot saved VMs.
* if user chooses to reboot, the VM is first restored and then rebooted.
https://bugzilla.gnome.org/show_bug.cgi?id=696242
src/libvirt-machine-properties.vala | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 9d3d129..1480fc0 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -453,7 +453,7 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
}
private void notify_reboot_required () {
- if (!machine.is_on ())
+ if (!machine.is_on () && machine.state != Machine.MachineState.SAVED)
return;
var message = _("Changes require restart of '%s'. Attempt restart?").printf (machine.name);
@@ -461,10 +461,24 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
}
private void reboot () {
- debug ("Rebooting '%s'..", machine.name);
+ if (machine.state == Machine.MachineState.SAVED) {
+ debug ("'%s' is in saved state. Resuming it..", machine.name);
+ machine.start.begin (Machine.ConnectFlags.NONE, (obj, res) => {
+ try {
+ machine.start.end (res);
+ reboot ();
+ } catch (GLib.Error error) {
+ warning ("Failed to start '%s': %s", machine.domain.get_name (), error.message);
+ }
+ });
+
+ return;
+ }
+
machine.stay_on_display = true;
ulong state_id = 0;
Gd.Notification notification = null;
+ debug ("Rebooting '%s'..", machine.name);
state_id = machine.notify["state"].connect (() => {
if (machine.state == Machine.MachineState.STOPPED ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]