fix pep8 issues

This commit is contained in:
William Wolf 2011-06-01 10:37:54 -04:00
parent 8185703771
commit 8b716bc23a
8 changed files with 16 additions and 31 deletions

View File

@ -270,8 +270,7 @@ class API(base.Base):
'instance_type': instance_type, 'instance_type': instance_type,
'filter': 'filter':
'nova.scheduler.host_filter.' 'nova.scheduler.host_filter.'
'InstanceTypeFilter' 'InstanceTypeFilter'},
},
"availability_zone": availability_zone, "availability_zone": availability_zone,
"injected_files": injected_files, "injected_files": injected_files,
"admin_password": admin_password}}) "admin_password": admin_password}})

View File

@ -160,8 +160,7 @@ def convert_backward(migrate_engine, old_quotas, new_quotas):
'project_id': quota.project_id, 'project_id': quota.project_id,
'created_at': quota.created_at, 'created_at': quota.created_at,
'updated_at': quota.updated_at, 'updated_at': quota.updated_at,
quota.resource: quota.hard_limit quota.resource: quota.hard_limit}
}
else: else:
quotas[quota.project_id]['created_at'] = earliest( quotas[quota.project_id]['created_at'] = earliest(
quota.created_at, quotas[quota.project_id]['created_at']) quota.created_at, quotas[quota.project_id]['created_at'])

View File

@ -226,8 +226,7 @@ class JsonFilter(HostFilter):
required_disk = instance_type['local_gb'] required_disk = instance_type['local_gb']
query = ['and', query = ['and',
['>=', '$compute.host_memory_free', required_ram], ['>=', '$compute.host_memory_free', required_ram],
['>=', '$compute.disk_available', required_disk] ['>=', '$compute.disk_available', required_disk]]
]
return (self._full_name(), json.dumps(query)) return (self._full_name(), json.dumps(query))
def _parse_string(self, string, host, services): def _parse_string(self, string, host, services):

View File

@ -774,8 +774,7 @@ class ServersTest(test.TestCase):
def server_update(context, id, params): def server_update(context, id, params):
filtered_dict = dict( filtered_dict = dict(
display_name='server_test' display_name='server_test')
)
self.assertEqual(params, filtered_dict) self.assertEqual(params, filtered_dict)
return filtered_dict return filtered_dict

View File

@ -194,8 +194,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase):
post = {} post = {}
post['rebuild'] = { post['rebuild'] = {
"imageRef": "https://localhost/v1.1/32278/images/2", "imageRef": "https://localhost/v1.1/32278/images/2",
"name": "blah" "name": "blah"}
}
self.api.post_server_action(created_server_id, post) self.api.post_server_action(created_server_id, post)
LOG.debug("rebuilt server: %s" % created_server) LOG.debug("rebuilt server: %s" % created_server)
@ -224,8 +223,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase):
post = {} post = {}
post['rebuild'] = { post['rebuild'] = {
"imageRef": "https://localhost/v1.1/32278/images/2", "imageRef": "https://localhost/v1.1/32278/images/2",
"name": "blah" "name": "blah"}
}
metadata = {} metadata = {}
for i in range(30): for i in range(30):
@ -267,8 +265,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase):
post = {} post = {}
post['rebuild'] = { post['rebuild'] = {
"imageRef": "https://localhost/v1.1/32278/images/2", "imageRef": "https://localhost/v1.1/32278/images/2",
"name": "blah" "name": "blah"}
}
metadata = {} metadata = {}
post['rebuild']['metadata'] = metadata post['rebuild']['metadata'] = metadata

View File

@ -133,13 +133,11 @@ class HostFilterTestCase(test.TestCase):
raw = ['or', raw = ['or',
['and', ['and',
['<', '$compute.host_memory_free', 30], ['<', '$compute.host_memory_free', 30],
['<', '$compute.disk_available', 300] ['<', '$compute.disk_available', 300]],
],
['and', ['and',
['>', '$compute.host_memory_free', 70], ['>', '$compute.host_memory_free', 70],
['>', '$compute.disk_available', 700] ['>', '$compute.disk_available', 700]]]
]
]
cooked = json.dumps(raw) cooked = json.dumps(raw)
hosts = hf.filter_hosts(self.zone_manager, cooked) hosts = hf.filter_hosts(self.zone_manager, cooked)
@ -183,13 +181,11 @@ class HostFilterTestCase(test.TestCase):
self.assertTrue(hf.filter_hosts(self.zone_manager, json.dumps([]))) self.assertTrue(hf.filter_hosts(self.zone_manager, json.dumps([])))
self.assertTrue(hf.filter_hosts(self.zone_manager, json.dumps({}))) self.assertTrue(hf.filter_hosts(self.zone_manager, json.dumps({})))
self.assertTrue(hf.filter_hosts(self.zone_manager, json.dumps( self.assertTrue(hf.filter_hosts(self.zone_manager, json.dumps(
['not', True, False, True, False] ['not', True, False, True, False])))
)))
try: try:
hf.filter_hosts(self.zone_manager, json.dumps( hf.filter_hosts(self.zone_manager, json.dumps(
'not', True, False, True, False 'not', True, False, True, False))
))
self.fail("Should give KeyError") self.fail("Should give KeyError")
except KeyError, e: except KeyError, e:
pass pass

View File

@ -39,15 +39,11 @@ class FakeZoneManager(zone_manager.ZoneManager):
def __init__(self): def __init__(self):
self.service_states = { self.service_states = {
'host1': { 'host1': {
'compute': {'ram': 1000} 'compute': {'ram': 1000}},
},
'host2': { 'host2': {
'compute': {'ram': 2000} 'compute': {'ram': 2000}},
},
'host3': { 'host3': {
'compute': {'ram': 3000} 'compute': {'ram': 3000}}}
}
}
class FakeEmptyZoneManager(zone_manager.ZoneManager): class FakeEmptyZoneManager(zone_manager.ZoneManager):

View File

@ -36,7 +36,7 @@ PY_VERSION = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
def die(message, *args): def die(message, *args):
print >>sys.stderr, message % args print >> sys.stderr, message % args
sys.exit(1) sys.exit(1)