thecodeteam / python-scaleioclient

API binding for ScaleIO used by Nova
5 stars 5 forks source link

storagepool_size division by zero with empty PDs/pools #2

Open infernix opened 7 years ago

infernix commented 7 years ago

For empty PDs and/or storage pools (no SDSes), this happens when: stats = cluster.storagepool_size(pd, pool)

  File "/usr/lib/python2.7/site-packages/siolib/scaleio.py", line 767, in storagepool_size
    'capacityLimitInKb') / sds_count
ZeroDivisionError: integer division or modulo by zero

Obviously not a common scenario but some sanity checks should be put in place; iteration over just newly created empty PDs and/or storage pools may trip over this and break execution.

ftersin commented 7 years ago

Thanks. We'll deal with that soon.

infernix commented 7 years ago

@ftersin before I start to send in patches, is there a reason why https://github.com/gmmephisto/pyscaleio was not used? Perhaps licensing?

ftersin commented 7 years ago

Well, there are several reasons. Each one of them is probably not so important, but totally..

Our team started this work on Feb 16 (but that repo is created on Mar 16), and we started not with a clean state. That library does not use separate exceptions for certain ScaleIO errors, which lead us to check error codes directly, which is a few undesirable (once ScaleIO changed some error codes; and anyway this would bring more deep relations than we wanted). Also our own library gives us more flexibility, speed of changes, and confidence of future maintaining.

Licensing might be a problem, but as i see on openstack/requirements, some required packages uses the same LGPLv3.

ps. Although if we'd start now, i preferred that library.

ftersin commented 7 years ago

Fixed in branches of https://github.com/codedellemc/python-scaleioclient (except master branch).