Updated Branches: refs/heads/javelin ad3b226ab -> 8aaf5ba3a
fix unit test Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/8aaf5ba3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/8aaf5ba3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/8aaf5ba3 Branch: refs/heads/javelin Commit: 8aaf5ba3a0efa9c6c55113b2cac6a610ce3c47c8 Parents: ad3b226 Author: Edison Su <[email protected]> Authored: Wed Dec 19 16:01:58 2012 -0800 Committer: Edison Su <[email protected]> Committed: Wed Dec 19 16:01:58 2012 -0800 ---------------------------------------------------------------------- .../image/motion/ImageMotionServiceImpl.java | 16 ++------------ .../cloudstack/storage/image/TemplateInfo.java | 2 - .../apache/cloudstack/storage/to/TemplateTO.java | 4 +- .../org/apache/cloudstack/storage/to/VolumeTO.java | 6 ++++- .../storage/volume/VolumeEntityImpl.java | 5 ++++ .../framework/async/AsyncCallbackDispatcher.java | 2 +- .../driver/SolidfirePrimaryDataStoreDriver.java | 15 +++++++------ .../apache/cloudstack/storage/test/VolumeTest.java | 2 +- 8 files changed, 25 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java index 45929e4..feb9880 100644 --- a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java +++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java @@ -22,8 +22,6 @@ import java.util.List; import javax.inject.Inject; -import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.storage.EndPoint; import org.apache.cloudstack.storage.command.CommandResult; @@ -91,16 +89,8 @@ public class ImageMotionServiceImpl implements ImageMotionService { TemplateInfo template = templateStore.getTemplate(); imageService.grantTemplateAccess(template, ep); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setParentCallback(callback) - .setOperationName("imagemotionService.copytemplate.callback"); - - ims.copyTemplateAsync(templateStore, ep, caller); - } - - @AsyncCallbackHandler(operationName="imagemotionService.copytemplate.callback") - public void copyTemplateAsyncCallback( AsyncCallbackDispatcher callback) { - AsyncCallbackDispatcher parentCaller = callback.getParentCallback(); - parentCaller.complete(callback.getResult()); + ims.copyTemplateAsync(templateStore, ep, callback); } + + } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java b/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java index 71e6e3a..0e11f3e 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java +++ b/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java @@ -31,6 +31,4 @@ public interface TemplateInfo { String getPath(); String getUuid(); - - long getVirtualSize(); } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java index 704f36e..8d73fcc 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java +++ b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java @@ -8,13 +8,13 @@ public class TemplateTO { private final String uuid; private final VolumeDiskType diskType; private final ImageDataStoreTO imageDataStore; - private final long size; + private final long size = 0; public TemplateTO(TemplateInfo template) { this.path = template.getPath(); this.uuid = template.getUuid(); this.diskType = template.getDiskType(); this.imageDataStore = new ImageDataStoreTO(template.getImageDataStore()); - this.size = template.getVirtualSize(); + // this.size = template.getVirtualSize(); } public String getPath() { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java index d507eb4..ed7f2be 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java +++ b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java @@ -15,7 +15,11 @@ public class VolumeTO { this.path = volume.getPath(); this.volumeType = volume.getType(); this.diskType = volume.getDiskType(); - this.dataStore = new PrimaryDataStoreTO(volume.getDataStore()); + if (volume.getDataStore() != null) { + this.dataStore = new PrimaryDataStoreTO(volume.getDataStore()); + } else { + this.dataStore = null; + } } public String getUuid() { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java index 546c339..8883e8e 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java @@ -41,6 +41,11 @@ import com.cloud.utils.exception.CloudRuntimeException; public class VolumeEntityImpl implements VolumeEntity { private VolumeInfo volumeInfo; private final VolumeService vs; + + protected VolumeEntityImpl() { + this.vs = null; + } + public VolumeEntityImpl(VolumeInfo volumeObject, VolumeService vs) { this.volumeInfo = volumeObject; this.vs = vs; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java ---------------------------------------------------------------------- diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java index 125d946..f3cb60c 100644 --- a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java @@ -106,7 +106,7 @@ public class AsyncCallbackDispatcher<T> implements AsyncCompletionCallback { } catch (IllegalAccessException e) { throw new RuntimeException("IllegalAccessException when invoking RPC callback for command: " + callback.getCallbackMethod().getName()); } catch (InvocationTargetException e) { - throw new RuntimeException("InvocationTargetException when invoking RPC callback for command: " + callback.getCallbackMethod().getName()); + throw new RuntimeException("InvocationTargetException when invoking RPC callback for command: " + callback.getCallbackMethod().getName(), e); } return true; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java index 915e671..d2d229b 100644 --- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java @@ -2,7 +2,9 @@ package org.apache.cloudstack.storage.datastore.driver; import java.util.Map; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.storage.EndPoint; +import org.apache.cloudstack.storage.command.CommandResult; import org.apache.cloudstack.storage.datastore.PrimaryDataStore; import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo; import org.apache.cloudstack.storage.volume.VolumeObject; @@ -16,13 +18,6 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver { } @Override - public boolean createVolumeFromBaseImage(VolumeObject volume, - TemplateOnPrimaryDataStoreInfo template) { - // TODO Auto-generated method stub - return false; - } - - @Override public boolean deleteVolume(VolumeObject vo) { // TODO Auto-generated method stub return false; @@ -76,4 +71,10 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver { } + @Override + public void createVolumeFromBaseImageAsync(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template, AsyncCompletionCallback<CommandResult> callback) { + // TODO Auto-generated method stub + + } + } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aaf5ba3/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java index eb0550a..50a4314 100644 --- a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java +++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java @@ -100,7 +100,7 @@ public class VolumeTest { results.add(host); Mockito.when(hostDao.listAll()).thenReturn(results); Mockito.when(hostDao.findHypervisorHostInCluster(Mockito.anyLong())).thenReturn(results); - CreateVolumeAnswer createVolumeFromImageAnswer = new CreateVolumeAnswer(UUID.randomUUID().toString()); + CreateVolumeAnswer createVolumeFromImageAnswer = new CreateVolumeAnswer(null,UUID.randomUUID().toString()); try { Mockito.when(agentMgr.send(Mockito.anyLong(), Mockito.any(CreateVolumeFromBaseImageCommand.class))).thenReturn(createVolumeFromImageAnswer);
