incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: add sample driver code: solidfire and s3
Date Thu, 29 Nov 2012 03:50:54 GMT
Updated Branches:
  refs/heads/javelin fc16e1ea1 -> ac5622cc2


add sample driver code: solidfire and s3


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

Branch: refs/heads/javelin
Commit: ac5622cc2a8a234cfc19e25ab1b44c1bb01442ed
Parents: fc16e1e
Author: Edison Su <edison.su@citrix.com>
Authored: Wed Nov 28 19:50:07 2012 -0800
Committer: Edison Su <edison.su@citrix.com>
Committed: Wed Nov 28 19:50:41 2012 -0800

----------------------------------------------------------------------
 engine/pom.xml                                     |    1 +
 .../cloudstack/storage/image/ImageService.java     |   42 -----
 .../image/motion/DefaultImageMotionStrategy.java   |   51 ------
 .../image/motion/ImageMotionServiceImpl.java       |   74 --------
 .../storage/image/motion/ImageMotionStrategy.java  |   30 ---
 engine/storage/imagemotion/pom.xml                 |   62 +++++++
 .../image/motion/DefaultImageMotionStrategy.java   |   51 ++++++
 .../image/motion/ImageMotionServiceImpl.java       |   70 +++++++
 .../storage/image/motion/ImageMotionStrategy.java  |   30 +++
 engine/storage/integration-test/pom.xml            |    6 +
 engine/storage/pom.xml                             |   10 -
 .../cloudstack/storage/image/ImageService.java     |   42 +++++
 .../DefaultPrimaryDatastoreProviderImpl.java       |    2 +-
 .../storage/volume/VolumeServiceImpl.java          |    3 +-
 plugins/pom.xml                                    |    2 +
 plugins/storage/image/s3/pom.xml                   |   41 +++++
 plugins/storage/volume/solidfire/pom.xml           |   40 ++++
 .../driver/SolidfirePrimaryDataStoreDriver.java    |   40 ++++
 .../SolidfirePrimaryDataStoreProvider.java         |   43 +++++
 .../cloudstack/storage/test/AopTestAdvice.java     |   18 ++
 .../storage/test/ChildTestConfiguration.java       |   35 ++++
 .../cloudstack/storage/test/TestConfiguration.java |   21 +++
 .../apache/cloudstack/storage/test/VolumeTest.java |  140 +++++++++++++++
 .../solidfire/test/resource/storageContext.xml     |   34 ++++
 24 files changed, 679 insertions(+), 209 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/pom.xml
----------------------------------------------------------------------
diff --git a/engine/pom.xml b/engine/pom.xml
index 38c1d6b..1a8a0b8 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -39,6 +39,7 @@
     <module>storage</module>
     <module>storage/volume</module>
     <module>storage/image</module>
+    <module>storage/imagemotion</module>
     <module>storage/backup</module>
     <module>storage/snapshot</module>
     <module>storage/integration-test</module>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageService.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageService.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageService.java
deleted file mode 100644
index d657715..0000000
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image;
-
-import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-
-public interface ImageService {
-    TemplateEntity registerTemplate(long templateId, long imageStoreId);
-
-    boolean deleteTemplate(long templateId);
-
-    long registerIso(String isoUrl, long accountId);
-
-    boolean deleteIso(long isoId);
-
-    boolean grantTemplateAccess(TemplateInfo template, EndPoint endpointId);
-
-    boolean revokeTemplateAccess(long templateId, long endpointId);
-
-    String grantIsoAccess(long isoId, long endpointId);
-
-    boolean revokeIsoAccess(long isoId, long endpointId);
-
-    TemplateEntity getTemplateEntity(long templateId);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
deleted file mode 100644
index 625cdc9..0000000
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.motion;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.command.CopyTemplateToPrimaryStorage;
-import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
-import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
-import org.springframework.stereotype.Component;
-
-@Component
-public class DefaultImageMotionStrategy implements ImageMotionStrategy {
-
-    @Override
-    public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore) {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-    @Override
-    public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore) {
-        PrimaryDataStoreInfo pdi = templateStore.getPrimaryDataStore();
-        return pdi.getEndPoints().get(0);
-    }
-
-    @Override
-    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep) {
-        ImageOnPrimayDataStoreTO imageTo = new ImageOnPrimayDataStoreTO(templateStore);
-        CopyTemplateToPrimaryStorage copyCommand = new CopyTemplateToPrimaryStorage(imageTo);
-        ep.sendMessage(copyCommand);
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
deleted file mode 100644
index 3cf5efc..0000000
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.motion;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.image.ImageService;
-import org.apache.cloudstack.storage.image.TemplateInfo;
-import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.volume.VolumeService;
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-public class ImageMotionServiceImpl implements ImageMotionService {
-    @Inject
-    List<ImageMotionStrategy> motionStrategies;
-    @Inject
-    VolumeService volumeService;
-    @Inject
-    ImageService imageService;
-
-    @Override
-    public boolean copyIso(String isoUri, String destIsoUri) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore) {
-        ImageMotionStrategy ims = null;
-        for (ImageMotionStrategy strategy : motionStrategies) {
-            if (strategy.canHandle(templateStore)) {
-                ims = strategy;
-                break;
-            }
-        }
-
-        if (ims == null) {
-            throw new CloudRuntimeException("Can't find proper image motion strategy");
-        }
-
-        EndPoint ep = ims.getEndPoint(templateStore);
-
-        volumeService.grantAccess(templateStore, ep);
-        TemplateInfo template = templateStore.getTemplate();
-        imageService.grantTemplateAccess(template, ep);
-        return ims.copyTemplate(templateStore, ep);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
deleted file mode 100644
index e1df9e2..0000000
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.motion;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
-
-public interface ImageMotionStrategy {
-    public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore);
-
-    public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore);
-
-    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/imagemotion/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/imagemotion/pom.xml b/engine/storage/imagemotion/pom.xml
new file mode 100644
index 0000000..856b9d9
--- /dev/null
+++ b/engine/storage/imagemotion/pom.xml
@@ -0,0 +1,62 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+  license agreements. See the NOTICE file distributed with this work for additional 
+  information regarding copyright ownership. The ASF licenses this file to 
+  you under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-engine-storage-imagemotion</artifactId>
+  <name>Apache CloudStack Engine Storage Image Motion Component</name>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloud-engine</artifactId>
+    <version>4.1.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-storage</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-storage-volume</artifactId>
+      <version>${project.version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-storage-image</artifactId>
+      <version>${project.version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>${cs.mysql.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <version>1.9.5</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <sourceDirectory>src</sourceDirectory>
+    <testSourceDirectory>test</testSourceDirectory>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
new file mode 100644
index 0000000..625cdc9
--- /dev/null
+++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.motion;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.command.CopyTemplateToPrimaryStorage;
+import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
+import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DefaultImageMotionStrategy implements ImageMotionStrategy {
+
+    @Override
+    public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore) {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+    @Override
+    public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore) {
+        PrimaryDataStoreInfo pdi = templateStore.getPrimaryDataStore();
+        return pdi.getEndPoints().get(0);
+    }
+
+    @Override
+    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep) {
+        ImageOnPrimayDataStoreTO imageTo = new ImageOnPrimayDataStoreTO(templateStore);
+        CopyTemplateToPrimaryStorage copyCommand = new CopyTemplateToPrimaryStorage(imageTo);
+        ep.sendMessage(copyCommand);
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/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
new file mode 100644
index 0000000..85db4dc
--- /dev/null
+++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.motion;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.storage.image.ImageService;
+import org.apache.cloudstack.storage.image.TemplateInfo;
+import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.volume.VolumeService;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+public class ImageMotionServiceImpl implements ImageMotionService {
+    @Inject
+    List<ImageMotionStrategy> motionStrategies;
+    @Inject
+    VolumeService volumeService;
+    @Inject
+    ImageService imageService;
+
+    @Override
+    public boolean copyIso(String isoUri, String destIsoUri) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore) {
+        ImageMotionStrategy ims = null;
+        for (ImageMotionStrategy strategy : motionStrategies) {
+            if (strategy.canHandle(templateStore)) {
+                ims = strategy;
+                break;
+            }
+        }
+
+        if (ims == null) {
+            throw new CloudRuntimeException("Can't find proper image motion strategy");
+        }
+
+        EndPoint ep = ims.getEndPoint(templateStore);
+
+        volumeService.grantAccess(templateStore, ep);
+        TemplateInfo template = templateStore.getTemplate();
+        imageService.grantTemplateAccess(template, ep);
+        return ims.copyTemplate(templateStore, ep);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
new file mode 100644
index 0000000..e1df9e2
--- /dev/null
+++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.motion;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
+
+public interface ImageMotionStrategy {
+    public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore);
+
+    public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore);
+
+    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/integration-test/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml
index 62e37a2..c2f4d24 100644
--- a/engine/storage/integration-test/pom.xml
+++ b/engine/storage/integration-test/pom.xml
@@ -39,6 +39,12 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-storage-imagemotion</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>${cs.mysql.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml
index 4a1f9f6..b214201 100644
--- a/engine/storage/pom.xml
+++ b/engine/storage/pom.xml
@@ -66,15 +66,5 @@
     <defaultGoal>install</defaultGoal>
     <sourceDirectory>src</sourceDirectory>
     <testSourceDirectory>test</testSourceDirectory>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.12.4</version>
-        <configuration>
-          <skipTests>true</skipTests>
-        </configuration>
-      </plugin>
-    </plugins>
   </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
new file mode 100644
index 0000000..d657715
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image;
+
+import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+
+public interface ImageService {
+    TemplateEntity registerTemplate(long templateId, long imageStoreId);
+
+    boolean deleteTemplate(long templateId);
+
+    long registerIso(String isoUrl, long accountId);
+
+    boolean deleteIso(long isoId);
+
+    boolean grantTemplateAccess(TemplateInfo template, EndPoint endpointId);
+
+    boolean revokeTemplateAccess(long templateId, long endpointId);
+
+    String grantIsoAccess(long isoId, long endpointId);
+
+    boolean revokeIsoAccess(long isoId, long endpointId);
+
+    TemplateEntity getTemplateEntity(long templateId);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
index bd7c878..cb2e674 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
@@ -23,7 +23,7 @@ public class DefaultPrimaryDatastoreProviderImpl implements PrimaryDataStoreProv
     private final String providerName = "default primary data store provider";
     protected PrimaryDataStoreDriver driver;
     private PrimaryDataStoreProviderVO provider;
-    private final PrimaryDataStoreDao dataStoreDao;
+    protected final PrimaryDataStoreDao dataStoreDao;
     protected PrimaryDataStoreLifeCycle dataStoreLifeCycle;
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/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 0e6ed9f..edb661a 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
@@ -35,6 +35,7 @@ import org.apache.cloudstack.storage.image.motion.ImageMotionService;
 import org.apache.cloudstack.storage.volume.db.VolumeDao;
 import org.apache.cloudstack.storage.volume.db.VolumeVO;
 
+import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
@@ -45,7 +46,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 //1. change volume state
 //2. orchestrator of volume, control most of the information of volume, storage pool id, voluem state, scope etc.
 
-@Service
+@Component
 public class VolumeServiceImpl implements VolumeService {
     @Inject
     VolumeDao volDao;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index dbdea24..a55289f 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -45,6 +45,8 @@
     <module>user-authenticators/ldap</module>
     <module>user-authenticators/md5</module>
     <module>user-authenticators/plain-text</module>
+    <module>storage/volume/solidfire</module>
+    <module>storage/image/s3</module>
   </modules>
 
   <dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/image/s3/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/storage/image/s3/pom.xml b/plugins/storage/image/s3/pom.xml
new file mode 100644
index 0000000..4ea6517
--- /dev/null
+++ b/plugins/storage/image/s3/pom.xml
@@ -0,0 +1,41 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-plugin-storage-image-s3</artifactId>
+  <name>Apache CloudStack Plugin - Storage Image S3</name>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.1.0-SNAPSHOT</version>
+    <relativePath>../../../pom.xml</relativePath>
+  </parent>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-storage-image</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  <build>
+      <defaultGoal>install</defaultGoal>
+      <sourceDirectory>src</sourceDirectory>
+      <testSourceDirectory>test</testSourceDirectory>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/volume/solidfire/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/pom.xml b/plugins/storage/volume/solidfire/pom.xml
new file mode 100644
index 0000000..e3da9ea
--- /dev/null
+++ b/plugins/storage/volume/solidfire/pom.xml
@@ -0,0 +1,40 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+  license agreements. See the NOTICE file distributed with this work for additional 
+  information regarding copyright ownership. The ASF licenses this file to 
+  you under the Apache License, Version 2.0 (the "License"); you may not use 
+  this file except in compliance with the License. You may obtain a copy of 
+  the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+  by applicable law or agreed to in writing, software distributed under the 
+  License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+  OF ANY KIND, either express or implied. See the License for the specific 
+  language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-plugin-storage-volume-solidfire</artifactId>
+  <name>Apache CloudStack Plugin - Storage Volume solidfire</name>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack-plugins</artifactId>
+    <version>4.1.0-SNAPSHOT</version>
+    <relativePath>../../../pom.xml</relativePath>
+  </parent>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-storage-volume</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>${cs.mysql.version}</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <sourceDirectory>src</sourceDirectory>
+    <testSourceDirectory>test</testSourceDirectory>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/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
new file mode 100644
index 0000000..136bec1
--- /dev/null
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
@@ -0,0 +1,40 @@
+package org.apache.cloudstack.storage.datastore.driver;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.volume.VolumeObject;
+
+public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
+
+	@Override
+	public boolean createVolume(VolumeObject vol) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@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;
+	}
+
+	@Override
+	public String grantAccess(VolumeObject vol, EndPoint ep) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean revokeAccess(VolumeObject vol, EndPoint ep) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
new file mode 100644
index 0000000..ef63423
--- /dev/null
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
@@ -0,0 +1,43 @@
+package org.apache.cloudstack.storage.datastore.provider;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
+import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
+import org.apache.cloudstack.storage.datastore.driver.SolidfirePrimaryDataStoreDriver;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.component.ComponentInject;
+
+@Component
+public class SolidfirePrimaryDataStoreProvider extends
+	DefaultPrimaryDatastoreProviderImpl {
+	private final String name = "Solidfre Primary Data Store Provider";
+	private SolidfirePrimaryDataStoreDriver driver;
+	
+	@Inject
+	public SolidfirePrimaryDataStoreProvider(PrimaryDataStoreDao dataStoreDao) {
+		super(dataStoreDao);
+		driver = new SolidfirePrimaryDataStoreDriver();
+		// TODO Auto-generated constructor stub
+	}
+	
+	@Override
+	public String getName() {
+		return name;
+	}
+	
+	@Override
+	public PrimaryDataStore getDataStore(long dataStoreId) {
+		PrimaryDataStoreVO dsv = dataStoreDao.findById(dataStoreId);
+        if (dsv == null) {
+            return null;
+        }
+
+        PrimaryDataStore pds = new DefaultPrimaryDataStoreImpl(driver, dsv, null);
+        pds = ComponentInject.inject(pds);
+        return pds;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.java
new file mode 100644
index 0000000..ba356e3
--- /dev/null
+++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.java
@@ -0,0 +1,18 @@
+package org.apache.cloudstack.storage.test;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+
+import com.cloud.utils.db.Transaction;
+
+public class AopTestAdvice {
+	public Object AopTestMethod(ProceedingJoinPoint call) throws Throwable {
+		Transaction txn = Transaction.open(call.getSignature().getName());
+		Object ret = null;
+		try {
+			 ret = call.proceed();
+		} finally {
+			txn.close();
+		}
+		return ret;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
new file mode 100644
index 0000000..6a7b5ad
--- /dev/null
+++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
@@ -0,0 +1,35 @@
+package org.apache.cloudstack.storage.test;
+
+import org.apache.cloudstack.storage.image.motion.ImageMotionService;
+import org.mockito.Mockito;
+import org.springframework.context.annotation.Bean;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.host.dao.HostDao;
+
+public class ChildTestConfiguration extends TestConfiguration {
+	
+	@Override
+	@Bean
+	public HostDao hostDao() {
+		HostDao dao = super.hostDao();
+		HostDao nDao = Mockito.spy(dao);
+		return nDao;
+	}
+	
+	@Bean
+	public AgentManager agentMgr() {
+		return Mockito.mock(AgentManager.class);
+	}
+	
+	@Bean
+	public ImageMotionService imageMotion() {
+		return Mockito.mock(ImageMotionService.class);
+	}
+
+/*	@Override
+	@Bean
+	public PrimaryDataStoreDao primaryDataStoreDao() {
+		return Mockito.mock(PrimaryDataStoreDaoImpl.class);
+	}*/
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.java
new file mode 100644
index 0000000..42cd8fb
--- /dev/null
+++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.java
@@ -0,0 +1,21 @@
+package org.apache.cloudstack.storage.test;
+
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.cloud.host.dao.HostDao;
+import com.cloud.host.dao.HostDaoImpl;
+
+@Configuration
+public class TestConfiguration {
+	@Bean
+	public HostDao hostDao() {
+		return new HostDaoImpl();
+	}
+	@Bean
+	public PrimaryDataStoreDao primaryDataStoreDao() {
+		return new PrimaryDataStoreDaoImpl();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/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
new file mode 100644
index 0000000..39ecc0c
--- /dev/null
+++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java
@@ -0,0 +1,140 @@
+package org.apache.cloudstack.storage.test;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.command.CreateVolumeAnswer;
+import org.apache.cloudstack.storage.command.CreateVolumeFromBaseImageCommand;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
+import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider;
+import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProviderManager;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.OperationTimedoutException;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster.ClusterType;
+import com.cloud.org.Managed.ManagedState;
+import com.cloud.resource.ResourceState;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:/resource/storageContext.xml")
+public class VolumeTest {
+	@Inject 
+	HostDao hostDao;
+	@Inject
+	HostPodDao podDao;
+	@Inject
+	ClusterDao clusterDao;
+	@Inject
+	DataCenterDao dcDao;
+	@Inject
+	PrimaryDataStoreDao primaryStoreDao;
+	@Inject
+	PrimaryDataStoreProviderManager primaryDataStoreProviderMgr;
+	@Inject
+	AgentManager agentMgr;
+	Long dcId;
+	Long clusterId;
+	@Before
+	public void setUp() {
+		//create data center
+		DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null,  "10.0.0.1/24", 
+				null, null, NetworkType.Basic, null, null, true,  true);
+		dc = dcDao.persist(dc);
+		dcId = dc.getId();
+		//create pod
+
+		HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), "192.168.56.1", "192.168.56.0/24", 8, "test");
+		pod = podDao.persist(pod);
+		//create xen cluster
+		ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster");
+		cluster.setHypervisorType(HypervisorType.XenServer.toString());
+		cluster.setClusterType(ClusterType.CloudManaged);
+		cluster.setManagedState(ManagedState.Managed);
+		cluster = clusterDao.persist(cluster);
+		clusterId = cluster.getId();
+		//create xen host
+
+		HostVO host = new HostVO(UUID.randomUUID().toString());
+		host.setName("devcloud xen host");
+		host.setType(Host.Type.Routing);
+		host.setPrivateIpAddress("192.168.56.2");
+		host.setDataCenterId(dc.getId());
+		host.setVersion("6.0.1");
+		host.setAvailable(true);
+		host.setSetup(true);
+		host.setLastPinged(0);
+		host.setResourceState(ResourceState.Enabled);
+		host.setClusterId(cluster.getId());
+
+		host = hostDao.persist(host);
+		List<HostVO> results = new ArrayList<HostVO>();
+		results.add(host);
+		Mockito.when(hostDao.listAll()).thenReturn(results);
+		Mockito.when(hostDao.findHypervisorHostInCluster(Mockito.anyLong())).thenReturn(results);
+		CreateVolumeAnswer createVolumeFromImageAnswer = new CreateVolumeAnswer(UUID.randomUUID().toString());
+
+		try {
+			Mockito.when(agentMgr.send(Mockito.anyLong(), Mockito.any(CreateVolumeFromBaseImageCommand.class))).thenReturn(createVolumeFromImageAnswer);
+		} catch (AgentUnavailableException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (OperationTimedoutException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+
+		//Mockito.when(primaryStoreDao.findById(Mockito.anyLong())).thenReturn(primaryStore);
+	}
+
+	private PrimaryDataStoreInfo createPrimaryDataStore() {
+		try {
+			primaryDataStoreProviderMgr.configure("primary data store mgr", new HashMap<String, Object>());
+			PrimaryDataStoreProvider provider = primaryDataStoreProviderMgr.getDataStoreProvider("Solidfre Primary Data Store Provider");
+			PrimaryDataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
+			Map<String, String> params = new HashMap<String, String>();
+			params.put("url", "nfs://test/test");
+			params.put("dcId", dcId.toString());
+			params.put("clusterId", clusterId.toString());
+			params.put("name", "my primary data store");
+			PrimaryDataStoreInfo primaryDataStoreInfo = lifeCycle.registerDataStore(params);
+			return primaryDataStoreInfo;
+		} catch (ConfigurationException e) {
+			return null;
+		}
+	}
+	
+	@Test
+	public void createPrimaryDataStoreTest() {
+		createPrimaryDataStore();
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ac5622cc/plugins/storage/volume/solidfire/test/resource/storageContext.xml
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/test/resource/storageContext.xml b/plugins/storage/volume/solidfire/test/resource/storageContext.xml
new file mode 100644
index 0000000..6800d8f
--- /dev/null
+++ b/plugins/storage/volume/solidfire/test/resource/storageContext.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                         http://www.springframework.org/schema/tx 
+       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+       http://www.springframework.org/schema/aop
+       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                                 http://www.springframework.org/schema/context
+                                          http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+  <context:annotation-config />
+  <context:component-scan base-package="org.apache.cloudstack.storage" />
+  <context:component-scan base-package="org.apache.cloudstack.engine.subsystem.api.storage" />
+  <context:component-scan base-package="com.cloud.utils.db" />
+  <context:component-scan base-package="com.cloud.utils.component" />
+  <context:component-scan base-package="com.cloud.host.dao" />
+  <context:component-scan base-package="com.cloud.dc.dao" />
+ 
+   <context:component-scan base-package=" com.cloud.upgrade.dao" />
+   <tx:annotation-driven transaction-manager="transactionManager" />
+  <bean id="aopTestBean" class="org.apache.cloudstack.storage.test.AopTestAdvice"/>
+  <aop:config proxy-target-class="true" >
+    <aop:aspect id="AopTestAdvice" ref="aopTestBean">
+    <aop:pointcut id="aoptest"
+      expression="@annotation(com.cloud.utils.db.DB)" />
+      <aop:around pointcut-ref="aoptest" method="AopTestMethod"/> 
+    </aop:aspect>
+  </aop:config>
+  
+  <bean class="org.apache.cloudstack.storage.test.ChildTestConfiguration" />
+
+</beans>


Mime
View raw message