swevm / scaleio-py

ScaleIO API Bindings
Apache License 2.0
13 stars 14 forks source link

_do_post() errors #6

Open wallnerryan opened 9 years ago

wallnerryan commented 9 years ago

in the function _do_post() at https://github.com/wallnerryan/scaleio-py/blob/master/scaleiopy/scaleio.py#L497 its hard to understand any error the happens in the stack.

For instance, if we see a runtime error like:

ERROR scaleio:_do_post | _do_post() - HTTP response error, data: {"message":"Only a single SDC may be mapped to this volume at a time","httpStatusCode":500,"errorCode":306}

It is impossible to know that by calling map_volume_to_sdc() because we don't get the response back. My suggestion here is to log the error, but return the response to let the client decipher the errors. Or to have a standard set of errors like CannotMapMultpleSdcsError for the one above, and return the error rather than raise which ends the execution.

again happy to help, but ran into the above situation where all I can get back is _do_post() - Communication error with ScaleIO gateway in a snippet like this:

>>> try:
...     resp = (sio.map_volume_to_sdc(sio.get_volume_by_name('testvol001'), sio.get_sdc_by_ip('192.168.50.12')))
... except Exception as e:
...     print e

@swevm

swevm commented 9 years ago

I'm aware of that. Need to enhance error reporting a bit.

wallnerryan commented 9 years ago

thanks, again, just adding issues that I am coming across, I am also happy to help out with bugs and other items as I plan on using this lib in the near future for prototyping.