From 71b7298788045d4832dd8ec44cba3785955aa847 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Tue, 6 Sep 2011 15:21:15 +0000 Subject: Implement deferred delete of instances --- nova/virt/driver.py | 8 ++++++++ nova/virt/xenapi/vmops.py | 10 ++++++++++ nova/virt/xenapi_conn.py | 8 ++++++++ 3 files changed, 26 insertions(+) (limited to 'nova/virt') diff --git a/nova/virt/driver.py b/nova/virt/driver.py index d05b51bd9..69d50717a 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -286,6 +286,14 @@ class ComputeDriver(object): # TODO(Vek): Need to pass context in for access to auth_token raise NotImplementedError() + def power_off(self, instance): + """Power off the specified instance.""" + raise NotImplementedError() + + def power_on(self, instance): + """Power on the specified instance""" + raise NotImplementedError() + def update_available_resource(self, ctxt, host): """Updates compute manager resource info on ComputeNode table. diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index c5f105f40..83ec96b8a 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -988,6 +988,16 @@ class VMOps(object): self._release_bootlock(original_vm_ref) self._start(instance, original_vm_ref) + def power_off(self, instance): + """Power off the specified instance.""" + vm_ref = self._get_vm_opaque_ref(instance) + self._shutdown(instance, vm_ref, hard=True) + + def power_on(self, instance): + """Power on the specified instance.""" + vm_ref = self._get_vm_opaque_ref(instance) + self._start(instance, vm_ref) + def poll_rescued_instances(self, timeout): """Look for expirable rescued instances. diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index 0d23e7689..69a17f721 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -250,6 +250,14 @@ class XenAPIConnection(driver.ComputeDriver): """Unrescue the specified instance""" self._vmops.unrescue(instance, _callback) + def power_off(self, instance): + """Power off the specified instance""" + self._vmops.power_off(instance) + + def power_on(self, instance): + """Power on the specified instance""" + self._vmops.power_on(instance) + def poll_rescued_instances(self, timeout): """Poll for rescued instances""" self._vmops.poll_rescued_instances(timeout) -- cgit