From f02881e0a1c6792bcb7accc3b15e64074845d7d8 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 21 Jan 2009 18:22:35 +0000 Subject: [PATCH] KVM: fix RebootInstance RebootInstance was broken, because it just used to call StartInstance with wrong parameters. With this patch we still stop the instance, but use the saved kvm runtime to start it again. Reviewed-by: iustinp --- lib/hypervisor/hv_kvm.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index c14cdf7bd..52cb785a2 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -393,8 +393,16 @@ class KVMHypervisor(hv_base.BaseHypervisor): # For some reason if we do a 'send-key ctrl-alt-delete' to the control # socket the instance will stop, but now power up again. So we'll resort # to shutdown and restart. - self.StopInstance(instance) - self.StartInstance(instance) + + # StopInstance will delete the saved KVM runtime so: + # ...first load it... + kvm_runtime = self._LoadKVMRuntime(instance) + # ...now we can safely call StopInstance... + if not self.StopInstance(instance): + self.StopInstance(instance, force=True) + # ...and finally we can save it again, and execute it... + self._SaveKVMRuntime(instance, kvm_runtime) + self._ExecuteKVMRuntime(instance, kvm_runtime) def GetNodeInfo(self): """Return information about the node. -- GitLab