cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject [19/50] [abbrv] git commit: updated refs/heads/disk_io_throttling to 8b8a0d3
Date Mon, 10 Jun 2013 17:27:13 GMT
CLOUDSTACK-2286: Volume created from snapshot state is in allocated state instead of Ready
state which is letting Primary storage not to increment the resources.


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

Branch: refs/heads/disk_io_throttling
Commit: da5c4619c394eaedec55c277bc5e71de379d6600
Parents: e218a6d
Author: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Authored: Fri Jun 7 17:08:31 2013 +0530
Committer: Devdeep Singh <devdeep@gmail.com>
Committed: Fri Jun 7 17:17:54 2013 +0530

----------------------------------------------------------------------
 .../storage/volume/VolumeServiceImpl.java       | 79 ++++++++++----------
 1 file changed, 40 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/da5c4619/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 7fdf6bb..54dcbd2 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -428,51 +428,52 @@ public class VolumeServiceImpl implements VolumeService {
     public AsyncCallFuture<VolumeApiResult> createVolumeFromSnapshot(
             VolumeInfo volume, DataStore store, SnapshotInfo snapshot) {
         AsyncCallFuture<VolumeApiResult> future = new AsyncCallFuture<VolumeApiResult>();
-        
+
         try {
-        	DataObject volumeOnStore = store.create(volume);
-        	volume.processEvent(Event.CreateOnlyRequested);
-        	 CreateVolumeFromBaseImageContext<VolumeApiResult> context = new CreateVolumeFromBaseImageContext<VolumeApiResult>(null,

-        			 (VolumeObject)volume, store, volumeOnStore, future);
-             AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> caller =
 AsyncCallbackDispatcher.create(this);
-             caller.setCallback(caller.getTarget().createVolumeFromSnapshotCallback(null,
null))
-             .setContext(context);
-        	this.motionSrv.copyAsync(snapshot, volumeOnStore, caller);
+            DataObject volumeOnStore = store.create(volume);
+            volume = this.volFactory.getVolume(volume.getId(), store);
+            volume.processEvent(Event.CreateOnlyRequested);
+            CreateVolumeFromBaseImageContext<VolumeApiResult> context = new CreateVolumeFromBaseImageContext<VolumeApiResult>(null,
+                    (VolumeObject)volume, store, volumeOnStore, future);
+            AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> caller =
 AsyncCallbackDispatcher.create(this);
+            caller.setCallback(caller.getTarget().createVolumeFromSnapshotCallback(null,
null))
+            .setContext(context);
+            this.motionSrv.copyAsync(snapshot, volumeOnStore, caller);
         } catch (Exception e) {
-        	s_logger.debug("create volume from snapshot failed", e);
-        	VolumeApiResult result = new VolumeApiResult(volume);
-        	result.setResult(e.toString());
-        	future.complete(result);
+            s_logger.debug("create volume from snapshot failed", e);
+            VolumeApiResult result = new VolumeApiResult(volume);
+            result.setResult(e.toString());
+            future.complete(result);
         }
-        
+
         return future;
     }
-    
-    protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl,
CopyCommandResult> callback, 
-    		CreateVolumeFromBaseImageContext<VolumeApiResult> context) {
-    	CopyCommandResult result = callback.getResult();
-    	VolumeInfo volume = context.vo;
-    	VolumeApiResult apiResult = new VolumeApiResult(volume);
-    	Event event = null;
-    	if (result.isFailed()) {
-    		apiResult.setResult(result.getResult());
-    		event = Event.OperationFailed;
-    	} else {
-    		event = Event.OperationSuccessed;
-    	}
-    	
-    	try {
-    		volume.processEvent(event);
-    	} catch (Exception e) {
-    		s_logger.debug("create volume from snapshot failed", e);
-    		apiResult.setResult(e.toString());
-    	}
-    	
-    	AsyncCallFuture<VolumeApiResult> future = context.future;
-    	future.complete(apiResult);
-    	return null;
+
+    protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl,
CopyCommandResult> callback,
+            CreateVolumeFromBaseImageContext<VolumeApiResult> context) {
+        CopyCommandResult result = callback.getResult();
+        VolumeInfo volume = context.vo;
+        VolumeApiResult apiResult = new VolumeApiResult(volume);
+        Event event = null;
+        if (result.isFailed()) {
+            apiResult.setResult(result.getResult());
+            event = Event.OperationFailed;
+        } else {
+            event = Event.OperationSuccessed;
+        }
+
+        try {
+            volume.processEvent(event);
+        } catch (Exception e) {
+            s_logger.debug("create volume from snapshot failed", e);
+            apiResult.setResult(e.toString());
+        }
+
+        AsyncCallFuture<VolumeApiResult> future = context.future;
+        future.complete(apiResult);
+        return null;
     }
-    
+
     protected VolumeVO duplicateVolumeOnAnotherStorage(Volume volume, StoragePool pool) {
         Long lastPoolId = volume.getPoolId();
         VolumeVO newVol = new VolumeVO(volume);


Mime
View raw message