[gnome-boxes] Fix memory customization



commit c72b44334c410503ef072c822fc6f93a967d81e1
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Tue Sep 11 13:25:06 2012 +0200

    Fix memory customization
    
    libvirt uses 2 XML elements to set memory, a /domain/memory node,
    and a /domain/currentMemory node. The former sets the maximum amount
    available, and the latter sets the amount of memory currently
    available to the guest. If only /domain/memory is specified, libvirt
    will automatically insert a /domain/currentMemory node.
    This means that after creating a domain, if we want to change the
    amount of RAM available to the guest, both values must be changed,
    otherwise /domain/currentMemory will limit the amount of available
    memory.
    This commit sets the 'current-memory' property in addition to the
    'memory' property when changing the memory. This fixes raising the
    amount of memory available to the guest. It's done by using GObject
    properties instead of directly using
    gvir_config_domain_set_current_memory to avoid raising our
    libvirt-glib dependency.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672554

 src/libvirt-machine.vala |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index edfcbe6..f91f2e8 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -535,6 +535,8 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
             try {
                 var config = domain.get_config (GVir.DomainXMLFlags.INACTIVE);
                 config.memory = value;
+                if (config.get_class ().find_property ("current-memory") != null)
+                    config.set ("current-memory", value);
                 domain.set_config (config);
                 debug ("RAM changed to %llu", value);
                 if (state == MachineState.RUNNING || state == MachineState.PAUSED)



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