Merge "Fix issue with unknown instance family"

This commit is contained in:
Zuul 2024-05-23 19:40:00 +00:00 committed by Gerrit Code Review
commit 69cbf03c1a
3 changed files with 28 additions and 4 deletions

View File

@ -459,9 +459,6 @@ class AwsAdapter(statemachine.Adapter):
if code in args:
continue
if not code:
self.log.warning(
"Unknown quota code for instance type: %s",
instance_type)
continue
if code not in ec2_quotas:
self.log.warning(
@ -929,7 +926,13 @@ class AwsAdapter(statemachine.Adapter):
m = self.instance_key_re.match(instance_type)
if m:
key = m.group(1)
return QUOTA_CODES.get(key)[market_type_option]
code = QUOTA_CODES.get(key)
if code:
return code[market_type_option]
self.log.warning(
"Unknown quota code for instance type: %s",
instance_type)
return None
def _getQuotaForInstanceType(self, instance_type, market_type_option):
try:

View File

@ -17,6 +17,7 @@ labels:
- name: high
- name: spot
- name: on-demand
- name: unknown
providers:
- name: ec2-us-west-2
@ -52,3 +53,7 @@ providers:
cloud-image: ubuntu1404
instance-type: m6i.32xlarge
key-name: zuul
- name: unknown
cloud-image: ubuntu1404
instance-type: is4gen.medium
key-name: zuul

View File

@ -398,6 +398,22 @@ class TestDriverAws(tests.DBTestCase):
req3 = self.waitForNodeRequest(req3)
self.assertSuccess(req3)
def test_aws_multi_quota_unknown(self):
# Test multiple instance type quotas (standard, high-mem and spot)
configfile = self.setup_config('aws/aws-quota.yaml')
pool = self.useNodepool(configfile, watermark_sleep=1)
pool.start()
# We don't have quota information for this node type; make
# sure we can still launch a node with it.
req1 = zk.NodeRequest()
req1.state = zk.REQUESTED
req1.node_types.append('unknown')
self.zk.storeNodeRequest(req1)
self.log.debug("Waiting for request %s", req1.id)
req1 = self.waitForNodeRequest(req1)
self.assertSuccess(req1)
@ec2_quotas({
'L-1216C47A': 1000,
'L-43DA4232': 1000,