From c9f400e1284d8cb7637e586f2e30343690695572 Mon Sep 17 00:00:00 2001 From: Ignasi Barrera Date: Mon, 8 Jul 2013 10:31:35 +0200 Subject: [PATCH 1/2] JCLOUDS-171: Fixed NPE when destroying nodes in Abiquo There was a race condition when destroying a node in Abiquo using the ComputeService: jclouds performed the active wait until the node was in state TERMINATED, and used the transformation functions to convert an Abiquo VirtualMachine to a NodeMetadata. If the node was effectively deleted during this transformation, a NPE was raised. This is because there are a couple of API calls that are executed in that transformation to retrieve all information required to build the NodeMetadata. To prevent this, the AbiquoComputeServiceAdapter will block until the node has been actually deleted instead of delegating that to jclouds. This way there is no need to run the transformation functions that had the race condition. --- .../jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java b/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java index 2853f75..bec572e 100644 --- a/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java +++ b/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java @@ -215,7 +215,10 @@ public class AbiquoComputeServiceAdapter @Override public void destroyNode(final String id) { + VirtualMachineMonitor monitor = monitoringService.getVirtualMachineMonitor(); VirtualMachine vm = getNode(id); + vm.undeploy(true); + monitor.awaitCompletionUndeploy(vm); vm.delete(); } -- 1.7.12.4 (Apple Git-37)