You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/05/12 08:18:45 UTC

git commit: updated refs/heads/4.4-forward to aaa2f59

Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward be73571c7 -> aaa2f5932


CLOUDSTACK-5674: Fixed cloudstackConnection.py to return FAILED in case of well handled exceptions returning from server having jobresultcode as 530


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aaa2f593
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aaa2f593
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aaa2f593

Branch: refs/heads/4.4-forward
Commit: aaa2f5932ba8f7d3ef08ad5176744811589176f5
Parents: be73571
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Sun May 11 19:08:19 2014 -0400
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Sun May 11 19:31:15 2014 -0400

----------------------------------------------------------------------
 tools/marvin/marvin/cloudstackConnection.py | 24 ++++++++++--------------
 tools/marvin/marvin/codes.py                |  2 ++
 2 files changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aaa2f593/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index 8044da7..1ff8381 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -21,26 +21,18 @@ import base64
 import hmac
 import hashlib
 import time
-from cloudstackAPI import *
+from cloudstackAPI import queryAsyncJobResult
 import jsonHelper
 from marvin.codes import (
     FAILED,
-    INVALID_RESPONSE,
-    INVALID_INPUT,
     JOB_FAILED,
-    JOB_INPROGRESS,
     JOB_CANCELLED,
-    JOB_SUCCEEDED
+    JOB_SUCCEEDED,
+    JOB_NO_EXCEPTION,
+    JOB_EXCEPTION_OCCURED
 )
-from requests import (
-    ConnectionError,
-    HTTPError,
-    Timeout,
-    RequestException
-)
-from marvin.cloudstackException import (
-    InvalidParameterException,
-    GetDetailExceptionInfo)
+from marvin.cloudstackException import (GetDetailExceptionInfo,
+                                        InvalidParameterException)
 
 
 class CSConnection(object):
@@ -100,6 +92,7 @@ class CSConnection(object):
             start_time = time.time()
             end_time = time.time()
             async_response = FAILED
+            jobresultcode = JOB_NO_EXCEPTION
             self.logger.debug("=== Jobid: %s Started ===" % (str(jobid)))
             while timeout > 0:
                 async_response = self.\
@@ -109,6 +102,7 @@ class CSConnection(object):
                     if job_status in [JOB_FAILED,
                                       JOB_CANCELLED,
                                       JOB_SUCCEEDED]:
+                        jobresultcode = async_response.jobresultcode
                         break
                 time.sleep(5)
                 timeout -= 5
@@ -122,6 +116,8 @@ class CSConnection(object):
                 "TotalTime:%s===" %
                 (str(jobid), str(time.ctime(start_time)),
                  str(time.ctime(end_time)), str(tot_time)))
+            if jobresultcode == JOB_EXCEPTION_OCCURED:
+                async_response = FAILED
             return async_response
         except Exception as e:
             self.__lastError = e

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aaa2f593/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index ef49c0c..0619374 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -60,6 +60,8 @@ JOB_INPROGRESS = 0
 JOB_SUCCEEDED = 1
 JOB_FAILED = 2
 JOB_CANCELLED = 3
+JOB_EXCEPTION_OCCURED = 530
+JOB_NO_EXCEPTION = 0
 '''
 User Related Codes
 '''