diff --git a/doc/source/aws.rst b/doc/source/aws.rst index d428ccd24..1dae2fd1d 100644 --- a/doc/source/aws.rst +++ b/doc/source/aws.rst @@ -141,7 +141,7 @@ Selecting the ``aws`` driver adds the following options to the .. code-block:: yaml max-resources: - 'L-43DA4232': 224 + 'L-43DA4232': 448 See `instance quotas`_ for more information. @@ -498,7 +498,7 @@ Selecting the ``aws`` driver adds the following options to the .. code-block:: yaml max-resources: - 'L-43DA4232': 224 + 'L-43DA4232': 448 See `instance quotas`_ for more information. diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index 25c57b78a..f0dec9ab4 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -557,7 +557,7 @@ Options max-servers: 10 max-cores: 200 max-ram: 16565 - 'L-43DA4232': 224 + 'L-43DA4232': 448 Each entry is a dictionary with the following keys. Any other keys are interpreted as driver-specific resource limits (otherwise diff --git a/nodepool/driver/aws/adapter.py b/nodepool/driver/aws/adapter.py index 318961109..bce81df6a 100644 --- a/nodepool/driver/aws/adapter.py +++ b/nodepool/driver/aws/adapter.py @@ -629,15 +629,18 @@ class AwsAdapter(statemachine.Adapter): def _getQuotaForInstanceType(self, instance_type): itype = self._getInstanceType(instance_type) cores = itype['InstanceTypes'][0]['VCpuInfo']['DefaultCores'] + vcpus = itype['InstanceTypes'][0]['VCpuInfo']['DefaultVCpus'] ram = itype['InstanceTypes'][0]['MemoryInfo']['SizeInMiB'] code = self._getQuotaCodeForInstanceType(instance_type) - # We include cores twice: one to match the overall cores quota - # (which may be set as a tenant resource limit), and a second - # time as the specific AWS quota code which in for a specific - # instance type. + # We include cores to match the overall cores quota (which may + # be set as a tenant resource limit), and include vCPUs for the + # specific AWS quota code which in for a specific instance + # 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) if code: - args[code] = cores + args[code] = vcpus return QuotaInformation(**args) # This method is wrapped with an LRU cache in the constructor. diff --git a/nodepool/tests/fixtures/aws/aws-limits.yaml b/nodepool/tests/fixtures/aws/aws-limits.yaml index 089d068cc..2d00d00d2 100644 --- a/nodepool/tests/fixtures/aws/aws-limits.yaml +++ b/nodepool/tests/fixtures/aws/aws-limits.yaml @@ -11,7 +11,7 @@ zookeeper-tls: tenant-resource-limits: - tenant-name: tenant-1 max-cores: 1024 - 'L-43DA4232': 224 # high mem cores + 'L-43DA4232': 448 # high mem vCPUs labels: - name: standard @@ -34,7 +34,7 @@ providers: key1: value1 key2: value2 max-resources: - 'L-1216C47A': 1 # standard cores + 'L-1216C47A': 2 # standard vCPUs labels: - name: standard cloud-image: ubuntu1404 diff --git a/nodepool/tests/unit/test_driver_aws.py b/nodepool/tests/unit/test_driver_aws.py index e17e9a832..d88bb3551 100644 --- a/nodepool/tests/unit/test_driver_aws.py +++ b/nodepool/tests/unit/test_driver_aws.py @@ -240,8 +240,8 @@ class TestDriverAws(tests.DBTestCase): self.waitForNodeDeletion(node) @aws_quotas({ - 'L-1216C47A': 1, - 'L-43DA4232': 224, + 'L-1216C47A': 2, + 'L-43DA4232': 448, }) def test_aws_multi_quota(self): # Test multiple instance type quotas (standard and high-mem)