diff options
| author | Rick Harris <rconradharris@gmail.com> | 2012-02-29 18:39:13 +0000 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2012-02-29 19:26:01 +0000 |
| commit | b6a175664042dfd486fa6217b5e199a46dacefb6 (patch) | |
| tree | 288fcfc8c7e7f865627566942ce9a7e436cbd2c2 | |
| parent | 5f44c8f86691649fb4e0f1e21e71544234d674a8 (diff) | |
| download | nova-b6a175664042dfd486fa6217b5e199a46dacefb6.tar.gz nova-b6a175664042dfd486fa6217b5e199a46dacefb6.tar.xz nova-b6a175664042dfd486fa6217b5e199a46dacefb6.zip | |
Destroy VM before VDIs during spawn cleanup
Fixes bug 943453
Change-Id: I65fd4c61f9f91abeb04d0d1956506a1c69cef72e
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 5985779e0..cafcf0bc6 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -200,6 +200,7 @@ class VMOps(object): def spawn(self, context, instance, image_meta, network_info): vdis = None + vm_ref = None try: # 1. Vanity Step # NOTE(sirp): _create_disk will potentially take a *very* long @@ -249,7 +250,7 @@ class VMOps(object): instance.uuid) LOG.debug(_('Instance %s failed to spawn - performing clean-up'), instance.id) - self._handle_spawn_error(vdis, spawn_error) + self._handle_spawn_error(instance, vm_ref, vdis, spawn_error) raise spawn_error def spawn_rescue(self, context, instance, image_meta, network_info): @@ -524,7 +525,11 @@ class VMOps(object): no_agent = version is None self._configure_instance(ctx, instance, vm_ref, no_agent) - def _handle_spawn_error(self, vdis, spawn_error): + def _handle_spawn_error(self, instance, vm_ref, vdis, spawn_error): + if vm_ref: + self._shutdown(instance, vm_ref) + self._destroy_vm(instance, vm_ref) + # Extract resource list from spawn_error. resources = [] if spawn_error.args: |
