LIBCLOUD-700 Add support for setting the region#513
LIBCLOUD-700 Add support for setting the region#513tonybaloney wants to merge 2 commits intoapache:trunkfrom
Conversation
…Dimension Data cloud, added all public endpoints.
There was a problem hiding this comment.
I believe this won't work correctly when user instantiates multiple drivers with a different region and runs those inside the same process.
You should use _ex_connection_kwargs approach. This way, host argument will be passed to the Connection class constructor when instantiating it instead of modifying a class level variable. Please see EC2 and some other drivers for an example.
|
I based it on the joyent driver, which follows a similar pattern (so of note that one may suffer the same issue!). Running DimensionData and Rackspace side by side does give results for the DimensionData driver, then Will follow the EC2 pattern instead and resubmit changes |
…ex_connection_args
|
Updated and tested against multiple regions in the same process by: DimensionData = get_driver(Provider.DIMENSIONDATA) drivers = [DimensionData('anthony','****',region='dd-na'), for driver in drivers: Gives 14 and 154 as expected. |
|
@tonybaloney Thanks, I will have a look. Also, to clarify it, your example wouldn't uncover the bug. You would need to do something like this: driver1 = cls(region='region-1')
driver2 = cls(region='region-2')
pprint(driver1.list_nodes())
pprint(driver2.list_nodes())
pprint(driver1.list_nodes()) # If there is a bug, this line would result in region from driver2 also being used here |
|
print(len(driver1.list_nodes())) gives 5, 154 and 5, so its not giving that bug |
|
I made a minor change (use normal dictionary access instead of get - we should throw if dictionary doesn't contain "host" item since this most likely indicates a programmer error) and merged changes into trunk. Thanks. |
when connecting to a Dimension Data cloud, added all public endpoints.