summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2010-12-21 21:47:13 +0000
committerVishvananda Ishaya <vishvananda@gmail.com>2010-12-21 21:47:13 +0000
commitf0195ebfd2cc56cee5797fff19fb9702c51df51b (patch)
treec5a366844c570953ac10fd99fd7d1ea6405b8db3
parent9d40ff49f6b4a840e2528edf187725ef2a60b246 (diff)
downloadnova-f0195ebfd2cc56cee5797fff19fb9702c51df51b.tar.gz
nova-f0195ebfd2cc56cee5797fff19fb9702c51df51b.tar.xz
nova-f0195ebfd2cc56cee5797fff19fb9702c51df51b.zip
fix reboot command to work even if a host is rebooted
-rw-r--r--nova/compute/manager.py4
-rw-r--r--nova/virt/libvirt_conn.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index a84af6bb9..6d3ea966d 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -138,8 +138,8 @@ class ComputeManager(manager.Manager):
def reboot_instance(self, context, instance_id):
"""Reboot an instance on this server."""
context = context.elevated()
- instance_ref = self.db.instance_get(context, instance_id)
self._update_state(context, instance_id)
+ instance_ref = self.db.instance_get(context, instance_id)
if instance_ref['state'] != power_state.RUNNING:
logging.warn('trying to reboot a non-running '
@@ -153,6 +153,7 @@ class ComputeManager(manager.Manager):
instance_id,
power_state.NOSTATE,
'rebooting')
+ self.network_manager.setup_compute_network(context, instance_id)
self.driver.reboot(instance_ref)
self._update_state(context, instance_id)
@@ -168,6 +169,7 @@ class ComputeManager(manager.Manager):
instance_id,
power_state.NOSTATE,
'rescuing')
+ self.network_manager.setup_compute_network(context, instance_id)
self.driver.rescue(instance_ref)
self._update_state(context, instance_id)
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index ad101db2a..845167d9f 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -40,6 +40,7 @@ import logging
import os
import shutil
+from eventlet import greenthread
from eventlet import event
from eventlet import tpool
@@ -183,7 +184,8 @@ class LibvirtConnection(object):
# everything has been vetted a bit
def _wait_for_timer():
timer_done.wait()
- self._cleanup(instance)
+ if cleanup:
+ self._cleanup(instance)
done.send()
greenthread.spawn(_wait_for_timer)