Merge "Fix AWS quota limits for vCPUs"

This commit is contained in:
Zuul 2023-01-19 07:29:54 +00:00 committed by Gerrit Code Review
commit ad7bf9aaeb
5 changed files with 15 additions and 12 deletions

View File

@ -141,7 +141,7 @@ Selecting the ``aws`` driver adds the following options to the
.. code-block:: yaml .. code-block:: yaml
max-resources: max-resources:
'L-43DA4232': 224 'L-43DA4232': 448
See `instance quotas`_ for more information. See `instance quotas`_ for more information.
@ -498,7 +498,7 @@ Selecting the ``aws`` driver adds the following options to the
.. code-block:: yaml .. code-block:: yaml
max-resources: max-resources:
'L-43DA4232': 224 'L-43DA4232': 448
See `instance quotas`_ for more information. See `instance quotas`_ for more information.

View File

@ -557,7 +557,7 @@ Options
max-servers: 10 max-servers: 10
max-cores: 200 max-cores: 200
max-ram: 16565 max-ram: 16565
'L-43DA4232': 224 'L-43DA4232': 448
Each entry is a dictionary with the following keys. Any other keys Each entry is a dictionary with the following keys. Any other keys
are interpreted as driver-specific resource limits (otherwise are interpreted as driver-specific resource limits (otherwise

View File

@ -629,15 +629,18 @@ class AwsAdapter(statemachine.Adapter):
def _getQuotaForInstanceType(self, instance_type): def _getQuotaForInstanceType(self, instance_type):
itype = self._getInstanceType(instance_type) itype = self._getInstanceType(instance_type)
cores = itype['InstanceTypes'][0]['VCpuInfo']['DefaultCores'] cores = itype['InstanceTypes'][0]['VCpuInfo']['DefaultCores']
vcpus = itype['InstanceTypes'][0]['VCpuInfo']['DefaultVCpus']
ram = itype['InstanceTypes'][0]['MemoryInfo']['SizeInMiB'] ram = itype['InstanceTypes'][0]['MemoryInfo']['SizeInMiB']
code = self._getQuotaCodeForInstanceType(instance_type) code = self._getQuotaCodeForInstanceType(instance_type)
# We include cores twice: one to match the overall cores quota # We include cores to match the overall cores quota (which may
# (which may be set as a tenant resource limit), and a second # be set as a tenant resource limit), and include vCPUs for the
# time as the specific AWS quota code which in for a specific # specific AWS quota code which in for a specific instance
# instance type. # type. With two threads per core, the vCPU number is
# typically twice the number of cores. AWS service quotas are
# implemented in terms of vCPUs.
args = dict(cores=cores, ram=ram, instances=1) args = dict(cores=cores, ram=ram, instances=1)
if code: if code:
args[code] = cores args[code] = vcpus
return QuotaInformation(**args) return QuotaInformation(**args)
# This method is wrapped with an LRU cache in the constructor. # This method is wrapped with an LRU cache in the constructor.

View File

@ -11,7 +11,7 @@ zookeeper-tls:
tenant-resource-limits: tenant-resource-limits:
- tenant-name: tenant-1 - tenant-name: tenant-1
max-cores: 1024 max-cores: 1024
'L-43DA4232': 224 # high mem cores 'L-43DA4232': 448 # high mem vCPUs
labels: labels:
- name: standard - name: standard
@ -34,7 +34,7 @@ providers:
key1: value1 key1: value1
key2: value2 key2: value2
max-resources: max-resources:
'L-1216C47A': 1 # standard cores 'L-1216C47A': 2 # standard vCPUs
labels: labels:
- name: standard - name: standard
cloud-image: ubuntu1404 cloud-image: ubuntu1404

View File

@ -240,8 +240,8 @@ class TestDriverAws(tests.DBTestCase):
self.waitForNodeDeletion(node) self.waitForNodeDeletion(node)
@aws_quotas({ @aws_quotas({
'L-1216C47A': 1, 'L-1216C47A': 2,
'L-43DA4232': 224, 'L-43DA4232': 448,
}) })
def test_aws_multi_quota(self): def test_aws_multi_quota(self):
# Test multiple instance type quotas (standard and high-mem) # Test multiple instance type quotas (standard and high-mem)