cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject git commit: updated refs/heads/vmsync to 38e2964
Date Wed, 08 May 2013 17:09:40 GMT
Updated Branches:
  refs/heads/vmsync 3c780a500 -> 38e2964fd


Re-org async job constant definition place


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

Branch: refs/heads/vmsync
Commit: 38e2964fd77bcd30a9114a64f66ac4b604b18a4d
Parents: 3c780a5
Author: Kelven Yang <kelveny@gmail.com>
Authored: Wed May 8 10:05:35 2013 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Wed May 8 10:05:35 2013 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/resource/VmwareResource.java |    1 -
 .../src/com/cloud/api/ApiAsyncJobDispatcher.java   |    6 ++--
 server/src/com/cloud/async/AsyncJobConstants.java  |   24 +++++++++++++++
 .../com/cloud/async/AsyncJobExecutionContext.java  |    2 +-
 server/src/com/cloud/async/AsyncJobMBeanImpl.java  |    6 ++--
 .../src/com/cloud/async/AsyncJobManagerImpl.java   |   18 +++++-----
 server/src/com/cloud/async/AsyncJobResult.java     |    5 +--
 .../src/com/cloud/async/dao/AsyncJobDaoImpl.java   |    7 ++--
 .../cloud/async/dao/AsyncJobJoinMapDaoImpl.java    |    3 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java      |    9 +++--
 .../src/com/cloud/server/ManagementServerImpl.java |    4 +-
 .../secondary/SecondaryStorageManagerImpl.java     |    9 +++--
 .../storage/snapshot/SnapshotSchedulerImpl.java    |    7 ++--
 .../com/cloud/storage/upload/UploadListener.java   |   11 ++++---
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |    5 ++-
 server/src/com/cloud/vm/VmWorkJobDispatcher.java   |    7 ++--
 16 files changed, 76 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 9becd3f..33ad918 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3914,7 +3914,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         return true;
     }
 
-
     @Override
     public synchronized CreateAnswer execute(CreateCommand cmd) {
         if (s_logger.isInfoEnabled()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
index ae7e0cf..c96457f 100644
--- a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
+++ b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
@@ -28,9 +28,9 @@ import org.apache.cloudstack.api.response.ExceptionResponse;
 import org.apache.log4j.Logger;
 
 import com.cloud.async.AsyncJob;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobDispatcher;
 import com.cloud.async.AsyncJobManager;
-import com.cloud.async.AsyncJobResult;
 import com.cloud.user.Account;
 import com.cloud.user.UserContext;
 import com.cloud.user.dao.AccountDao;
@@ -84,7 +84,7 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
                 _dispatcher.dispatch(cmdObj, params);
 
                 // serialize this to the async job table
-                _asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_SUCCEEDED,
0, cmdObj.getResponseObject());
+                _asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_SUCCEEDED,
0, cmdObj.getResponseObject());
             } finally {
                 UserContext.unregisterContext();
             }
@@ -107,7 +107,7 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
 
             // FIXME:  setting resultCode to ApiErrorCode.INTERNAL_ERROR is not right, usually
executors have their exception handling
             //         and we need to preserve that as much as possible here
-            _asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
response);
+            _asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
response);
         }
 	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/AsyncJobConstants.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/AsyncJobConstants.java b/server/src/com/cloud/async/AsyncJobConstants.java
new file mode 100644
index 0000000..17c37ed
--- /dev/null
+++ b/server/src/com/cloud/async/AsyncJobConstants.java
@@ -0,0 +1,24 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.async;
+
+public interface AsyncJobConstants {
+	public static final int STATUS_IN_PROGRESS = 0;
+	public static final int STATUS_SUCCEEDED = 1;
+	public static final int STATUS_FAILED = 2;
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/AsyncJobExecutionContext.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/AsyncJobExecutionContext.java b/server/src/com/cloud/async/AsyncJobExecutionContext.java
index 9697bed..f8f08dd 100644
--- a/server/src/com/cloud/async/AsyncJobExecutionContext.java
+++ b/server/src/com/cloud/async/AsyncJobExecutionContext.java
@@ -86,7 +86,7 @@ public class AsyncJobExecutionContext  {
     	assert(_job != null);
     	
     	AsyncJobJoinMapVO record = _joinMapDao.getJoinRecord(_job.getId(), joinedJobId);
-    	if(record.getJoinStatus() == AsyncJobResult.STATUS_FAILED && record.getJoinResult()
!= null) {
+    	if(record.getJoinStatus() == AsyncJobConstants.STATUS_FAILED && record.getJoinResult()
!= null) {
     		Object exception = SerializerHelper.fromObjectSerializedString(record.getJoinResult());
     		if(exception != null && exception instanceof Exception) {
     			if(exception instanceof InsufficientCapacityException)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/AsyncJobMBeanImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/AsyncJobMBeanImpl.java b/server/src/com/cloud/async/AsyncJobMBeanImpl.java
index fa579f3..7940751 100644
--- a/server/src/com/cloud/async/AsyncJobMBeanImpl.java
+++ b/server/src/com/cloud/async/AsyncJobMBeanImpl.java
@@ -51,13 +51,13 @@ public class AsyncJobMBeanImpl extends StandardMBean implements AsyncJobMBean
{
 	public String getStatus() {
 		int jobStatus = _job.getStatus();
 		switch(jobStatus) {
-		case AsyncJobResult.STATUS_SUCCEEDED :
+		case AsyncJobConstants.STATUS_SUCCEEDED :
 			return "Completed";
 		
-		case AsyncJobResult.STATUS_IN_PROGRESS:
+		case AsyncJobConstants.STATUS_IN_PROGRESS:
 			return "In preogress";
 			
-		case AsyncJobResult.STATUS_FAILED:
+		case AsyncJobConstants.STATUS_FAILED:
 			return "failed";
 		}
 		

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/AsyncJobManagerImpl.java b/server/src/com/cloud/async/AsyncJobManagerImpl.java
index 57cca06..576d9d3 100644
--- a/server/src/com/cloud/async/AsyncJobManagerImpl.java
+++ b/server/src/com/cloud/async/AsyncJobManagerImpl.java
@@ -197,7 +197,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 return;
             }
             
-            if(job.getStatus() != AsyncJobResult.STATUS_IN_PROGRESS) {
+            if(job.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS) {
                 if(s_logger.isDebugEnabled()) {
                     s_logger.debug("job-" + jobId + " is already completed.");
                 }
@@ -387,8 +387,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                 jobResult.setResultCode(job.getResultCode());
                 jobResult.setUuid(job.getUuid());
 
-                if(job.getStatus() == AsyncJobResult.STATUS_SUCCEEDED ||
-                        job.getStatus() == AsyncJobResult.STATUS_FAILED) {
+                if(job.getStatus() == AsyncJobConstants.STATUS_SUCCEEDED ||
+                        job.getStatus() == AsyncJobConstants.STATUS_FAILED) {
 
                     if(s_logger.isDebugEnabled()) {
                         s_logger.debug("Async job-" + jobId + " completed");
@@ -402,14 +402,14 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     s_logger.debug("Async job-" + jobId + " does not exist, invalid job id?");
                 }
 
-                jobResult.setJobStatus(AsyncJobResult.STATUS_FAILED);
+                jobResult.setJobStatus(AsyncJobConstants.STATUS_FAILED);
                 jobResult.setResult("job-" + jobId + " does not exist");
             }
             txt.commit();
         } catch(Exception e) {
             s_logger.error("Unexpected exception while querying async job-" + jobId + " status:
", e);
 
-            jobResult.setJobStatus(AsyncJobResult.STATUS_FAILED);
+            jobResult.setJobStatus(AsyncJobConstants.STATUS_FAILED);
             jobResult.setResult("Exception: " + e.toString());
             txt.rollback();
         }
@@ -480,7 +480,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     	jobDispatcher.RunJob(job);
                     } else {
                     	s_logger.error("Unable to find job dispatcher, job will be cancelled");
-                        completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
null);
+                        completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
null);
                     }
                     
                     if (s_logger.isDebugEnabled()) {
@@ -489,7 +489,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                    
             	} catch (Throwable e) {
             		s_logger.error("Unexpected exception", e);
-                    completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
null);
+                    completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(),
null);
             	} finally {
             		// guard final clause as well
                     try {
@@ -676,7 +676,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     if(blockItems != null && blockItems.size() > 0) {
                         for(SyncQueueItemVO item : blockItems) {
                             if(item.getContentType().equalsIgnoreCase(SyncQueueItem.AsyncJobContentType))
{
-                                completeAsyncJob(item.getContentId(), AsyncJobResult.STATUS_FAILED,
0,
+                                completeAsyncJob(item.getContentId(), AsyncJobConstants.STATUS_FAILED,
0,
                                         getResetResultResponse("Job is cancelled as it has
been blocking others for too long"));
                             }
 
@@ -725,7 +725,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     Long jobId = item.getContentId();
                     if(jobId != null) {
                         s_logger.warn("Mark job as failed as its correspoding queue-item
has been discarded. job id: " + jobId);
-                        completeAsyncJob(jobId, AsyncJobResult.STATUS_FAILED, 0, getResetResultResponse("Execution
was cancelled because of server shutdown"));
+                        completeAsyncJob(jobId, AsyncJobConstants.STATUS_FAILED, 0, getResetResultResponse("Execution
was cancelled because of server shutdown"));
                     }
                 }
                 _queueMgr.purgeItem(item.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/AsyncJobResult.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/AsyncJobResult.java b/server/src/com/cloud/async/AsyncJobResult.java
index 280780c..7f3ab32 100644
--- a/server/src/com/cloud/async/AsyncJobResult.java
+++ b/server/src/com/cloud/async/AsyncJobResult.java
@@ -19,9 +19,6 @@ package com.cloud.async;
 import com.cloud.api.ApiSerializerHelper;
 
 public class AsyncJobResult {
-	public static final int STATUS_IN_PROGRESS = 0;
-	public static final int STATUS_SUCCEEDED = 1;
-	public static final int STATUS_FAILED = 2;
 	
 	private long jobId;
 	private int jobStatus;
@@ -32,7 +29,7 @@ public class AsyncJobResult {
 
 	public AsyncJobResult(long jobId) {
 		this.jobId = jobId;
-		jobStatus = STATUS_IN_PROGRESS;
+		jobStatus = AsyncJobConstants.STATUS_IN_PROGRESS;
 		processStatus = 0;
 		resultCode = 0;
 		result = "";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java b/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java
index 992b942..3a8798e 100644
--- a/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java
+++ b/server/src/com/cloud/async/dao/AsyncJobDaoImpl.java
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.log4j.Logger;
 
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.async.AsyncJobVO;
 import com.cloud.utils.db.DB;
@@ -68,7 +69,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long>
implements
         SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
         sc.setParameters("instanceType", instanceType);
         sc.setParameters("instanceId", instanceId);
-        sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
+        sc.setParameters("status", AsyncJobConstants.STATUS_IN_PROGRESS);
         
         List<AsyncJobVO> l = listIncludingRemovedBy(sc);
         if(l != null && l.size() > 0) {
@@ -88,7 +89,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long>
implements
         if (accountId != null) {
             sc.setParameters("accountId", accountId);
         }
-        sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
+        sc.setParameters("status", AsyncJobConstants.STATUS_IN_PROGRESS);
         
         return listBy(sc);
 	}
@@ -102,7 +103,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long>
implements
 
 	@DB
 	public void resetJobProcess(long msid, int jobResultCode, String jobResultMessage) {
-		String sql = "UPDATE async_job SET job_status=" + AsyncJobResult.STATUS_FAILED + ", job_result_code="
+ jobResultCode 
+		String sql = "UPDATE async_job SET job_status=" + AsyncJobConstants.STATUS_FAILED + ",
job_result_code=" + jobResultCode 
 			+ ", job_result='" + jobResultMessage + "' where job_status=0 AND (job_complete_msid=?
OR (job_complete_msid IS NULL AND job_init_msid=?))";
 		
         Transaction txn = Transaction.currentTxn();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/async/dao/AsyncJobJoinMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/async/dao/AsyncJobJoinMapDaoImpl.java b/server/src/com/cloud/async/dao/AsyncJobJoinMapDaoImpl.java
index 0da2968..d441ab9 100644
--- a/server/src/com/cloud/async/dao/AsyncJobJoinMapDaoImpl.java
+++ b/server/src/com/cloud/async/dao/AsyncJobJoinMapDaoImpl.java
@@ -18,6 +18,7 @@ package com.cloud.async.dao;
 
 import java.util.List;
 
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobJoinMapVO;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.utils.DateUtil;
@@ -48,7 +49,7 @@ public class AsyncJobJoinMapDaoImpl extends GenericDaoBase<AsyncJobJoinMapVO,
Lo
 		record.setJobId(jobId);
 		record.setJoinJobId(joinJobId);
 		record.setJoinMsid(joinMsid);
-		record.setJoinStatus(AsyncJobResult.STATUS_IN_PROGRESS);
+		record.setJoinStatus(AsyncJobConstants.STATUS_IN_PROGRESS);
 		
 		this.persist(record);
 		return record.getId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 3015d40..3e011dc 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -55,6 +55,7 @@ import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
 import com.cloud.api.commands.DestroyConsoleProxyCmd;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.certificate.dao.CertificateDao;
@@ -2054,11 +2055,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements
ConsoleProxy
 	    	_itMgr.processVmStartWork(vm, ((VmWorkStart)work).getParams(), 
 	    		user, account,  ((VmWorkStart)work).getPlan());
 	    	
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED,
null);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED,
null);
     	} catch(Exception e) {
     		s_logger.error("Exception in process VM-start work", e);
     		String result = SerializerHelper.toObjectSerializedString(e);
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED,
result);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED,
result);
     	}
     }
     
@@ -2074,11 +2075,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements
ConsoleProxy
     	try {
 	    	_itMgr.processVmStopWork(vm, ((VmWorkStop)work).isForceStop(), user, account);
 	    	
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED,
null);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED,
null);
     	} catch(Exception e) {
     		s_logger.error("Exception in process VM-stop work", e);
     		String result = SerializerHelper.toObjectSerializedString(e);
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED,
result);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED,
result);
     	}
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 163bbca..17a9d58 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -2846,7 +2846,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             if (asyncExecutionContext != null) {
                 job = asyncExecutionContext.getJob();
                 _asyncMgr.updateAsyncJobAttachment(job.getId(), Upload.Type.VOLUME.toString(),
volumeId);
-                _asyncMgr.updateAsyncJobStatus(job.getId(), AsyncJobResult.STATUS_IN_PROGRESS,
resultObj);
+                _asyncMgr.updateAsyncJobStatus(job.getId(), AsyncJobConstants.STATUS_IN_PROGRESS,
resultObj);
             }
             String value = _configs.get(Config.CopyVolumeWait.toString());
             int copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
@@ -2867,7 +2867,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 resultObj.setResultString(errorString);
                 resultObj.setUploadStatus(UploadVO.Status.COPY_ERROR.toString());
                 if (asyncExecutionContext != null) {
-                    _asyncMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED,
0, resultObj);
+                    _asyncMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED,
0, resultObj);
                 }
 
                 // Update the DB that volume couldn't be copied

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index 4471781..595115f 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -51,6 +51,7 @@ import com.cloud.agent.api.check.CheckSshCommand;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.capacity.dao.CapacityDao;
@@ -1498,11 +1499,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
 	    	_itMgr.processVmStartWork(vm, ((VmWorkStart)work).getParams(), 
 	    		user, account,  ((VmWorkStart)work).getPlan());
 	    	
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED,
null);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED,
null);
     	} catch(Exception e) {
     		s_logger.error("Exception in process VM-start work", e);
     		String result = SerializerHelper.toObjectSerializedString(e);
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED,
result);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED,
result);
     	}
     }
     
@@ -1518,11 +1519,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
     	try {
 	    	_itMgr.processVmStopWork(vm, ((VmWorkStop)work).isForceStop(), user, account);
 	    	
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED,
null);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED,
null);
     	} catch(Exception e) {
     		s_logger.error("Exception in process VM-stop work", e);
     		String result = SerializerHelper.toObjectSerializedString(e);
-    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED,
result);
+    		AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED,
result);
     	}
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 7f3ac65..b8b0195 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -36,6 +36,7 @@ import org.apache.cloudstack.api.ApiConstants;
 import com.cloud.api.ApiDispatcher;
 import com.cloud.api.ApiGsonHelper;
 import com.cloud.user.Account;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.async.AsyncJobVO;
@@ -141,14 +142,14 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
             Long asyncJobId = snapshotSchedule.getAsyncJobId();
             AsyncJobVO asyncJob = _asyncJobDao.findById(asyncJobId);
             switch (asyncJob.getStatus()) {
-            case AsyncJobResult.STATUS_SUCCEEDED:
+            case AsyncJobConstants.STATUS_SUCCEEDED:
                 // The snapshot has been successfully backed up.
                 // The snapshot state has also been cleaned up.
                 // We can schedule the next job for this snapshot.
                 // Remove the existing entry in the snapshot_schedule table.
                 scheduleNextSnapshotJob(snapshotSchedule);
                 break;
-            case AsyncJobResult.STATUS_FAILED:
+            case AsyncJobConstants.STATUS_FAILED:
                 // Check the snapshot status.
                 Long snapshotId = snapshotSchedule.getSnapshotId();
                 if (snapshotId == null) {
@@ -186,7 +187,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
                 }
 
                 break;
-            case AsyncJobResult.STATUS_IN_PROGRESS:
+            case AsyncJobConstants.STATUS_IN_PROGRESS:
                 // There is no way of knowing from here whether
                 // 1) Another management server is processing this snapshot job
                 // 2) The management server has crashed and this snapshot is lying

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/storage/upload/UploadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadListener.java b/server/src/com/cloud/storage/upload/UploadListener.java
index ee13cf9..c333789 100755
--- a/server/src/com/cloud/storage/upload/UploadListener.java
+++ b/server/src/com/cloud/storage/upload/UploadListener.java
@@ -44,6 +44,7 @@ import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
 import org.apache.cloudstack.api.response.ExtractResponse;
 
 import com.cloud.api.ApiDBUtils;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobResult;
 import com.cloud.exception.AgentUnavailableException;
@@ -364,7 +365,7 @@ public class UploadListener implements Listener {
 		resultObj.setResultString(uploadErrorString);
 		resultObj.setState(state.toString());
 		asyncMgr.updateAsyncJobAttachment(asyncJobId, type.toString(), 1L);
-		asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
+		asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
 
 		UploadVO vo = uploadDao.createForUpdate();
 		vo.setUploadState(state);
@@ -377,7 +378,7 @@ public class UploadListener implements Listener {
 		resultObj.setResultString(uploadErrorString);
 		resultObj.setState(state.toString());
 		asyncMgr.updateAsyncJobAttachment(asyncJobId, type.toString(), 1L);
-		asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
+		asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
 
 
 		UploadVO vo = uploadDao.createForUpdate();
@@ -406,12 +407,12 @@ public class UploadListener implements Listener {
 
 		if (answer.getUploadStatus() == Status.UPLOAD_IN_PROGRESS){
 			asyncMgr.updateAsyncJobAttachment(asyncJobId, type.toString(), 1L);
-			asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
+			asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
 		}else if(answer.getUploadStatus() == Status.UPLOADED){
 		    resultObj.setResultString("Success");
-			asyncMgr.completeAsyncJob(asyncJobId, AsyncJobResult.STATUS_SUCCEEDED, 1, resultObj);
+			asyncMgr.completeAsyncJob(asyncJobId, AsyncJobConstants.STATUS_SUCCEEDED, 1, resultObj);
 		}else{
-			asyncMgr.completeAsyncJob(asyncJobId, AsyncJobResult.STATUS_FAILED, 2, resultObj);
+			asyncMgr.completeAsyncJob(asyncJobId, AsyncJobConstants.STATUS_FAILED, 2, resultObj);
 		}
         UploadVO updateBuilder = uploadDao.createForUpdate();
 		updateBuilder.setUploadPercent(answer.getUploadPct());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 058c6c2..bbd2f3e 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -56,6 +56,7 @@ import com.cloud.agent.manager.allocator.HostAllocator;
 import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiSerializerHelper;
 import com.cloud.async.AsyncJob;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobExecutionContext;
 import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobResult;
@@ -712,7 +713,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
 						return true;
 			
 					VmWorkJobVO workJob = _workJobDao.findById(jobId);
-					if(workJob.getStatus() != AsyncJobResult.STATUS_IN_PROGRESS)
+					if(workJob.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS)
 						return true;
 					
 					return false;
@@ -1152,7 +1153,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
 						return true;
 			
 					VmWorkJobVO workJob = _workJobDao.findById(jobId);
-					if(workJob.getStatus() != AsyncJobResult.STATUS_IN_PROGRESS)
+					if(workJob.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS)
 						return true;
 					
 					return false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38e2964f/server/src/com/cloud/vm/VmWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VmWorkJobDispatcher.java b/server/src/com/cloud/vm/VmWorkJobDispatcher.java
index f033b1e..fc03056 100644
--- a/server/src/com/cloud/vm/VmWorkJobDispatcher.java
+++ b/server/src/com/cloud/vm/VmWorkJobDispatcher.java
@@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
 
 import com.cloud.api.ApiSerializerHelper;
 import com.cloud.async.AsyncJob;
+import com.cloud.async.AsyncJobConstants;
 import com.cloud.async.AsyncJobDispatcher;
 import com.cloud.async.AsyncJobManager;
 import com.cloud.async.AsyncJobResult;
@@ -74,15 +75,15 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
             	Method handler = getHandler(guru, cmd);
             	if(handler != null) {
         			handler.invoke(guru, work);
-            		_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_SUCCEEDED,
0, null);
+            		_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_SUCCEEDED,
0, null);
             	} else {
-            		_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, 0,
null);
+            		_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED,
0, null);
             	}
             } finally {
                 UserContext.unregisterContext();
             }
         } catch(Throwable e) {
-            _asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, 0, null);
+            _asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, 0,
null);
         }
 	}
 	


Mime
View raw message