cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [06/50] [abbrv] git commit: updated refs/heads/rbac to 48e08fe
Date Thu, 06 Mar 2014 22:06:49 GMT
pass over volume info through job boundary for all volume related tasks, since volume record
may be re-created.


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

Branch: refs/heads/rbac
Commit: 0c48f707629a58219de95d6a57f8b898eb5d7698
Parents: cdf605b
Author: Kelven Yang <kelveny@gmail.com>
Authored: Wed Feb 26 15:44:14 2014 -0800
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Fri Feb 28 15:36:00 2014 -0800

----------------------------------------------------------------------
 .../com/cloud/storage/VolumeApiServiceImpl.java | 31 ++++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c48f707/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index a94ebab..50aa87e 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -825,7 +825,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
                 Volume vol = null;
                 try {
-                    vol = outcome.get();
+                    outcome.get();
                 } catch (InterruptedException e) {
                     throw new RuntimeException("Operation is interrupted", e);
                 } catch (java.util.concurrent.ExecutionException e) {
@@ -838,6 +838,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                         throw (ConcurrentOperationException)jobResult;
                     else if (jobResult instanceof Throwable)
                         throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
+                    else if (jobResult instanceof Long) {
+                        vol = _volumeDao.findById((Long)jobResult);
+                    }
                 }
                 return volume;
             }
@@ -1025,7 +1028,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
             Volume vol = null;
             try {
-                vol = outcome.get();
+                outcome.get();
             } catch (InterruptedException e) {
                 throw new RuntimeException("Operation is interrupted", e);
             } catch (java.util.concurrent.ExecutionException e) {
@@ -1038,6 +1041,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                     throw (ConcurrentOperationException)jobResult;
                 else if (jobResult instanceof Throwable)
                     throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
+                else if (jobResult instanceof Long) {
+                    vol = _volumeDao.findById((Long)jobResult);
+                }
             }
             return vol;
         }
@@ -1340,7 +1346,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
             Volume vol = null;
             try {
-                vol = outcome.get();
+                outcome.get();
             } catch (InterruptedException e) {
                 throw new RuntimeException("Operation is interrupted", e);
             } catch (java.util.concurrent.ExecutionException e) {
@@ -1353,6 +1359,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                     throw (ConcurrentOperationException)jobResult;
                 else if (jobResult instanceof Throwable)
                     throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
+                else if (jobResult instanceof Long) {
+                    vol = _volumeDao.findById((Long)jobResult);
+                }
             }
             return vol;
         }
@@ -2365,19 +2374,23 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
     }
 
     private Pair<JobInfo.Status, String> orchestrateAttachVolumeToVM(VmWorkAttachVolume
work) throws Exception {
-        orchestrateAttachVolumeToVM(work.getVmId(), work.getVolumeId(), work.getDeviceId());
-        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);
+        Volume vol = orchestrateAttachVolumeToVM(work.getVmId(), work.getVolumeId(), work.getDeviceId());
+
+        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
+                _jobMgr.marshallResultObject(new Long(vol.getId())));
     }
 
     private Pair<JobInfo.Status, String> orchestrateDetachVolumeFromVM(VmWorkDetachVolume
work) throws Exception {
-        orchestrateDetachVolumeFromVM(work.getVmId(), work.getVolumeId());
-        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);
+        Volume vol = orchestrateDetachVolumeFromVM(work.getVmId(), work.getVolumeId());
+        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
+                _jobMgr.marshallResultObject(new Long(vol.getId())));
     }
 
     private Pair<JobInfo.Status, String> orchestrateResizeVolume(VmWorkResizeVolume
work) throws Exception {
-        orchestrateResizeVolume(work.getVolumeId(), work.getCurrentSize(), work.getNewSize(),
+        Volume vol = orchestrateResizeVolume(work.getVolumeId(), work.getCurrentSize(), work.getNewSize(),
                 work.getNewServiceOfferingId(), work.isShrinkOk());
-        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);
+        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED,
+                _jobMgr.marshallResultObject(new Long(vol.getId())));
     }
 
     private Pair<JobInfo.Status, String> orchestrateMigrateVolume(VmWorkMigrateVolume
work) throws Exception {


Mime
View raw message