Hi everyone,

We’re upgrading to libcloud-2.0.0 and we’re facing the same issue we had when 
we upgraded to libcloud-1.5.0: Cannot list the sizes of some regions in the EC2 
compute driver. The root cause is that pricing for such regions is not 
available:

  File 
"/usr/local/lib/python3.4/dist-packages/libcloud/compute/drivers/ec2.py", line 
3390, in list_sizes
    price = self._get_size_price(size_id=instance_type)
  File "/usr/local/lib/python3.4/dist-packages/libcloud/compute/base.py", line 
1530, in _get_size_price
    size_id=size_id)
  File "/usr/local/lib/python3.4/dist-packages/libcloud/pricing.py", line 146, 
in get_size_price
    pricing = get_pricing(driver_type=driver_type, driver_name=driver_name)
  File "/usr/local/lib/python3.4/dist-packages/libcloud/pricing.py", line 101, 
in get_pricing
    size_pricing = pricing_data[driver_type][driver_name]
KeyError: 'ec2_ca_central_1'

I’ve just submitted a PR that adds a test to check whether sizes can be 
retrieved in all valid regions: https://github.com/apache/libcloud/pull/1045
The test fails with the following output:

======================================================================
FAIL: test_list_sizes_valid_regions 
(libcloud.test.compute.test_ec2.BaseEC2Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/libcloud/libcloud/test/compute/test_ec2.py", line 85, in 
test_list_sizes_valid_regions
    self.fail('Cannot list sizes from ec2 regions: %s' % unsupported_regions)
AssertionError: Cannot list sizes from ec2 regions: ['cn-north-1', 
'ca-central-1', 'eu-west-2']

----------------------------------------------------------------------


Is there a way to scrape prices during the build pipeline to prevent this 
failure from happening in the future? Maybe a different solution?

Thanks a lot!!
--
Francisco J. Ros

Reply via email to