cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [1/6] git commit: updated refs/heads/simulatorStorageFixes to a6bb56b
Date Thu, 27 Jun 2013 15:05:03 GMT
Updated Branches:
  refs/heads/simulatorStorageFixes [created] a6bb56b10


Set all templates/volumes to Ready in the simulator

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/simulatorStorageFixes
Commit: a6bb56b10dd25b2b248644e0dbb2a0f394499cee
Parents: 373dd2b
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Thu Jun 27 20:16:42 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Thu Jun 27 20:34:26 2013 +0530

----------------------------------------------------------------------
 client/tomcatconf/nonossComponentContext.xml.in |  1 -
 .../driver/SimulatorImageStoreDriverImpl.java   | 45 ++++++++++----------
 2 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6bb56b1/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in
index ff69b16..8c1799f 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -177,7 +177,6 @@
      
 -->
 
-
   <!--Motion Strategies-->
   <bean id="vmwareStorageMotionStrategy" class="org.apache.cloudstack.storage.motion.VmwareStorageMotionStrategy"
/>
   <bean id="dataMotionServiceImpl" class="org.apache.cloudstack.storage.motion.DataMotionServiceImpl">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a6bb56b1/plugins/storage/image/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java
b/plugins/storage/image/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java
index 74177ed..8816fc2 100644
--- a/plugins/storage/image/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java
+++ b/plugins/storage/image/simulator/src/org/apache/cloudstack/storage/datastore/driver/SimulatorImageStoreDriverImpl.java
@@ -25,6 +25,7 @@ import com.cloud.agent.api.to.DataObjectType;
 import com.cloud.agent.api.to.DataStoreTO;
 import com.cloud.agent.api.to.NfsTO;
 import com.cloud.storage.Storage;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VMTemplateDao;
@@ -32,6 +33,7 @@ import com.cloud.storage.dao.VolumeDao;
 import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcContext;
@@ -41,6 +43,8 @@ import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
 import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
 import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
 
 import javax.inject.Inject;
 import java.util.Date;
@@ -93,57 +97,54 @@ public class SimulatorImageStoreDriverImpl extends BaseImageStoreDriverImpl
{
 
     protected Void createTemplateAsyncCallback(AsyncCallbackDispatcher<SimulatorImageStoreDriverImpl,
DownloadAnswer> callback,
                                                CreateContext<CreateCmdResult> context)
{
-        DownloadAnswer answer = callback.getResult();
         DataObject obj = context.data;
         DataStore store = obj.getDataStore();
+        TemplateObjectTO templateTO = (TemplateObjectTO)context.data.getTO();
 
         TemplateDataStoreVO tmpltStoreVO = _templateStoreDao.findByStoreTemplate(store.getId(),
obj.getId());
         if (tmpltStoreVO != null) {
             TemplateDataStoreVO updateBuilder = _templateStoreDao.createForUpdate();
-            updateBuilder.setDownloadPercent(answer.getDownloadPct());
-            updateBuilder.setDownloadState(answer.getDownloadStatus());
+            updateBuilder.setDownloadPercent(100);
+            updateBuilder.setDownloadState(VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
             updateBuilder.setLastUpdated(new Date());
-            updateBuilder.setErrorString(answer.getErrorString());
-            updateBuilder.setJobId(answer.getJobId());
-            updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
-            updateBuilder.setInstallPath(answer.getInstallPath());
-            updateBuilder.setSize(answer.getTemplateSize());
-            updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
+            updateBuilder.setSize(new Long(5 * 1024L * 1024L));
+            updateBuilder.setPhysicalSize(new Long(5 * 1024L * 1024L));
+            updateBuilder.setDownloadUrl(templateTO.getOrigUrl());
+            updateBuilder.setInstallPath(templateTO.getPath());
+            updateBuilder.setTemplateId(templateTO.getId());
+            updateBuilder.setState(ObjectInDataStoreStateMachine.State.Ready);
             _templateStoreDao.update(tmpltStoreVO.getId(), updateBuilder);
             // update size in vm_template table
             VMTemplateVO tmlptUpdater = _templateDao.createForUpdate();
-            tmlptUpdater.setSize(answer.getTemplateSize());
+            tmlptUpdater.setSize(new Long(5 * 1024l * 1024l));
             _templateDao.update(obj.getId(), tmlptUpdater);
         }
-
         return null;
     }
 
     protected Void createVolumeAsyncCallback(AsyncCallbackDispatcher<SimulatorImageStoreDriverImpl,
DownloadAnswer> callback,
                                              CreateContext<CreateCmdResult> context)
{
-        DownloadAnswer answer = callback.getResult();
         DataObject obj = context.data;
         DataStore store = obj.getDataStore();
+        VolumeObjectTO volumeTO = (VolumeObjectTO) context.data.getTO();
 
         VolumeDataStoreVO volStoreVO = _volumeStoreDao.findByStoreVolume(store.getId(), obj.getId());
         if (volStoreVO != null) {
             VolumeDataStoreVO updateBuilder = _volumeStoreDao.createForUpdate();
-            updateBuilder.setDownloadPercent(answer.getDownloadPct());
-            updateBuilder.setDownloadState(answer.getDownloadStatus());
+            updateBuilder.setDownloadPercent(100);
+            updateBuilder.setDownloadState(VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
             updateBuilder.setLastUpdated(new Date());
-            updateBuilder.setErrorString(answer.getErrorString());
-            updateBuilder.setJobId(answer.getJobId());
-            updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
-            updateBuilder.setInstallPath(answer.getInstallPath());
-            updateBuilder.setSize(answer.getTemplateSize());
-            updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
+            updateBuilder.setInstallPath(volumeTO.getPath());
+            updateBuilder.setVolumeId(volumeTO.getVolumeId());
+            updateBuilder.setSize(volumeTO.getSize());
+            updateBuilder.setPhysicalSize(volumeTO.getSize());
+            updateBuilder.setState(ObjectInDataStoreStateMachine.State.Ready);
             _volumeStoreDao.update(volStoreVO.getId(), updateBuilder);
             // update size in volume table
             VolumeVO volUpdater = _volumeDao.createForUpdate();
-            volUpdater.setSize(answer.getTemplateSize());
+            volUpdater.setSize(volumeTO.getSize());
             _volumeDao.update(obj.getId(), volUpdater);
         }
-
         return null;
     }
 }
\ No newline at end of file


Mime
View raw message