[gnome-boxes] wizard: Show allocated resources at 'review' page



commit 2c87e1949d1611aa12b0d9618749f64596538201
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Aug 31 02:00:57 2012 +0300

    wizard: Show allocated resources at 'review' page
    
    We were showing resources dictated by installer media, which until now
    has meant the same thing but it wont after we allow users to modify
    resource allocation in wizard.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672554

 src/wizard.vala |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/src/wizard.vala b/src/wizard.vala
index def56a6..24c40cf 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -357,14 +357,32 @@ private class Boxes.Wizard: Boxes.UI {
             if (source.source_type == "libvirt") {
                 review_label.set_text (_("Will add boxes for all systems available from this account:"));
             }
-        } else if (vm_creator != null) {
+        } else if (machine != null) {
             foreach (var property in vm_creator.install_media.get_vm_properties ())
                 summary.add_property (property.first, property.second);
 
-            var memory = format_size (vm_creator.install_media.resources.ram, FormatSizeFlags.IEC_UNITS);
-            summary.add_property (_("Memory"), memory);
-            memory = format_size (vm_creator.install_media.resources.storage, FormatSizeFlags.IEC_UNITS);
-            summary.add_property (_("Disk"),  _("%s maximum".printf (memory)));
+            try {
+                var config = null as GVirConfig.Domain;
+                yield run_in_thread (() => { config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE); });
+
+                var memory = format_size (config.memory * Osinfo.KIBIBYTES, FormatSizeFlags.IEC_UNITS);
+                summary.add_property (_("Memory"), memory);
+            } catch (GLib.Error error) {
+                warning ("Failed to get configuration for machine '%s': %s", machine.name, error.message);
+            }
+
+            if (machine.storage_volume != null) {
+                try {
+                    var volume_info = machine.storage_volume.get_info ();
+                    var capacity = format_size (volume_info.capacity, FormatSizeFlags.IEC_UNITS);
+                    summary.add_property (_("Disk"),  _("%s maximum".printf (capacity)));
+                } catch (GLib.Error error) {
+                    warning ("Failed to get information on volume '%s': %s",
+                             machine.storage_volume.get_name (),
+                             error.message);
+                }
+            }
+
             nokvm_label.visible = (machine.domain_config.get_virt_type () != GVirConfig.DomainVirtType.KVM);
         }
 



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