[
https://issues.apache.org/jira/browse/CLOUDSTACK-8599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16241448#comment-16241448
]
ASF GitHub Bot commented on CLOUDSTACK-8599:
--------------------------------------------
sateesh-chodapuneedi closed pull request #2092: CLOUDSTACK-8599: [VMware]
Successful migration was reported as failure when vCenter session timed out
URL: https://github.com/apache/cloudstack/pull/2092
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 96558ea5eaa..3050f0a19f0 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
@@ -37,6 +37,7 @@
import com.vmware.vim25.InvalidPropertyFaultMsg;
import com.vmware.vim25.LocalizedMethodFault;
import com.vmware.vim25.ManagedObjectReference;
+import com.vmware.vim25.MethodFault;
import com.vmware.vim25.ObjectContent;
import com.vmware.vim25.ObjectSpec;
import com.vmware.vim25.ObjectUpdate;
@@ -46,9 +47,11 @@
import com.vmware.vim25.PropertyFilterSpec;
import com.vmware.vim25.PropertyFilterUpdate;
import com.vmware.vim25.PropertySpec;
+import com.vmware.vim25.RequestCanceled;
import com.vmware.vim25.RuntimeFaultFaultMsg;
import com.vmware.vim25.SelectionSpec;
import com.vmware.vim25.ServiceContent;
+import com.vmware.vim25.TaskInfo;
import com.vmware.vim25.TaskInfoState;
import com.vmware.vim25.TraversalSpec;
import com.vmware.vim25.UpdateSet;
@@ -347,16 +350,46 @@ public boolean waitForTask(ManagedObjectReference task)
throws InvalidPropertyFa
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 != null && result.length == 2) { //result for 2
properties: info.state, info.error
+ if (result[0].equals(TaskInfoState.SUCCESS)) {
+ retVal = true;
+ }
+ if (result[1] instanceof LocalizedMethodFault) {
+ throw new
RuntimeException(((LocalizedMethodFault)result[1]).getLocalizedMessage());
+ }
}
- if (result[1] instanceof LocalizedMethodFault) {
- throw new RuntimeException(((LocalizedMethodFault)
result[1]).getLocalizedMessage());
+ } catch (WebServiceException we) {
+ s_logger.warn("Session to vCenter failed with: " +
we.getLocalizedMessage());
+
+ TaskInfo taskInfo = (TaskInfo)getDynamicProperty(task, "info");
+ if (!taskInfo.isCancelable()) {
+ s_logger.warn("vCenter task: " + taskInfo.getName() + "(" +
taskInfo.getKey() + ")" + " will continue to run on vCenter because the task
cannot be cancelled");
+ throw new RuntimeException(we.getLocalizedMessage());
}
- } catch(WebServiceException we) {
- s_logger.debug("Cancelling vCenter task because task failed with "
+ we.getLocalizedMessage());
+
+ s_logger.debug("Cancelling vCenter task: " + taskInfo.getName() +
"(" + taskInfo.getKey() + ")");
getService().cancelTask(task);
- throw new RuntimeException("vCenter task failed due to " +
we.getLocalizedMessage());
+
+ // Since task cancellation is asynchronous, wait for the task to
be cancelled
+ Object[] result = waitForValues(task, new String[] {"info.state",
"info.error"}, new String[] {"state"},
+ new Object[][] {new Object[] {TaskInfoState.SUCCESS,
TaskInfoState.ERROR}});
+
+ if (result != null && result.length == 2) { //result for 2
properties: info.state, info.error
+ if (result[0].equals(TaskInfoState.SUCCESS)) {
+ s_logger.warn("Failed to cancel vCenter task: " +
taskInfo.getName() + "(" + taskInfo.getKey() + ")" + " and the task
successfully completed");
+ retVal = true;
+ }
+
+ if (result[1] instanceof LocalizedMethodFault) {
+ MethodFault fault =
((LocalizedMethodFault)result[1]).getFault();
+ if (fault instanceof RequestCanceled) {
+ s_logger.debug("vCenter task " + taskInfo.getName() +
"(" + taskInfo.getKey() + ")" + " was successfully cancelled");
+ throw new RuntimeException(we.getLocalizedMessage());
+ }
+ } else {
+ throw new
RuntimeException(((LocalizedMethodFault)result[1]).getLocalizedMessage());
+ }
+ }
}
return retVal;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> CS reports failure for a successful migration in case of low vCenter session
> timeouts
> -------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-8599
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8599
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Likitha Shetty
> Assignee: Suresh Kumar Anaparti
> Fix For: Future
>
>
> +Steps to reproduce+
> 1. In the global settings change the vmware.vcenter.session.timeout to 60 sec
> 2. Restart MS
> 3. Migrate a large volume so that the corresponding vCenter task takes more
> than a minute.
> Observation
> After the time out, CCP fails the migration operation but the volume
> migration is in progress in vCenter and successfully completes.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)