Updated Branches: refs/heads/master 726b1f3ee -> 9695b8757
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/7eb9fb03 Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/7eb9fb03 Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/7eb9fb03 Branch: refs/heads/master Commit: 7eb9fb0372c161ebffb0f3671b0c817c6da59c9d Parents: 726b1f3 Author: Ignasi Barrera <[email protected]> Authored: Mon Jul 8 10:31:35 2013 +0200 Committer: Ignasi Barrera <[email protected]> Committed: Wed Jul 10 12:28:56 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/7eb9fb03/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 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(); }
