Dealing with cases where extra_specs wasn't defined
This commit is contained in:
@@ -97,9 +97,13 @@ class InstanceTypeFilter(HostFilter):
|
|||||||
"""Check that the capabilities provided by the compute service
|
"""Check that the capabilities provided by the compute service
|
||||||
satisfy the extra specs associated with the instance type"""
|
satisfy the extra specs associated with the instance type"""
|
||||||
|
|
||||||
|
if 'extra_specs' not in instance_type:
|
||||||
|
return True
|
||||||
|
|
||||||
# Note(lorinh): For now, we are just checking exact matching on the
|
# Note(lorinh): For now, we are just checking exact matching on the
|
||||||
# values. Later on, we want to handle numerical
|
# values. Later on, we want to handle numerical
|
||||||
# values so we can represent things like number of GPU cards
|
# values so we can represent things like number of GPU cards
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for key, value in instance_type['extra_specs'].iteritems():
|
for key, value in instance_type['extra_specs'].iteritems():
|
||||||
if capabilities[key] != value:
|
if capabilities[key] != value:
|
||||||
|
@@ -67,7 +67,8 @@ class HostFilterTestCase(test.TestCase):
|
|||||||
flavorid=1,
|
flavorid=1,
|
||||||
swap=500,
|
swap=500,
|
||||||
rxtx_quota=30000,
|
rxtx_quota=30000,
|
||||||
rxtx_cap=200)
|
rxtx_cap=200,
|
||||||
|
extra_specs={})
|
||||||
|
|
||||||
self.zone_manager = FakeZoneManager()
|
self.zone_manager = FakeZoneManager()
|
||||||
states = {}
|
states = {}
|
||||||
|
Reference in New Issue
Block a user