Blob Blame History Raw
From 57e4fdbc608b96ee261cf64e14aa267338b213f4 Mon Sep 17 00:00:00 2001
From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
Date: Wed, 12 Mar 2014 22:41:04 +0000
Subject: [PATCH 1/2] libvirt-machine-props: Volume size is correct units

GVir.DomainDisk.resize expects values in KiB.

I'm not entirely sure if it helps with the following bug but my guess is
that it does as the disk capacity really must have been set to that
insane value because of the issue this bug fixes.

https://bugzilla.gnome.org/show_bug.cgi?id=725384
---
 src/libvirt-machine-properties.vala | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 82d0a87..97dcd85 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -566,8 +566,10 @@ private void on_storage_changed (Boxes.Property property, uint64 value) {
             try {
                 if (machine.is_running ()) {
                     var disk = machine.get_domain_disk ();
-                    if (disk != null)
-                        disk.resize (value, 0);
+                    if (disk != null) {
+                        var size = (value + Osinfo.KIBIBYTES - 1) / Osinfo.KIBIBYTES;
+                        disk.resize (size, 0);
+                    }
                 } else
                     // Currently this never happens as properties page cant be reached without starting the machine
                     machine.storage_volume.resize (value, StorageVolResizeFlags.NONE);
-- 
2.1.0