diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java index 5b8cbf68e1b..66001ad408b 100644 --- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java +++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java @@ -307,7 +307,9 @@ public class AncientDataMotionStrategy implements DataMotionStrategy { errMsg = e.toString(); } CopyCommandResult result = new CopyCommandResult(null, answer); - result.setResult(errMsg); + if (!answer.getResult()) { + result.setResult(answer.getDetails()); + } callback.complete(result); return null; diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml index 1bce37afd23..4abbf12c961 100644 --- a/engine/storage/integration-test/pom.xml +++ b/engine/storage/integration-test/pom.xml @@ -46,7 +46,13 @@ org.apache.cloudstack - cloud-engine-storage-imagemotion + cloud-engine-storage-datamotion + ${project.version} + test + + + org.apache.cloudstack + cloud-engine-storage-cache ${project.version} test @@ -56,6 +62,7 @@ ${project.version} test + org.apache.httpcomponents httpclient diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java index 4b8dbb868f2..1895c90ad4b 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.engine.service.api.OrchestrationService; import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; import org.apache.cloudstack.framework.rpc.RpcProvider; import org.apache.cloudstack.storage.HostEndpointRpcServer; +import org.apache.cloudstack.storage.cache.manager.StorageCacheManagerImpl; import org.apache.cloudstack.storage.test.ChildTestConfiguration.Library; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; @@ -69,11 +70,14 @@ import com.cloud.storage.dao.VMTemplatePoolDaoImpl; import com.cloud.storage.dao.VMTemplateZoneDaoImpl; import com.cloud.storage.dao.VolumeDaoImpl; import com.cloud.storage.dao.VolumeHostDaoImpl; +import com.cloud.storage.download.DownloadMonitor; import com.cloud.storage.s3.S3Manager; import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.storage.swift.SwiftManager; import com.cloud.tags.dao.ResourceTagsDaoImpl; import com.cloud.template.TemplateManager; +import com.cloud.user.AccountManager; +import com.cloud.user.ResourceLimitService; import com.cloud.user.dao.UserDaoImpl; import com.cloud.utils.component.SpringComponentScanUtils; import com.cloud.vm.VirtualMachineManager; @@ -121,9 +125,9 @@ import com.cloud.vm.snapshot.dao.VMSnapshotDaoImpl; OCFS2ManagerImpl.class, ClusterDetailsDaoImpl.class, SecondaryStorageVmDaoImpl.class, - ConsoleProxyDaoImpl.class, StoragePoolWorkDaoImpl.class, + StorageCacheManagerImpl.class, UserDaoImpl.class }, @@ -147,6 +151,20 @@ public class ChildTestConfiguration extends TestConfiguration { return new MockHostEndpointRpcServerDirectCallResource(); } + @Bean + public ResourceLimitService limtServe() { + return Mockito.mock(ResourceLimitService.class); + } + + @Bean + public DownloadMonitor downloadMonitor() { + return Mockito.mock(DownloadMonitor.class); + } + + @Bean + public AccountManager acctMgt() { + return Mockito.mock(AccountManager.class); + } @Bean public RpcProvider rpcProvider() { return Mockito.mock(RpcProvider.class); diff --git a/engine/storage/integration-test/test/resource/storageContext.xml b/engine/storage/integration-test/test/resource/storageContext.xml index 7c5382d49f9..c4034917983 100644 --- a/engine/storage/integration-test/test/resource/storageContext.xml +++ b/engine/storage/integration-test/test/resource/storageContext.xml @@ -24,20 +24,18 @@ - - - - - - - - - - + - - - + + + + + + + + + + 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 b57333e972a..4e39ddebf09 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 @@ -103,7 +103,7 @@ public class VolumeServiceImpl implements VolumeService { @Inject ResourceLimitService _resourceLimitMgr; @Inject - DownloadMonitor _dlMonitor; + DownloadMonitor downloadMonitor; @Inject AccountManager _accountMgr; @Inject @@ -112,8 +112,6 @@ public class VolumeServiceImpl implements VolumeService { @Inject ConfigurationDao configDao; @Inject - SecondaryStorageVmManager _ssvmMgr; - @Inject AgentManager _agentMgr; @Inject VolumeDataStoreDao _volumeStoreDao; @@ -815,7 +813,7 @@ public class VolumeServiceImpl implements VolumeService { } s_logger.debug("Volume " + volumeHost.getVolumeId() + " needs to be downloaded to " + store.getName()); //TODO: pass a callback later - _dlMonitor.downloadVolumeToStorage(this.volFactory.getVolume(volumeHost.getVolumeId()), store, volumeHost.getDownloadUrl(), volumeHost.getChecksum(), volumeHost.getFormat(), null); + downloadMonitor.downloadVolumeToStorage(this.volFactory.getVolume(volumeHost.getVolumeId()), store, volumeHost.getDownloadUrl(), volumeHost.getChecksum(), volumeHost.getFormat(), null); } } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java index d2dfb479f79..77e5ca66b5a 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java @@ -711,14 +711,13 @@ public class XenServerStorageResource { protected CopyCmdAnswer copyTemplateToPrimaryStorage(DataTO srcData, DataTO destData, int wait) { DataStoreTO srcStore = srcData.getDataStore(); try { - if (srcStore.getRole() == DataStoreRole.ImageCache && srcData.getObjectType() == DataObjectType.TEMPLATE) { - ImageStoreTO srcImageStore = (ImageStoreTO)srcStore; + if ((srcStore instanceof NfsTO) && (srcData.getObjectType() == DataObjectType.TEMPLATE)) { + NfsTO srcImageStore = (NfsTO)srcStore; TemplateObjectTO srcTemplate = (TemplateObjectTO)srcData; - String storeUrl = srcImageStore.getUri(); - if (!storeUrl.startsWith("nfs")) { - return new CopyCmdAnswer("only nfs image cache store supported"); - } - String tmplpath = storeUrl + ":" + srcData.getPath(); + String storeUrl = srcImageStore.getUrl(); + + URI uri = new URI(storeUrl); + String tmplpath = uri.getHost() + ":" + uri.getPath() + "/" + srcData.getPath(); PrimaryDataStoreTO destStore = (PrimaryDataStoreTO)destData.getDataStore(); String poolName = destStore.getUuid(); Connection conn = hypervisorResource.getConnection(); @@ -749,9 +748,8 @@ public class XenServerStorageResource { } catch (Exception e) { } - VolumeObjectTO newVol = new VolumeObjectTO(); + TemplateObjectTO newVol = new TemplateObjectTO(); newVol.setUuid(snapshotvdi.getUuid(conn)); - newVol.setSize(phySize); newVol.setPath(newVol.getUuid()); return new CopyCmdAnswer(newVol); } @@ -1214,8 +1212,13 @@ public class XenServerStorageResource { DataTO destData = cmd.getDestTO(); DataStoreTO srcDataStore = srcData.getDataStore(); DataStoreTO destDataStore = destData.getDataStore(); + DataObjectType srcType = srcData.getObjectType(); + DataObjectType destType = destData.getObjectType(); + DataStoreRole destRole = destDataStore.getRole(); + + boolean nfs = (srcDataStore instanceof NfsTO) ? true : false; - if (srcData.getObjectType() == DataObjectType.TEMPLATE && (srcDataStore instanceof NfsTO) && destData.getDataStore().getRole() == DataStoreRole.Primary) { + if ((srcData.getObjectType() == DataObjectType.TEMPLATE) && (srcDataStore instanceof NfsTO) && (destData.getDataStore().getRole() == DataStoreRole.Primary)) { //copy template to primary storage return copyTemplateToPrimaryStorage(srcData, destData, cmd.getWait()); } else if (srcData.getObjectType() == DataObjectType.TEMPLATE && srcDataStore.getRole() == DataStoreRole.Primary && destDataStore.getRole() == DataStoreRole.Primary) { diff --git a/tools/devcloud/devcloud.cfg b/tools/devcloud/devcloud.cfg index bf4cc92eed5..0be6026a822 100644 --- a/tools/devcloud/devcloud.cfg +++ b/tools/devcloud/devcloud.cfg @@ -83,7 +83,7 @@ "internaldns1": "192.168.56.1", "secondaryStorages": [ { - "url": "nfs://192.168.56.10:/opt/storage/secondary", + "url": "nfs://192.168.56.10/opt/storage/secondary", "providerName": "CloudStack ImageStore Provider", "details": { }