Wrong storage size in pod virsh..
Andres Rodriguez
andres.rodriguez at canonical.com
Tue Jun 20 15:48:10 UTC 2017
Hi Vladimir,
I believe this bug has already been reported in [1], and a fix is already
in progress in [2]. I'd like to encourage you to provide your
review/comment on the MP in [2].
Thank you!
[1]: https://bugs.launchpad.net/maas/+bug/1687305
[2]:
https://code.launchpad.net/~danilo/maas/virsh-storage-units-trunk/+merge/325920
On Tue, Jun 20, 2017 at 4:41 PM, Vladimir Burlakov <vvb at fgts.ru> wrote:
> Hello,
> It seems, that while connecting pod with virsh type, we do not take into
> account that pool-info can return to us capacity not in GiB format only..
> f.e in my env:
> --
> virsh # pool-info default-pool
> Name: default-pool
> UUID: 5ee26e89-1ff0-4e70-80ac-8181f0cac4d5
> State: running
> Persistent: yes
> Autostart: yes
> Capacity: 1.79 *TiB*
> Allocation: 11.97 GiB
> Available: 1.78 *TiB*
> —
>
> so when attaching virsh pod, we getting a wrong size of the storage.. just
> like an idea i brought here part of the changed source
> of (drivers/pod/virsh.py):
> —
> def get_pod_pool_size_map(self, key):
> """Return the mapping for a size calculation based on key."""
> pools = {}
> for pool in self.list_pools():
> output = self.run(['pool-info', pool]).replace(' ', '')
> if output is None:
> continue
> #here we getting capacity string in 1234TiB format
> capacity_str = self.get_key_value(output, key)
> pools[pool] = self.convert_pod_storage_size_
> to_Bytes(capacity_str)
> return pools
>
> def convert_pod_storage_size_to_GiB(self, cap):
> capacity = float(cap[:-3])
> binary_pref = cap[-3:]
> unit_to_multiplier = {
> 'KiB': 2**10,
> 'MiB': 2**20,
> 'GiB': 2**30,
> 'TiB': 2**40,
> 'PiB': 2**50
> }
> return int(capacity * unit_to_multiplier[binary_pref])
> —
>
> Hope, it will be helpful.
>
>
> Thanks,
> Vladimir
>
>
>
> --
> Maas-devel mailing list
> Maas-devel at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/maas-devel
>
>
--
Andres Rodriguez
Engineering Manager, MAAS
Canonical USA, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/maas-devel/attachments/20170620/a3a922fd/attachment.html>
More information about the Maas-devel
mailing list