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
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/maas-devel