[gnome-boxes] vm-creator: Track installation using num. of reboots



commit d62ce99a15193f96bd37149c64e25d916127d1da
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Oct 3 06:03:03 2012 +0300

    vm-creator: Track installation using num. of reboots
    
    For known OSs, make use of the new libosinfo API to track installations
    by simply counting the number of reboots the VM takes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685346

 configure.ac        |    2 +-
 src/vm-creator.vala |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3681089..6cb33db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ LIBVIRT_GCONFIG_MIN_VERSION=0.1.0
 LIBXML2_MIN_VERSION=2.7.8
 SPICE_GTK_MIN_VERSION=0.12.101
 GUDEV_MIN_VERSION=165
-OSINFO_MIN_VERSION=0.2.0
+OSINFO_MIN_VERSION=0.2.1
 TRACKER_SPARQL=0.13.1
 UUID_REQUIRED=1.41.3
 LIBSOUP_REQUIRED=2.38
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index f7d8117..69f3e98 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -13,6 +13,8 @@ private class Boxes.VMCreator {
     private Connection? connection { get { return App.app.default_connection; } }
     private ulong state_changed_id;
 
+    private uint num_reboots { get; private set; }
+
     public VMCreator (InstallerMedia install_media) {
         this.install_media = install_media;
     }
@@ -106,7 +108,9 @@ private class Boxes.VMCreator {
             return;
         }
 
-        if (guest_installed_os (machine.storage_volume)) {
+        num_reboots++;
+
+        if (guest_installed_os (machine)) {
             set_post_install_config (machine);
             try {
                 domain.start (0);
@@ -151,11 +155,17 @@ private class Boxes.VMCreator {
         }
     }
 
-    private bool guest_installed_os (StorageVol volume) {
+
+    private bool guest_installed_os (LibvirtMachine machine) {
+        var volume = machine.storage_volume;
+
         try {
             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))
+                return (num_reboots == install_media.os_media.installer_reboots);
             else {
                 var info = volume.get_info ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]