Merge "Fix issue with unknown instance family"
This commit is contained in:
commit
69cbf03c1a
@ -459,9 +459,6 @@ class AwsAdapter(statemachine.Adapter):
|
|||||||
if code in args:
|
if code in args:
|
||||||
continue
|
continue
|
||||||
if not code:
|
if not code:
|
||||||
self.log.warning(
|
|
||||||
"Unknown quota code for instance type: %s",
|
|
||||||
instance_type)
|
|
||||||
continue
|
continue
|
||||||
if code not in ec2_quotas:
|
if code not in ec2_quotas:
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
@ -929,7 +926,13 @@ class AwsAdapter(statemachine.Adapter):
|
|||||||
m = self.instance_key_re.match(instance_type)
|
m = self.instance_key_re.match(instance_type)
|
||||||
if m:
|
if m:
|
||||||
key = m.group(1)
|
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):
|
def _getQuotaForInstanceType(self, instance_type, market_type_option):
|
||||||
try:
|
try:
|
||||||
|
5
nodepool/tests/fixtures/aws/aws-quota.yaml
vendored
5
nodepool/tests/fixtures/aws/aws-quota.yaml
vendored
@ -17,6 +17,7 @@ labels:
|
|||||||
- name: high
|
- name: high
|
||||||
- name: spot
|
- name: spot
|
||||||
- name: on-demand
|
- name: on-demand
|
||||||
|
- name: unknown
|
||||||
|
|
||||||
providers:
|
providers:
|
||||||
- name: ec2-us-west-2
|
- name: ec2-us-west-2
|
||||||
@ -52,3 +53,7 @@ providers:
|
|||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
instance-type: m6i.32xlarge
|
instance-type: m6i.32xlarge
|
||||||
key-name: zuul
|
key-name: zuul
|
||||||
|
- name: unknown
|
||||||
|
cloud-image: ubuntu1404
|
||||||
|
instance-type: is4gen.medium
|
||||||
|
key-name: zuul
|
||||||
|
@ -398,6 +398,22 @@ class TestDriverAws(tests.DBTestCase):
|
|||||||
req3 = self.waitForNodeRequest(req3)
|
req3 = self.waitForNodeRequest(req3)
|
||||||
self.assertSuccess(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({
|
@ec2_quotas({
|
||||||
'L-1216C47A': 1000,
|
'L-1216C47A': 1000,
|
||||||
'L-43DA4232': 1000,
|
'L-43DA4232': 1000,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user