cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [1/2] Modify DownloadCommand to pass DataTO.
Date Fri, 03 May 2013 06:22:16 GMT
Updated Branches:
  refs/heads/object_store efef4ac69 -> c60c373a3 (forced update)


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
index c2e4c9c..382ae44 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -34,6 +34,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataTO;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcConext;
@@ -45,19 +46,15 @@ import org.apache.cloudstack.storage.image.ImageStoreDriver;
 import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
 import org.apache.cloudstack.storage.image.store.TemplateObject;
 import org.apache.cloudstack.storage.snapshot.SnapshotObject;
-import org.apache.cloudstack.storage.volume.VolumeObject;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
 import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.storage.DeleteVolumeCommand;
 import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.agent.api.to.DataStoreTO;
 import com.cloud.agent.api.to.NfsTO;
-import com.cloud.agent.api.to.S3TO;
-import com.cloud.agent.api.to.SwiftTO;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
 import com.cloud.host.dao.HostDao;
@@ -166,13 +163,9 @@ public class CloudStackImageStoreDriverImpl implements ImageStoreDriver
{
 
 
         if (data.getType() == DataObjectType.TEMPLATE) {
-            TemplateObject tData = (TemplateObject)data;
-            _downloadMonitor.downloadTemplateToStorage(tData, tData.getDataStore(), caller);
+            _downloadMonitor.downloadTemplateToStorage(data, caller);
         } else if (data.getType() == DataObjectType.VOLUME) {
-            VolumeObject volInfo = (VolumeObject)data;
-            RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload();
-            _downloadMonitor.downloadVolumeToStorage(volInfo, volInfo.getDataStore(), payload.getUrl(),
-                    payload.getChecksum(), ImageFormat.valueOf(payload.getFormat().toUpperCase()),
caller);
+            _downloadMonitor.downloadVolumeToStorage(data, caller);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
b/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
index 31e2fdd..c92ea26 100644
--- a/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
+++ b/plugins/storage/image/s3/src/org/apache/cloudstack/storage/datastore/driver/S3ImageStoreDriverImpl.java
@@ -36,6 +36,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataTO;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcConext;
@@ -48,7 +49,6 @@ import org.apache.cloudstack.storage.image.ImageStoreDriver;
 import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
 import org.apache.cloudstack.storage.image.store.TemplateObject;
 import org.apache.cloudstack.storage.snapshot.SnapshotObject;
-import org.apache.cloudstack.storage.volume.VolumeObject;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
@@ -59,10 +59,8 @@ import com.cloud.agent.api.storage.DeleteVolumeCommand;
 import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.agent.api.to.DataStoreTO;
 import com.cloud.agent.api.to.S3TO;
-import com.cloud.agent.api.to.SwiftTO;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
-import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.storage.RegisterVolumePayload;
 import com.cloud.storage.Storage.ImageFormat;
@@ -71,13 +69,11 @@ import com.cloud.storage.SnapshotVO;
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.VMTemplateZoneVO;
-import com.cloud.storage.VolumeHostVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.SnapshotDao;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VMTemplateZoneDao;
 import com.cloud.storage.dao.VolumeDao;
-import com.cloud.storage.dao.VolumeHostDao;
 import com.cloud.storage.download.DownloadMonitor;
 import com.cloud.storage.s3.S3Manager;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
@@ -179,13 +175,9 @@ public class S3ImageStoreDriverImpl implements ImageStoreDriver {
 
 
         if (data.getType() == DataObjectType.TEMPLATE) {
-            TemplateObject tData = (TemplateObject)data;
-            _downloadMonitor.downloadTemplateToStorage(tData, tData.getDataStore(), caller);
+            _downloadMonitor.downloadTemplateToStorage(data, caller);
         } else if (data.getType() == DataObjectType.VOLUME) {
-            VolumeObject volInfo = (VolumeObject)data;
-            RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload();
-            _downloadMonitor.downloadVolumeToStorage(volInfo, volInfo.getDataStore(), payload.getUrl(),
-                    payload.getChecksum(), ImageFormat.valueOf(payload.getFormat().toUpperCase()),
caller);
+            _downloadMonitor.downloadVolumeToStorage(data, caller);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
b/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
index 4f83d4b..1031077 100644
--- a/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
+++ b/plugins/storage/image/swift/src/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java
@@ -48,7 +48,6 @@ import org.apache.cloudstack.storage.image.ImageStoreDriver;
 import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
 import org.apache.cloudstack.storage.image.store.TemplateObject;
 import org.apache.cloudstack.storage.snapshot.SnapshotObject;
-import org.apache.cloudstack.storage.volume.VolumeObject;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
@@ -58,26 +57,21 @@ import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.storage.DeleteVolumeCommand;
 import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.agent.api.to.DataStoreTO;
-import com.cloud.agent.api.to.S3TO;
 import com.cloud.agent.api.to.SwiftTO;
 import com.cloud.event.EventTypes;
 import com.cloud.event.UsageEventUtils;
-import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
-import com.cloud.storage.RegisterVolumePayload;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.SnapshotVO;
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.VMTemplateZoneVO;
-import com.cloud.storage.VolumeHostVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.SnapshotDao;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VMTemplateZoneDao;
 import com.cloud.storage.dao.VolumeDao;
-import com.cloud.storage.dao.VolumeHostDao;
 import com.cloud.storage.download.DownloadMonitor;
 import com.cloud.storage.s3.S3Manager;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
@@ -172,13 +166,9 @@ public class SwiftImageStoreDriverImpl implements ImageStoreDriver {
 
 
         if (data.getType() == DataObjectType.TEMPLATE) {
-            TemplateObject tData = (TemplateObject)data;
-            _downloadMonitor.downloadTemplateToStorage(tData, tData.getDataStore(), caller);
+            _downloadMonitor.downloadTemplateToStorage(data, caller);
         } else if (data.getType() == DataObjectType.VOLUME) {
-            VolumeObject volInfo = (VolumeObject)data;
-            RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload();
-            _downloadMonitor.downloadVolumeToStorage(volInfo, volInfo.getDataStore(), payload.getUrl(),
-                    payload.getChecksum(), ImageFormat.valueOf(payload.getFormat().toUpperCase()),
caller);
+            _downloadMonitor.downloadVolumeToStorage(data, caller);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadAbandonedState.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadAbandonedState.java b/server/src/com/cloud/storage/download/DownloadAbandonedState.java
index ef053ce..187683b 100644
--- a/server/src/com/cloud/storage/download/DownloadAbandonedState.java
+++ b/server/src/com/cloud/storage/download/DownloadAbandonedState.java
@@ -16,8 +16,9 @@
 // under the License.
 package com.cloud.storage.download;
 
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
+
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 
 public class DownloadAbandonedState extends DownloadInactiveState {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadActiveState.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadActiveState.java b/server/src/com/cloud/storage/download/DownloadActiveState.java
index 09d103e..44efa4b 100644
--- a/server/src/com/cloud/storage/download/DownloadActiveState.java
+++ b/server/src/com/cloud/storage/download/DownloadActiveState.java
@@ -16,10 +16,10 @@
 // under the License.
 package com.cloud.storage.download;
 
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
 import org.apache.log4j.Level;
 
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 
 public abstract class DownloadActiveState extends DownloadState {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadCompleteState.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadCompleteState.java b/server/src/com/cloud/storage/download/DownloadCompleteState.java
index 6e8edcb..ea2ae91 100644
--- a/server/src/com/cloud/storage/download/DownloadCompleteState.java
+++ b/server/src/com/cloud/storage/download/DownloadCompleteState.java
@@ -16,7 +16,8 @@
 // under the License.
 package com.cloud.storage.download;
 
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
+
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 
 public class DownloadCompleteState extends DownloadInactiveState {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadErrorState.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadErrorState.java b/server/src/com/cloud/storage/download/DownloadErrorState.java
index e5c8820..aedb56e 100644
--- a/server/src/com/cloud/storage/download/DownloadErrorState.java
+++ b/server/src/com/cloud/storage/download/DownloadErrorState.java
@@ -16,10 +16,10 @@
 // under the License.
 package com.cloud.storage.download;
 
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
 import org.apache.log4j.Level;
 
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 
 public class DownloadErrorState extends DownloadInactiveState {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadListener.java b/server/src/com/cloud/storage/download/DownloadListener.java
index af5d771..001b45d 100755
--- a/server/src/com/cloud/storage/download/DownloadListener.java
+++ b/server/src/com/cloud/storage/download/DownloadListener.java
@@ -34,6 +34,10 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.storage.command.DownloadCommand;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand;
+import org.apache.cloudstack.storage.command.DownloadCommand.ResourceType;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
@@ -46,10 +50,6 @@ import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
 import com.cloud.agent.api.StartupSecondaryStorageCommand;
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.agent.api.storage.DownloadCommand;
-import com.cloud.agent.api.storage.DownloadCommand.ResourceType;
-import com.cloud.agent.api.storage.DownloadProgressCommand;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.ConnectionException;
 import com.cloud.host.Host;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadMonitor.java b/server/src/com/cloud/storage/download/DownloadMonitor.java
index 42fb9d2..5b8f9a0 100644
--- a/server/src/com/cloud/storage/download/DownloadMonitor.java
+++ b/server/src/com/cloud/storage/download/DownloadMonitor.java
@@ -17,11 +17,9 @@
 package com.cloud.storage.download;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.utils.component.Manager;
 
 /**
@@ -31,8 +29,8 @@ import com.cloud.utils.component.Manager;
 public interface DownloadMonitor extends Manager{
 
 
-    public void downloadTemplateToStorage(DataObject template, DataStore store, AsyncCompletionCallback<DownloadAnswer>
callback);
+    public void downloadTemplateToStorage(DataObject template, AsyncCompletionCallback<DownloadAnswer>
callback);
 
-	public void downloadVolumeToStorage(DataObject volume, DataStore store, String url, String
checkSum, ImageFormat format, AsyncCompletionCallback<DownloadAnswer> callback);
+	public void downloadVolumeToStorage(DataObject volume, AsyncCompletionCallback<DownloadAnswer>
callback);
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
index d5d01a6..09dbae3 100755
--- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
+++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
@@ -33,7 +33,12 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.storage.command.DownloadCommand;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand;
+import org.apache.cloudstack.storage.command.DownloadCommand.ResourceType;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
@@ -43,22 +48,12 @@ import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.agent.AgentManager;
-import com.cloud.agent.Listener;
-import com.cloud.agent.api.Command;
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.agent.api.storage.DownloadCommand;
-import com.cloud.agent.api.storage.DownloadCommand.Proxy;
-import com.cloud.agent.api.storage.DownloadCommand.ResourceType;
-import com.cloud.agent.api.storage.DownloadProgressCommand;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
-import com.cloud.agent.manager.Commands;
-import com.cloud.alert.AlertManager;
+import com.cloud.agent.api.storage.Proxy;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.exception.AgentUnavailableException;
-import com.cloud.host.HostVO;
+import com.cloud.storage.RegisterVolumePayload;
 import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.StorageManager;
 import com.cloud.storage.VMTemplateHostVO;
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
@@ -68,20 +63,15 @@ import com.cloud.storage.VolumeHostVO;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
-import com.cloud.storage.swift.SwiftManager;
 import com.cloud.storage.template.TemplateConstants;
-import com.cloud.template.TemplateManager;
 import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.user.AccountManager;
-import com.cloud.user.ResourceLimitService;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.component.ManagerBase;
-import com.cloud.utils.db.DB;
 import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
-import com.cloud.vm.UserVmManager;
-import com.cloud.vm.dao.UserVmDao;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
 
 @Component
 @Local(value = { DownloadMonitor.class })
@@ -175,14 +165,13 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
         return (downloadsInProgress.size() == 0);
     }
 
-    private void initiateTemplateDownload(DataObject template, DataStore store, AsyncCompletionCallback<DownloadAnswer>
callback) {
+    private void initiateTemplateDownload(DataObject template, AsyncCompletionCallback<DownloadAnswer>
callback) {
         boolean downloadJobExists = false;
         TemplateDataStoreVO vmTemplateStore = null;
+        DataStore store = template.getDataStore();
 
         vmTemplateStore = _vmTemplateStoreDao.findByStoreTemplate(store.getId(), template.getId());
         if (vmTemplateStore == null) {
-            // This method can be invoked other places, for example,
-            // handleTemplateSync, in that case, vmTemplateStore may be null
             vmTemplateStore = new TemplateDataStoreVO(store.getId(), template.getId(), new
Date(), 0,
                     VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED, null, null, "jobid0000",
null, template.getUri());
             _vmTemplateStoreDao.persist(vmTemplateStore);
@@ -194,7 +183,7 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
         if (vmTemplateStore != null) {
             start();
             VirtualMachineTemplate tmpl = this._templateDao.findById(template.getId());
-            DownloadCommand dcmd = new DownloadCommand(store.getTO(), tmpl, maxTemplateSizeInBytes);
+            DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(template.getTO()),
maxTemplateSizeInBytes);
             dcmd.setProxy(getHttpProxy());
             if (downloadJobExists) {
                 dcmd = new DownloadProgressCommand(dcmd, vmTemplateStore.getJobId(), RequestType.GET_OR_RESTART);
@@ -238,20 +227,26 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
 
 
     @Override
-    public void downloadTemplateToStorage(DataObject template, DataStore store, AsyncCompletionCallback<DownloadAnswer>
callback) {
+    public void downloadTemplateToStorage(DataObject template, AsyncCompletionCallback<DownloadAnswer>
callback) {
         long templateId = template.getId();
+        DataStore store = template.getDataStore();
         if (isTemplateUpdateable(templateId, store.getId())) {
             if (template != null && template.getUri() != null) {
-                initiateTemplateDownload(template, store, callback);
+                initiateTemplateDownload(template, callback);
             }
         }
     }
 
     @Override
-    public void downloadVolumeToStorage(DataObject volume, DataStore store, String url, String
checkSum, ImageFormat format,
-            AsyncCompletionCallback<DownloadAnswer> callback) {
+    public void downloadVolumeToStorage(DataObject volume, AsyncCompletionCallback<DownloadAnswer>
callback) {
         boolean downloadJobExists = false;
         VolumeDataStoreVO volumeHost = null;
+        DataStore store = volume.getDataStore();
+        VolumeInfo volInfo = (VolumeInfo)volume;
+        RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload();
+        String url = payload.getUrl();
+        String checkSum = payload.getChecksum();
+        ImageFormat format = ImageFormat.valueOf(payload.getFormat());
 
         volumeHost = _volumeStoreDao.findByStoreVolume(store.getId(), volume.getId());
         if (volumeHost == null) {
@@ -266,7 +261,7 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
         if (volumeHost != null) {
             start();
             Volume vol = this._volumeDao.findById(volume.getId());
-            DownloadCommand dcmd = new DownloadCommand(store.getTO(), vol, maxVolumeSizeInBytes,
checkSum, url, format);
+            DownloadCommand dcmd = new DownloadCommand((VolumeObjectTO)(volume.getTO()),
maxVolumeSizeInBytes, checkSum, url, format);
             dcmd.setProxy(getHttpProxy());
             if (downloadJobExists) {
                 dcmd = new DownloadProgressCommand(dcmd, volumeHost.getJobId(), RequestType.GET_OR_RESTART);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/download/NotDownloadedState.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/NotDownloadedState.java b/server/src/com/cloud/storage/download/NotDownloadedState.java
index 7752173..e10feb3 100644
--- a/server/src/com/cloud/storage/download/NotDownloadedState.java
+++ b/server/src/com/cloud/storage/download/NotDownloadedState.java
@@ -16,7 +16,8 @@
 // under the License.
 package com.cloud.storage.download;
 
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand.RequestType;
+
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 
 public class NotDownloadedState extends DownloadActiveState {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c60c373a/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java b/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
index 02463d2..29e6a05 100644
--- a/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
+++ b/server/src/com/cloud/storage/resource/DummySecondaryStorageResource.java
@@ -24,6 +24,8 @@ import java.util.Map;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.storage.command.DownloadCommand;
+import org.apache.cloudstack.storage.command.DownloadProgressCommand;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
@@ -39,8 +41,6 @@ import com.cloud.agent.api.ReadyCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupStorageCommand;
 import com.cloud.agent.api.storage.DownloadAnswer;
-import com.cloud.agent.api.storage.DownloadCommand;
-import com.cloud.agent.api.storage.DownloadProgressCommand;
 import com.cloud.host.Host;
 import com.cloud.host.Host.Type;
 import com.cloud.resource.ServerResource;


Mime
View raw message