[gnome-boxes] libvirt-machine-props: Refresh volume info after resize
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] libvirt-machine-props: Refresh volume info after resize
- Date: Thu, 13 Mar 2014 16:01:35 +0000 (UTC)
commit 9ff3fc29a228054689419bc39be37bf5b8da4576
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Mar 13 15:56:32 2014 +0000
libvirt-machine-props: Refresh volume info after resize
For running machines, we make use of special libvirt API that operates
on GVir.DomainDisk rather than GVir.StorageVol and its the latter Boxes
reads current capacity info from (actually there is no way to read
capacity from GVir.DomainDisk) so what happens is that when you change the
capacity of a running machine, get out of properties and back again,
you find the capacity to remain unchanged even though the actual
capacity was changed.
This patch fixes the issue by refreshing the storage pool and refetching
the volume info after changing the capacity through GVir.DomainDisk.resize.
src/libvirt-machine-properties.vala | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 27c76ae..ab3f9cd 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -497,10 +497,25 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
if (disk != null) {
var size = (value + Osinfo.KIBIBYTES - 1) / Osinfo.KIBIBYTES;
disk.resize (size, 0);
+
+ var pool = get_storage_pool (machine.connection);
+ pool.refresh_async.begin (null, (obj, res) => {
+ try {
+ pool.refresh_async.end (res);
+ machine.update_domain_config ();
+ debug ("Storage changed to %llu KiB", size);
+ } catch (GLib.Error error) {
+ warning ("Failed to change storage capacity of volume '%s' to %llu KiB: %s",
+ machine.storage_volume.get_name (),
+ size,
+ error.message);
+ }
+ });
}
- } else
+ } else {
machine.storage_volume.resize (value, StorageVolResizeFlags.NONE);
- debug ("Storage changed to %llu", value);
+ debug ("Storage changed to %llu", value);
+ }
} catch (GLib.Error error) {
warning ("Failed to change storage capacity of volume '%s' to %llu: %s",
machine.storage_volume.get_name (),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]