After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 726066 - Allocated capacity should not be taken into account to calculate the maximum value of 'Maximum Disk Size'
Allocated capacity should not be taken into account to calculate the maximum ...
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: properties
3.11.x
Other Linux
: Normal normal
: 3.22
Assigned To: Fabiano Fidêncio
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-03-10 21:26 UTC by Fabiano Fidêncio
Modified: 2016-03-31 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libvirt-machine-props: Fix maximum value of 'Maximum Disk Size' (1.72 KB, patch)
2014-03-10 21:27 UTC, Fabiano Fidêncio
needs-work Details | Review
libvirt-machine-props: Fix max value of max disk (1.68 KB, patch)
2014-03-10 22:25 UTC, Fabiano Fidêncio
accepted-commit_now Details | Review
libvirt-machine-props: Fix max value of max disk (1.68 KB, patch)
2014-03-10 22:54 UTC, Fabiano Fidêncio
committed Details | Review
libvirt-machine-props: Fix max value of max disk (1.15 KB, patch)
2014-08-14 00:09 UTC, Fabiano Fidêncio
none Details | Review
libvirt-machine-props: Fix max value of max disk (3.09 KB, patch)
2014-08-14 00:12 UTC, Fabiano Fidêncio
none Details | Review
libvirt-machine-props: Fix max value of max disk (2.37 KB, patch)
2014-08-14 01:32 UTC, Fabiano Fidêncio
needs-work Details | Review
v2: libvirt-machine-props: Fix max value of max disk (4.14 KB, patch)
2014-08-14 23:55 UTC, Fabiano Fidêncio
none Details | Review
v3: libvirt-machine-props: Fix max value of max disk (4.16 KB, patch)
2014-08-15 00:08 UTC, Fabiano Fidêncio
needs-work Details | Review
v4 libvirt-machine-props: Fix max value of max disk (2.42 KB, patch)
2014-08-15 13:06 UTC, Fabiano Fidêncio
committed Details | Review
libvirt-machine-props: Warn when max disk size cannot be bigger (1.65 KB, patch)
2014-08-15 13:06 UTC, Fabiano Fidêncio
needs-work Details | Review
v2: libvirt-machine-props: Warn on immutable max disk (1.64 KB, patch)
2014-08-15 15:50 UTC, Fabiano Fidêncio
committed Details | Review

Description Fabiano Fidêncio 2014-03-10 21:26:23 UTC
See the attached patch.
Comment 1 Fabiano Fidêncio 2014-03-10 21:27:00 UTC
Created attachment 271480 [details] [review]
libvirt-machine-props: Fix maximum value of 'Maximum Disk Size'

volume_info.capacity should not be taken into account to calculate the
maximum value of 'Maximum Disk Size', which must be the space available
in the StoragePool (pool_info.available)
Comment 2 Zeeshan Ali 2014-03-10 22:16:23 UTC
(In reply to comment #1)
> Created an attachment (id=271480) [details] [review]
> libvirt-machine-props: Fix maximum value of 'Maximum Disk Size'

Pretty sure this goes way beyond 50 chars: : https://wiki.gnome.org/Git/CommitMessages . maximim -> max and writing not quoting exact string would help shortening it. :) This would be fine:

libvirt-machine-props: Fix max value of max disk

> volume_info.capacity should not be taken into account to calculate the
> maximum value of 'Maximum Disk Size', which must be the space available
> in the StoragePool (pool_info.available)

* Its better to keep description in as much normal English as possible (i-e avoiding identifiers)
  * volume_info.capacity -> Allocated capacity
  * 'in StoragePool' -> 'on storage pool'
* taken -> taking
* ", which must be the" -> ". It should simply be the"
Comment 3 Zeeshan Ali 2014-03-10 22:16:56 UTC
Review of attachment 271480 [details] [review]:

Fine code-wise. :)
Comment 4 Fabiano Fidêncio 2014-03-10 22:25:27 UTC
Created attachment 271486 [details] [review]
libvirt-machine-props: Fix max value of max disk

Allocated capacity should not be taking into account to calculate the
maximum value of 'Maximum Disk Size'. It should simply be the space
available on storage pool.
Comment 5 Zeeshan Ali 2014-03-10 22:48:07 UTC
Review of attachment 271486 [details] [review]:

Ouch, 'taken' was actually correct here. :) Just fix it before pushing. Sorry for that.
Comment 6 Fabiano Fidêncio 2014-03-10 22:54:41 UTC
Created attachment 271488 [details] [review]
libvirt-machine-props: Fix max value of max disk

Allocated capacity should not be taken into account to calculate the
maximum value of 'Maximum Disk Size'. It should simply be the space
available on storage pool.
Comment 7 Fabiano Fidêncio 2014-03-10 22:56:26 UTC
Attachment 271488 [details] pushed as d9f30a0 (gnome-boxes 3.11.92+)
Comment 8 Zeeshan Ali 2014-07-01 13:37:06 UTC
(In reply to comment #7)
> Attachment 271488 [details] pushed as d9f30a0 (gnome-boxes 3.11.92+)

Actually this was wrong and introduced many criticals when going to properties view for existing machines at least:

(gnome-boxes:9848): Gtk-CRITICAL **: gtk_scale_new_with_range: assertion 'min < max' failed

The existing code before this patch was correct as it took into account the existing capacity. E.g if disk image capacity is 2G and remaining space on volume is 1G, we'll putting 1G as max while 2G is min. You see the huge issue with that? :)
Comment 9 Zeeshan Ali 2014-07-01 13:43:51 UTC
Reverted the patch.
Comment 10 Fabiano Fidêncio 2014-08-14 00:06:54 UTC
Reopening the bug. Please, see the attached patch.
Comment 11 Fabiano Fidêncio 2014-08-14 00:09:25 UTC
Created attachment 283334 [details] [review]
libvirt-machine-props: Fix max value of max disk
Comment 12 Fabiano Fidêncio 2014-08-14 00:12:33 UTC
Created attachment 283335 [details] [review]
libvirt-machine-props: Fix max value of max disk
Comment 13 Fabiano Fidêncio 2014-08-14 01:32:05 UTC
Created attachment 283342 [details] [review]
libvirt-machine-props: Fix max value of max disk
Comment 14 Zeeshan Ali 2014-08-14 13:44:49 UTC
Review of attachment 283342 [details] [review]:

"The existing code is wrong as it considers the maximum storage value as
volume info's capacity + available space in the pool while the proper
value should be volume info's allocation + available space in the pool."

Some mention of what is wrong with existing code and how this new solution is "proper" (I actually don't think its "proper" but just better)? :)

"However it introduces an issue where the minimum storage value (volume
info's capacity) can be bigger or equal the maximum storage value. In
this case we have agreed in showing the current disk size as a "label"
instead of the scale"

* equal -> equal to
* I wouldn't say 'we' w/o indication of who that includes. I'll just write "In this case, lets just show the current capacity as a label and not allow to change the value".

BTW, we probobly want to tell user that they don't have enough disk scace to increase max disk size.
Comment 15 Fabiano Fidêncio 2014-08-14 23:55:56 UTC
Created attachment 283419 [details] [review]
v2: libvirt-machine-props: Fix max value of max disk
Comment 16 Fabiano Fidêncio 2014-08-15 00:08:07 UTC
Created attachment 283421 [details] [review]
v3: libvirt-machine-props: Fix max value of max disk

v2: changes from v1:
- Grammar fixes in the commit log
- Show a warning in an InfoBar, telling the users that they don't have enough space in the disk to increase the Maximum Disk Size.
v3: changes from v2:
- Grammar fixes in the commit log
Comment 17 Zeeshan Ali 2014-08-15 12:05:33 UTC
Review of attachment 283421 [details] [review]:

I asked you to provide more details/specifics about whats wrong with existing code and how your code is "proper" but not write a whole story which hurts my brain cause its hard to remember what is what. Can you please make it brief? Just shortly write what is wrong with existing code and how your solution is better (or "proper" if you prefer that term).
Comment 18 Zeeshan Ali 2014-08-15 12:07:07 UTC
Review of attachment 283421 [details] [review]:

::: src/libvirt-machine-properties.vala
@@ +480,3 @@
+                                     "%s".printf (format_size (volume_info.capacity, FormatSizeFlags.DEFAULT)));
+
+                var infobar = new Gtk.InfoBar ();

this needs to be in an additional patch as it has nothing to do with correcting max value itself.
Comment 19 Fabiano Fidêncio 2014-08-15 13:06:17 UTC
Created attachment 283485 [details] [review]
v4 libvirt-machine-props: Fix max value of max disk

v4: Changes from v3:
- Summarize the commit log
- Move the addition of the warning message to another patch
Comment 20 Fabiano Fidêncio 2014-08-15 13:06:59 UTC
Created attachment 283486 [details] [review]
libvirt-machine-props: Warn when max disk size cannot be bigger
Comment 21 Zeeshan Ali 2014-08-15 15:32:51 UTC
Review of attachment 283485 [details] [review]:

ACK
Comment 22 Zeeshan Ali 2014-08-15 15:41:02 UTC
Review of attachment 283486 [details] [review]:

* I don't see the need to capitalize "Maximum Disk Size".
* How about "Warn on immutable max disk" as shortlog?

::: src/libvirt-machine-properties.vala
@@ +490,3 @@
+                content.add (image);
+
+                var msg = _("There is not enough space on the disk to increase the Maximum Disk Size.");

Same comment about capitalization here. I'd replace "on the disk" to "on your machine" to avoid confusion with two disk sizes in the sentences. :)
Comment 23 Fabiano Fidêncio 2014-08-15 15:50:52 UTC
Created attachment 283524 [details] [review]
v2: libvirt-machine-props: Warn on immutable max disk

v2: Changes from v1:
- Don't use capitalized "Maximum Disk Size"
- Changed the commit shortlog as suggested
- s/on the disk/on your machine/ to avoid confusion
Comment 24 Zeeshan Ali 2014-08-15 16:16:26 UTC
Review of attachment 283524 [details] [review]:

Still not completely satisfied with the message we show but i can't come up with something better. ack
Comment 25 Fabiano Fidêncio 2014-08-15 16:32:57 UTC
Both patches pushed upstream (3.13.90+)