You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2013/12/17 07:40:14 UTC
git commit: updated refs/heads/4.3 to edbc80b
Updated Branches:
refs/heads/4.3 3abc2a0ac -> edbc80ba6
CLOUDSTACK-5519. [VMWARE] Cancel vCenter tasks if the task invoked by CloudStack failes with timeout error
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/edbc80ba
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/edbc80ba
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/edbc80ba
Branch: refs/heads/4.3
Commit: edbc80ba69d10b599e1402afb3aee51e058bb19e
Parents: 3abc2a0
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon Dec 16 20:08:32 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Dec 17 11:53:58 2013 +0530
----------------------------------------------------------------------
.../hypervisor/vmware/util/VmwareClient.java | 30 +++++++++++++-------
1 file changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/edbc80ba/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
index 2e85f08..f196697 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
@@ -28,6 +28,9 @@ import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.log4j.Logger;
import com.vmware.vim25.DynamicProperty;
import com.vmware.vim25.InvalidCollectorVersionFaultMsg;
@@ -59,6 +62,7 @@ import com.vmware.vim25.VimService;
*
*/
public class VmwareClient {
+ private static final Logger s_logger = Logger.getLogger(VmwareClient.class);
private static class TrustAllTrustManager implements javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager {
@@ -316,19 +320,25 @@ public class VmwareClient {
* @throws RuntimeFaultFaultMsg
* @throws InvalidPropertyFaultMsg
*/
- public boolean waitForTask(ManagedObjectReference task) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg {
+ public boolean waitForTask(ManagedObjectReference task) throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg, Exception {
boolean retVal = false;
- // info has a property - state for state of the task
- Object[] result = waitForValues(task, new String[] { "info.state", "info.error" }, new String[] { "state" }, new Object[][] { new Object[] {
- TaskInfoState.SUCCESS, TaskInfoState.ERROR } });
-
- if (result[0].equals(TaskInfoState.SUCCESS)) {
- retVal = true;
- }
- if (result[1] instanceof LocalizedMethodFault) {
- throw new RuntimeException(((LocalizedMethodFault) result[1]).getLocalizedMessage());
+ try {
+ // info has a property - state for state of the task
+ Object[] result = waitForValues(task, new String[] { "info.state", "info.error" }, new String[] { "state" }, new Object[][] { new Object[] {
+ TaskInfoState.SUCCESS, TaskInfoState.ERROR } });
+
+ if (result[0].equals(TaskInfoState.SUCCESS)) {
+ retVal = true;
+ }
+ if (result[1] instanceof LocalizedMethodFault) {
+ throw new RuntimeException(((LocalizedMethodFault) result[1]).getLocalizedMessage());
+ }
+ } catch(WebServiceException we) {
+ s_logger.debug("Cancelling vCenter task because task failed with " + we.getLocalizedMessage());
+ getService().cancelTask(task);
+ throw new RuntimeException("vCenter task failed due to " + we.getLocalizedMessage());
}
return retVal;
}