Updated Branches: refs/heads/1.6.x b554e2850 -> 8439e5751
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. Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/commit/6a5c6faa Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/6a5c6faa Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/6a5c6faa Branch: refs/heads/1.6.x Commit: 6a5c6faac6b7ecec276e6c770663b3c3cbd11189 Parents: b554e28 Author: Ignasi Barrera <[email protected]> Authored: Mon Jul 8 10:31:35 2013 +0200 Committer: Ignasi Barrera <[email protected]> Committed: Wed Jul 10 22:11:37 2013 +0200 ---------------------------------------------------------------------- .../abiquo/compute/strategy/AbiquoComputeServiceAdapter.java | 3 +++ 1 file changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/6a5c6faa/abiquo/src/main/java/org/jclouds/abiquo/compute/strategy/AbiquoComputeServiceAdapter.java ---------------------------------------------------------------------- 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 6d12bcd..198beb0 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 @@ -204,7 +204,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(); }
