summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Sokolov <nsokolov@griddynamics.com>2011-07-25 15:03:02 +0400
committerNikolay Sokolov <nsokolov@griddynamics.com>2011-07-25 15:03:02 +0400
commitcf4aea379eb337b16a9816d45c50c0553c500d0d (patch)
treeb67cca530973541b6e3937930df0ee5bdd95a58a
parent19379c78e6efd4637d876c91b022e6e7dbd38836 (diff)
pep8
-rw-r--r--nova/compute/manager.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 071eabcfe..ebd91177f 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -150,22 +150,29 @@ class ComputeManager(manager.SchedulerDependentManager):
from nova import context
self.driver.init_host(host=self.host)
admin_context = context.get_admin_context()
- for instance in self.db.instance_get_all_by_host(admin_context, self.host):
+ for instance in self.db.instance_get_all_by_host(admin_context,
+ self.host):
try:
LOG.debug(_('Checking state of %s'), instance['name'])
state = self.driver.get_info(instance['name'])['state']
except exception.NotFound:
state = power_state.SHUTOFF
- LOG.debug(_('Current state of %(name)s is %(state)s, state in DB is %(db_state)s.'),
- {'name': instance['name'], 'state': state, 'db_state': instance['state']})
-
- if instance['state'] == power_state.RUNNING and state != power_state.RUNNING \
- and FLAGS.start_guests_on_host_boot:
- LOG.debug(_('Rebooting instance %(name)s after nova-compute restart.'), {'name': instance['name']})
+ LOG.debug(_('Current state of %(name)s is %(state)s, state in '
+ 'DB is %(db_state)s.'), {'name': instance['name'],
+ 'state': state,
+ 'db_state':
+ instance['state']})
+
+ if instance['state'] == power_state.RUNNING \
+ and state != power_state.RUNNING \
+ and FLAGS.start_guests_on_host_boot:
+ LOG.debug(_('Rebooting instance %(name)s after nova-compute '
+ ' restart.'), {'name': instance['name']})
self.reboot_instance(admin_context, instance['id'])
else:
- self.db.instance_set_state(admin_context, instance['id'], state)
+ self.db.instance_set_state(admin_context, instance['id'],
+ state)
def _update_state(self, context, instance_id, state=None):
"""Update the state of an instance from the driver info."""