removed extra stubout, switched to isinstance and catching explicit exception
This commit is contained in:
@@ -260,7 +260,7 @@ class API(base.Base):
|
||||
elevated = context.elevated()
|
||||
if security_group is None:
|
||||
security_group = ['default']
|
||||
if not type(security_group) is list:
|
||||
if not isinstance(security_group, list):
|
||||
security_group = [security_group]
|
||||
|
||||
security_groups = []
|
||||
|
||||
@@ -194,7 +194,7 @@ class ZoneAwareScheduler(driver.Scheduler):
|
||||
cooked_weight = offset + scale * raw_weight
|
||||
item['weight'] = cooked_weight
|
||||
item['raw_weight'] = raw_weight
|
||||
except Exception, e:
|
||||
except KeyError:
|
||||
LOG.exception(_("Bad child zone scaling values "
|
||||
"for Zone: %(zone)s") % locals())
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
Tests For Zone Aware Scheduler.
|
||||
"""
|
||||
|
||||
import stubout
|
||||
|
||||
import nova.db
|
||||
|
||||
from nova import exception
|
||||
@@ -170,14 +168,6 @@ def fake_zone_get_all(context):
|
||||
class ZoneAwareSchedulerTestCase(test.TestCase):
|
||||
"""Test case for Zone Aware Scheduler."""
|
||||
|
||||
def setUp(self):
|
||||
super(ZoneAwareSchedulerTestCase, self).setUp()
|
||||
self.stubs = stubout.StubOutForTesting()
|
||||
|
||||
def tearDown(self):
|
||||
self.stubs.UnsetAll()
|
||||
super(ZoneAwareSchedulerTestCase, self).tearDown()
|
||||
|
||||
def test_zone_aware_scheduler(self):
|
||||
"""
|
||||
Create a nested set of FakeZones, ensure that a select call returns the
|
||||
|
||||
Reference in New Issue
Block a user