Merge lp://qastaging/~danilo/maas/virsh-storage-units-trunk into lp://qastaging/~maas-committers/maas/trunk

Proposed by Данило Шеган
Status: Merged
Approved by: Данило Шеган
Approved revision: no longer in the source branch.
Merged at revision: 6095
Proposed branch: lp://qastaging/~danilo/maas/virsh-storage-units-trunk
Merge into: lp://qastaging/~maas-committers/maas/trunk
Diff against target: 235 lines (+123/-12)
4 files modified
src/provisioningserver/drivers/pod/tests/test_virsh.py (+23/-0)
src/provisioningserver/drivers/pod/virsh.py (+17/-12)
src/provisioningserver/utils/__init__.py (+45/-0)
src/provisioningserver/utils/tests/test_utils.py (+38/-0)
To merge this branch: bzr merge lp://qastaging/~danilo/maas/virsh-storage-units-trunk
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Review via email: mp+325920@code.qastaging.launchpad.net

Commit message

Consider size units for storage when evaluating virsh pod storage.

Description of the change

This changes .get_key_value() on the Virsh driver to not strip the unit, and introduces a "_unitless" variant that still does that. This highlights a few potential future problems as well (memory size in KiB, CPU speed in Mhz, if those units change, we'll have similar problems).

I wonder why did we not end up using libvirt instead which would provide us stable units, but I imagine they might not be py3 bindings available or something along those lines.

Testing instructions:

I have not tested this yet (I only have one system where I have >1TiB LVM volume), so it seems easier to test this with a small storage partition instead (eg. MiB to ensure that still works), but generally you need to:

 - set up a libvirt on a system and add a storage pool of >1TiB
 - ensure "virsh pool-info" lists the storage pool details in TiB
 - add a pod to MAAS and look at available storage: it should still be correct

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

My mistake; I commented on the 2.2 branch instead of this one.

See comments here.

https://code.launchpad.net/~danilo/maas/virsh-storage-units/+merge/325913

(Usually we land a branch on trunk first and then self-approve backports.)

Revision history for this message
Mike Pontillo (mpontillo) :
review: Needs Fixing
Revision history for this message
Данило Шеган (danilo) wrote :

I'll work on moving the helper and adding the unit tests as you suggested later: marking as WIP for now.

FWIW, Dmitrii has confirmed in the bug report that this solves the problem for him.

Revision history for this message
Данило Шеган (danilo) wrote :

I've addressed your review comments: moved the function into provisioningserver.utils.convert_size_to_bytes and added unit tests (thanks for raising this, I was going to add them then I got side-tracked filing other bugs as offshoots of the original one, and it slipped!).

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Looks great. Thanks for the fixes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.