[gnome-boxes] vm-creator: Info on install media now guaranteed
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] vm-creator: Info on install media now guaranteed
- Date: Mon, 26 Nov 2012 16:21:51 +0000 (UTC)
commit 6c112d3268d388a8306595864e8224fcd49b6c2d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Nov 20 21:51:31 2012 +0200
vm-creator: Info on install media now guaranteed
After this patch, VMCreator instance always have access to information
on original installation media even if Boxes is quit during
installation/live session.
https://bugzilla.gnome.org/show_bug.cgi?id=688770
src/vm-creator.vala | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 580183d..69d40d8 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -20,12 +20,7 @@ private class Boxes.VMCreator {
}
public VMCreator.for_install_completion (LibvirtMachine machine) {
- state_changed_id = machine.notify["state"].connect (on_machine_state_changed);
- machine.vm_creator = this;
- update_machine_info (machine);
-
- if (machine.state == Machine.MachineState.SAVED && VMConfigurator.is_install_config (machine.domain_config))
- machine.domain.start_async.begin (0, null);
+ continue_installation.begin (machine);
}
public async LibvirtMachine create_vm (Cancellable? cancellable) throws GLib.Error {
@@ -82,6 +77,23 @@ private class Boxes.VMCreator {
update_machine_info (machine);
}
+ private async void continue_installation (LibvirtMachine machine) {
+ install_media = yield MediaManager.get_instance ().create_installer_media_from_config (machine.domain_config);
+
+ state_changed_id = machine.notify["state"].connect (on_machine_state_changed);
+ machine.vm_creator = this;
+ update_machine_info (machine);
+
+ on_machine_state_changed (machine);
+
+ if (machine.state == Machine.MachineState.SAVED && VMConfigurator.is_install_config (machine.domain_config))
+ try {
+ yield machine.domain.start_async (0, null);
+ } catch (GLib.Error e) {
+ warning ("Failed to start '%s': %s", machine.name, e.message);
+ }
+ }
+
private void on_machine_state_changed (GLib.Object object, GLib.ParamSpec? pspec = null) {
var machine = object as LibvirtMachine;
@@ -162,8 +174,7 @@ private class Boxes.VMCreator {
if (install_trackable ())
// Great! We know how much storage installed guest consumes
return get_progress (volume) == INSTALL_COMPLETE_PERCENT;
- else if (install_media != null && install_media.os_media != null &&
- VMConfigurator.is_install_config (machine.domain_config))
+ else if (install_media.os_media != null && VMConfigurator.is_install_config (machine.domain_config))
return (num_reboots == install_media.os_media.installer_reboots);
else {
var info = volume.get_info ();
@@ -222,7 +233,7 @@ private class Boxes.VMCreator {
}
private bool install_trackable () {
- return (install_media != null && install_media.installed_size > 0);
+ return (install_media.installed_size > 0);
}
private int get_progress (GVir.StorageVol volume) throws GLib.Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]