[gnome-boxes] libvirt: use hard reboot/restart
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] libvirt: use hard reboot/restart
- Date: Mon, 30 Jul 2012 17:14:30 +0000 (UTC)
commit ade9c1bce91584af40e5562bd386669fe8ab03a3
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Thu Jul 19 19:46:53 2012 +0200
libvirt: use hard reboot/restart
Make sure the qemu process is restarted to take changes into effect
https://bugzilla.gnome.org/show_bug.cgi?id=680293
src/libvirt-machine.vala | 38 ++++++++++++++++++++++++++------------
1 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index a94ec94..245f51d 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -28,17 +28,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
return;
_connect_display = true;
- try {
- if (state != MachineState.RUNNING) {
- if (state == MachineState.PAUSED) {
- domain.resume ();
- } else {
- domain.start (0);
- }
- }
- } catch (GLib.Error error) {
- warning (error.message);
- }
+ start ();
update_display ();
display.connect_it ();
@@ -530,11 +520,35 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
});
}
+ public void start () {
+ if (state == MachineState.RUNNING)
+ return;
+
+ try {
+ if (state == MachineState.PAUSED)
+ domain.resume ();
+ else
+ domain.start (0);
+ } catch (GLib.Error error) {
+ warning ("Failed to start '%s': %s", domain.get_name (), error.message);
+ }
+ }
+
private void notify_reboot_required () {
Notificationbar.OKFunc reboot = () => {
debug ("Rebooting '%s'..", name);
+ stay_on_display = true;
+ ulong state_id = 0;
+ state_id = this.notify["state"].connect (() => {
+ if (state == MachineState.STOPPED) {
+ start ();
+ this.disconnect (state_id);
+ }
+ });
+
try {
- domain.reboot (0);
+ domain.shutdown (GVir.DomainShutdownFlags.ACPI_POWER_BTN |
+ GVir.DomainShutdownFlags.GUEST_AGENT);
} catch (GLib.Error error) {
warning ("Failed to reboot '%s': %s", domain.get_name (), error.message);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]