summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Sokolov <nsokolov@griddynamics.com>2011-07-26 00:31:42 +0400
committerNikolay Sokolov <nsokolov@griddynamics.com>2011-07-26 00:31:42 +0400
commitba4946d0d3c73e5d9f67f42203d103bf98563458 (patch)
tree41bf41fae15b5d3624aff7a1684c07075eb2dc2d
parent9c88bbee56dd05703af8f7c0df839a4da73f491a (diff)
Fixed old libvirt semantics, added resume_guests_state_on_host_boot flag.
-rw-r--r--nova/compute/manager.py9
-rw-r--r--nova/flags.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 79e9b16d3..bfac3df28 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -146,9 +146,7 @@ class ComputeManager(manager.SchedulerDependentManager):
*args, **kwargs)
def init_host(self):
- """Initialization for a standalone compute service.
-
- Reboots instances marked as running in DB if they is not running."""
+ """Initialization for a standalone compute service."""
self.driver.init_host(host=self.host)
context = nova.context.get_admin_context()
instances = self.db.instance_get_all_by_host(context, self.host)
@@ -157,12 +155,13 @@ class ComputeManager(manager.SchedulerDependentManager):
db_state = instance['state']
drv_state = self._update_state(context, instance['id'])
- expect_running = db_state == power_state.RUNNING != drv_state
+ expect_running = (db_state == power_state.RUNNING != drv_state)
LOG.debug(_('Current state of %(inst_name)s is %(drv_state)s, '
'state in DB is %(db_state)s.'), locals())
- if expect_running and FLAGS.start_guests_on_host_boot:
+ if (expect_running and FLAGS.resume_guests_state_on_host_boot)\
+ or FLAGS.start_guests_on_host_boot:
LOG.info(_('Rebooting instance %(inst_name)s after '
'nova-compute restart.'), locals())
self.reboot_instance(context, instance['id'])
diff --git a/nova/flags.py b/nova/flags.py
index 23ca38b17..6c7e448ad 100644
--- a/nova/flags.py
+++ b/nova/flags.py
@@ -390,3 +390,5 @@ DEFINE_string('build_plan_encryption_key', None,
DEFINE_bool('start_guests_on_host_boot', False,
'Whether to restart guests when the host reboots')
+DEFINE_bool('resume_guests_state_on_host_boot', False,
+ 'Whether to start guests, that was running before the host reboot')