pep8 fixes, backported some important fixes that didn't make it over from my testing system :-(

This commit is contained in:
Justin Santa Barbara 2011-03-23 18:50:30 -07:00
parent 7a93455f41
commit 3c295817f9
4 changed files with 7 additions and 8 deletions

View File

@ -1001,7 +1001,7 @@ class ComputeManager(manager.Manager):
vm_instances = dict((vm.name, vm) for vm in vm_instances)
# Keep a list of VMs not in the DB, cross them off as we find them
vms_not_found_in_db = [vm.name for vm in vm_instances]
vms_not_found_in_db = list(vm_instances.keys())
db_instances = self.db.instance_get_all_by_host(context, self.host)

View File

@ -51,4 +51,4 @@ def name(code):
def valid_states():
return _STATE_MAP.values()
return _STATE_MAP.keys()

View File

@ -28,13 +28,13 @@ from nova.compute import power_state
class InstanceInfo(object):
def __init__(self, name, state):
self.name = name
assert state in power_state.valid_states()
assert state in power_state.valid_states(), "Bad state: %s" % state
self.state = state
class ComputeDriver(object):
"""Base class for compute drivers.
Lots of documentation is currently on fake.py.
"""
@ -44,7 +44,7 @@ class ComputeDriver(object):
def get_info(self, instance_name):
"""Get the current status of an instance, by name (not ID!)
Returns a dict containing:
:state: the running state, one of the power_state codes
:max_mem: (int) the maximum memory in KBytes allowed
@ -78,7 +78,7 @@ class ComputeDriver(object):
def get_console_pool_info(self, console_type):
"""???
Returns a dict containing:
:address: ???
:username: ???
@ -228,4 +228,3 @@ class ComputeDriver(object):
def inject_network_info(self, instance):
"""inject network info for specified instance"""
raise NotImplementedError()

View File

@ -255,7 +255,7 @@ class LibvirtConnection(driver.ComputeDriver):
def list_instances_detail(self):
infos = []
for domain_id in self._conn.listDomainsID():
domain = self._conn.lookupById(domain_id)
domain = self._conn.lookupByID(domain_id)
info = self._map_to_instance_info(domain)
infos.append(info)
return infos