You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/11/28 04:17:38 UTC

[2/6] seperate code into different modules: storage, storage/volume, storage/image, storage/snapshot, storage/backup, storage/integration-test

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java
new file mode 100644
index 0000000..68952b1
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java
@@ -0,0 +1,42 @@
+package org.apache.cloudstack.storage.test;
+
+
+import org.mockito.Mockito;
+import org.springframework.beans.factory.FactoryBean;
+
+/**
+ * A {@link FactoryBean} for creating mocked beans based on Mockito so that they 
+ * can be {@link @Autowired} into Spring test configurations.
+ *
+ * @author Mattias Severson, Jayway
+ *
+ * @see FactoryBean
+ * @see org.mockito.Mockito
+ */
+public class StorageFactoryBean<T> implements FactoryBean<T> {
+
+    private Class<T> classToBeMocked;
+
+    /**
+     * Creates a Mockito mock instance of the provided class.
+     * @param classToBeMocked The class to be mocked.
+     */
+    public StorageFactoryBean(Class<T> classToBeMocked) {
+        this.classToBeMocked = classToBeMocked;
+    }
+
+    @Override
+    public T getObject() throws Exception {
+        return Mockito.mock(classToBeMocked);
+    }
+
+    @Override
+    public Class<?> getObjectType() {
+        return classToBeMocked;
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.java
new file mode 100644
index 0000000..2a285cb
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.java
@@ -0,0 +1,20 @@
+package org.apache.cloudstack.storage.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:resource/storageContext.xml")
+public class StorageTest {
+
+	@Test
+	public void test() {
+		fail("Not yet implemented");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestConfiguration.java
new file mode 100644
index 0000000..42cd8fb
--- /dev/null
+++ b/engine/storage/integration-test/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/225ad3c2/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java
new file mode 100644
index 0000000..a96d7ec
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.storage.test;
+
+public class XenEndpoint {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
new file mode 100644
index 0000000..b11e6cd
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
@@ -0,0 +1,299 @@
+/*
+ * 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.test;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
+import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.QCOW2;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VHD;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VMDK;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskTypeHelper;
+import org.apache.cloudstack.engine.subsystem.api.storage.type.RootDisk;
+import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeTypeHelper;
+import org.apache.cloudstack.storage.command.CreateVolumeAnswer;
+import org.apache.cloudstack.storage.command.CreateVolumeFromBaseImageCommand;
+import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
+import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
+import org.apache.cloudstack.storage.datastore.provider.DefaultPrimaryDatastoreProviderImpl;
+import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider;
+import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProviderManager;
+import org.apache.cloudstack.storage.image.ImageService;
+import org.apache.cloudstack.storage.image.db.ImageDataDao;
+import org.apache.cloudstack.storage.image.db.ImageDataVO;
+import org.apache.cloudstack.storage.image.format.ISO;
+import org.apache.cloudstack.storage.image.format.ImageFormat;
+import org.apache.cloudstack.storage.image.format.ImageFormatHelper;
+import org.apache.cloudstack.storage.image.format.OVA;
+import org.apache.cloudstack.storage.image.format.Unknown;
+import org.apache.cloudstack.storage.image.provider.ImageDataStoreProvider;
+import org.apache.cloudstack.storage.image.provider.ImageDataStoreProviderManager;
+import org.apache.cloudstack.storage.image.store.ImageDataStore;
+import org.apache.cloudstack.storage.volume.VolumeService;
+import org.apache.cloudstack.storage.volume.db.VolumeDao;
+import org.apache.cloudstack.storage.volume.db.VolumeVO;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.junit.runner.RunWith;
+
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.mockito.Mockito;
+import org.mockito.Mockito.*;
+
+
+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.Status;
+import com.cloud.host.Status.Event;
+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;
+import com.cloud.storage.Storage.TemplateType;
+import com.cloud.utils.component.ComponentInject;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Transaction;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:/resource/storageContext.xml")
+public class volumeServiceTest {
+	@Inject
+	ImageDataStoreProviderManager imageProviderMgr;
+	@Inject
+	ImageService imageService;
+	@Inject
+	VolumeService volumeService;
+	@Inject
+	ImageDataDao imageDataDao;
+	@Inject
+	VolumeDao volumeDao;
+	@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 ImageDataVO createImageData() {
+		ImageDataVO image = new ImageDataVO();
+		image.setTemplateType(TemplateType.USER);
+		image.setUrl("http://testurl/test.vhd");
+		image.setUniqueName(UUID.randomUUID().toString());
+		image.setName(UUID.randomUUID().toString());
+		image.setPublicTemplate(true);
+		image.setFeatured(true);
+		image.setRequireHvm(true);
+		image.setBits(64);
+		image.setFormat(new VHD().toString());
+		image.setAccountId(1);
+		image.setEnablePassword(true);
+		image.setEnableSshKey(true);
+		image.setGuestOSId(1);
+		image.setBootable(true);
+		image.setPrepopulate(true);
+		image.setCrossZones(true);
+		image.setExtractable(true);
+		image = imageDataDao.persist(image);
+		return image;
+	}
+
+	private TemplateEntity createTemplate() {
+		try {
+			imageProviderMgr.configure("image Provider", new HashMap<String, Object>());
+			ImageDataVO image = createImageData();
+			ImageDataStoreProvider defaultProvider = imageProviderMgr.getProvider("DefaultProvider");
+			ImageDataStore store = defaultProvider.registerDataStore("defaultHttpStore", new HashMap<String, String>());
+			imageService.registerTemplate(image.getId(), store.getImageDataStoreId());
+			TemplateEntity te = imageService.getTemplateEntity(image.getId());
+			return te;
+		} catch (ConfigurationException e) {
+			return null;
+		}
+	}
+
+	@Test
+	public void createTemplateTest() {
+		createTemplate();
+	}
+
+	private PrimaryDataStoreInfo createPrimaryDataStore() {
+		try {
+			primaryDataStoreProviderMgr.configure("primary data store mgr", new HashMap<String, Object>());
+			PrimaryDataStoreProvider provider = primaryDataStoreProviderMgr.getDataStoreProvider("default 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();
+	}
+
+	private VolumeVO createVolume(long templateId) {
+		VolumeVO volume = new VolumeVO(1000, new RootDisk().toString(), UUID.randomUUID().toString(), templateId);
+		volume = volumeDao.persist(volume);
+		return volume;
+
+	}
+
+	@Test
+	public void createVolumeFromTemplate() {
+		TemplateEntity te = createTemplate();
+		PrimaryDataStoreInfo dataStoreInfo = createPrimaryDataStore();
+		VolumeVO volume = createVolume(te.getId());
+		VolumeEntity ve = volumeService.getVolumeEntity(volume.getId());
+		ve.createVolumeFromTemplate(dataStoreInfo.getId(), new VHD(), te);
+	}
+
+	//@Test
+	public void test1() {
+		System.out.println(VolumeTypeHelper.getType("Root"));
+		System.out.println(VolumeDiskTypeHelper.getDiskType("vmdk"));
+		System.out.println(ImageFormatHelper.getFormat("ova"));
+		assertFalse(new VMDK().equals(new VHD()));
+		VMDK vmdk = new VMDK();
+		assertTrue(vmdk.equals(vmdk));
+		VMDK newvmdk = new VMDK();
+		assertTrue(vmdk.equals(newvmdk));
+
+		ImageFormat ova = new OVA();
+		ImageFormat iso = new ISO();
+		assertTrue(ova.equals(new OVA()));
+		assertFalse(ova.equals(iso));
+		assertTrue(ImageFormatHelper.getFormat("test").equals(new Unknown()));
+
+		VolumeDiskType qcow2 = new QCOW2();
+		ImageFormat qcow2format = new org.apache.cloudstack.storage.image.format.QCOW2();
+		assertFalse(qcow2.equals(qcow2format));
+
+	}
+
+	//@Test
+	public void testStaticBean() {
+		DefaultPrimaryDatastoreProviderImpl provider = ComponentInject.inject(DefaultPrimaryDatastoreProviderImpl.class);
+		//assertNotNull(provider.dataStoreDao);
+
+		DefaultPrimaryDataStoreImpl dpdsi = new DefaultPrimaryDataStoreImpl(null, null, null);
+		ComponentInject.inject(dpdsi);
+		//assertNotNull(dpdsi.volumeDao);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/integration-test/test/resource/storageContext.xml
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/resource/storageContext.xml b/engine/storage/integration-test/test/resource/storageContext.xml
new file mode 100644
index 0000000..86811c3
--- /dev/null
+++ b/engine/storage/integration-test/test/resource/storageContext.xml
@@ -0,0 +1,42 @@
+<?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 id="someDependencyMock" class="org.apache.cloudstack.storage.test.StorageFactoryBean">
+    <constructor-arg name="classToBeMocked"
+      value="org.apache.cloudstack.storage.volume.VolumeMotionService" />
+  </bean>
+  
+  <bean class="org.apache.cloudstack.storage.test.ChildTestConfiguration" />
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml
index f922a21..4a1f9f6 100644
--- a/engine/storage/pom.xml
+++ b/engine/storage/pom.xml
@@ -35,22 +35,17 @@
       <artifactId>cloud-server</artifactId>
       <version>${project.version}</version>
     </dependency>
-	<dependency>
+    <dependency>
       <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-engine-components-api</artifactId>
       <version>${project.version}</version>
-	</dependency>
+    </dependency>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-engine-api</artifactId>
       <version>${project.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.openjpa</groupId>
-      <artifactId>openjpa</artifactId>
-      <version>2.2.0</version>
-    </dependency>
-    <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>${cs.mysql.version}</version>
@@ -62,24 +57,24 @@
       <version>1.9.5</version>
     </dependency>
     <dependency>
-    <groupId>org.aspectj</groupId>
-    <artifactId>aspectjrt</artifactId>
-    <version>1.7.1</version>
-</dependency>
-<dependency>
-    <groupId>org.aspectj</groupId>
-    <artifactId>aspectjweaver</artifactId>
-    <version>1.7.1</version>
-</dependency>
-<dependency>
-    <groupId>javax.inject</groupId>
-    <artifactId>javax.inject</artifactId>
-    <version>1</version>
-</dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+    </dependency>
   </dependencies>
   <build>
     <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/225ad3c2/engine/storage/snapshot/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/pom.xml b/engine/storage/snapshot/pom.xml
new file mode 100644
index 0000000..45439c4
--- /dev/null
+++ b/engine/storage/snapshot/pom.xml
@@ -0,0 +1,50 @@
+<!-- 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-snapshot</artifactId>
+  <name>Apache CloudStack Engine Storage Snapshot 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>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/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java
deleted file mode 100644
index cb49027..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java
+++ /dev/null
@@ -1,23 +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.backup;
-
-public interface BackupMotionService {
-    boolean copySnapshot(String snapshotUri, String destSnapshotUri);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java
deleted file mode 100644
index ebb4c9f..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java
+++ /dev/null
@@ -1,25 +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.backup;
-
-public interface BackupService {
-    String grantAccessSnapshot(long snapshotId, long endpointId);
-
-    boolean revokeAccessSnapshot(long snapshotId, long endpointId);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
deleted file mode 100644
index 5c61da0..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
+++ /dev/null
@@ -1,23 +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.datastore;
-
-public enum DataStoreStatus {
-    Creating, Up, PrepareForMaintenance, ErrorInMaintenance, CancelMaintenance, Maintenance, Removed;
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
deleted file mode 100644
index c543271..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.apache.cloudstack.storage.datastore;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
-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.engine.subsystem.api.storage.disktype.VolumeDiskType;
-import org.apache.cloudstack.storage.HypervisorHostEndPoint;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
-import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
-import org.apache.cloudstack.storage.image.TemplateInfo;
-import org.apache.cloudstack.storage.image.TemplateObject;
-
-import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.volume.TemplatePrimaryDataStoreManager;
-import org.apache.cloudstack.storage.volume.VolumeEntityImpl;
-import org.apache.cloudstack.storage.volume.VolumeEvent;
-import org.apache.cloudstack.storage.volume.VolumeObject;
-import org.apache.cloudstack.storage.volume.db.VolumeDao;
-import org.apache.cloudstack.storage.volume.db.VolumeVO;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.dao.EntityManager;
-import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.component.ComponentInject;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-import edu.emory.mathcs.backport.java.util.Collections;
-
-public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
-    private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreImpl.class);
-    protected PrimaryDataStoreDriver driver;
-    protected PrimaryDataStoreVO pdsv;
-    protected PrimaryDataStoreInfo pdsInfo;
-    @Inject
-    private VolumeDao volumeDao;
-    @Inject
-    HostDao hostDao;
-    @Inject
-    TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
-
-    public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, PrimaryDataStoreVO pdsv, PrimaryDataStoreInfo pdsInfo) {
-        this.driver = driver;
-        this.pdsv = pdsv;
-        this.pdsInfo = pdsInfo;
-    }
-
-    @Override
-    public VolumeInfo getVolume(long id) {
-        VolumeVO volumeVO = volumeDao.findById(id);
-        VolumeObject vol = VolumeObject.getVolumeObject(this, volumeVO);
-        return vol;
-    }
-
-    @Override
-    public List<VolumeInfo> getVolumes() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean deleteVolume(long id) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public List<EndPoint> getEndPoints() {
-        Long clusterId = pdsv.getClusterId();
-        if (clusterId == null) {
-            return null;
-        }
-        List<EndPoint> endpoints = new ArrayList<EndPoint>();
-        List<HostVO> hosts = hostDao.findHypervisorHostInCluster(clusterId);
-        for (HostVO host : hosts) {
-            HypervisorHostEndPoint ep = new HypervisorHostEndPoint(host.getId());
-            ComponentInject.inject(ep);
-            endpoints.add(ep);
-        }
-        Collections.shuffle(endpoints);
-        return endpoints;
-    }
-
-    @Override
-    public PrimaryDataStoreInfo getDataStoreInfo() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean isHypervisorSupported(HypervisorType hypervisor) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean isLocalStorageSupported() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean isVolumeDiskTypeSupported(VolumeDiskType diskType) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public long getCapacity() {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public long getAvailableCapacity() {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public VolumeObject createVolume(VolumeInfo vi, VolumeDiskType diskType) {
-        if (!pdsInfo.isVolumeDiskTypeSupported(diskType)) {
-            return null;
-        }
-        VolumeObject vo = (VolumeObject) vi;
-        vo.setVolumeDiskType(diskType);
-        this.driver.createVolume(vo);
-        return vo;
-    }
-
-    @Override
-    public boolean exists(VolumeInfo vi) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean templateExists(TemplateInfo template) {
-        return (templatePrimaryStoreMgr.findTemplateOnPrimaryDataStore(template, this) != null) ? true : false;
-    }
-
-    @Override
-    public VolumeDiskType getDefaultDiskType() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public long getId() {
-        return pdsv.getId();
-    }
-
-    @Override
-    public TemplateOnPrimaryDataStoreInfo getTemplate(TemplateInfo template) {
-        return templatePrimaryStoreMgr.findTemplateOnPrimaryDataStore(template, this);
-    }
-
-    @Override
-    public VolumeInfo createVoluemFromBaseImage(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo template) {
-        VolumeObject vo = (VolumeObject) volume;
-        vo.setVolumeDiskType(template.getTemplate().getDiskType());
-        this.driver.createVolumeFromBaseImage(vo, template);
-        return volume;
-    }
-
-    @Override
-    public boolean installTemplate(TemplateOnPrimaryDataStoreInfo template) {
-        // TODO Auto-generated method stub
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
index 4b8dd3c..6ec30d3 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
@@ -20,15 +20,12 @@ package org.apache.cloudstack.storage.datastore;
 
 import java.util.List;
 
-import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
 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.engine.subsystem.api.storage.disktype.VolumeDiskType;
 import org.apache.cloudstack.storage.image.TemplateInfo;
-import org.apache.cloudstack.storage.image.TemplateObject;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.volume.VolumeObject;
 
 public interface PrimaryDataStore extends PrimaryDataStoreInfo {
     VolumeInfo getVolume(long id);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
deleted file mode 100644
index c5ed961..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
+++ /dev/null
@@ -1,80 +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.datastore;
-
-import java.util.List;
-
-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.disktype.VolumeDiskType;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-
-public class PrimaryDataStoreInfoImpl implements PrimaryDataStoreInfo {
-    protected List<HypervisorType> supportedHypervs;
-    protected List<VolumeDiskType> supportedDiskTypes;
-    protected long caapcity;
-    protected long avail;
-    protected boolean localStorage;
-
-    public PrimaryDataStoreInfoImpl(List<HypervisorType> hypers, List<VolumeDiskType> diskTypes, long capacity, long avail, boolean localStorage) {
-        this.avail = avail;
-        this.caapcity = capacity;
-        this.localStorage = localStorage;
-        this.supportedDiskTypes = diskTypes;
-        this.supportedHypervs = hypers;
-    }
-
-    @Override
-    public boolean isHypervisorSupported(HypervisorType hypervisor) {
-        return this.supportedHypervs.contains(hypervisor) ? true : false;
-    }
-
-    @Override
-    public boolean isLocalStorageSupported() {
-        return this.localStorage;
-    }
-
-    @Override
-    public boolean isVolumeDiskTypeSupported(VolumeDiskType diskType) {
-        return this.supportedDiskTypes.contains(diskType) ? true : false;
-    }
-
-    @Override
-    public long getCapacity() {
-        return this.caapcity;
-    }
-
-    @Override
-    public long getAvailableCapacity() {
-        return this.avail;
-    }
-
-    @Override
-    public List<EndPoint> getEndPoints() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public long getId() {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
deleted file mode 100644
index 24a5c79..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
+++ /dev/null
@@ -1,116 +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.datastore.db;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface PrimaryDataStoreDao extends GenericDao<PrimaryDataStoreVO, Long> {
-
-    /**
-     * @param datacenterId
-     *            -- the id of the datacenter (availability zone)
-     */
-    List<PrimaryDataStoreVO> listByDataCenterId(long datacenterId);
-
-    /**
-     * @param datacenterId
-     *            -- the id of the datacenter (availability zone)
-     */
-    List<PrimaryDataStoreVO> listBy(long datacenterId, long podId, Long clusterId);
-
-    /**
-     * Set capacity of storage pool in bytes
-     * 
-     * @param id
-     *            pool id.
-     * @param capacity
-     *            capacity in bytes
-     */
-    void updateCapacity(long id, long capacity);
-
-    /**
-     * Set available bytes of storage pool in bytes
-     * 
-     * @param id
-     *            pool id.
-     * @param available
-     *            available capacity in bytes
-     */
-    void updateAvailable(long id, long available);
-
-    PrimaryDataStoreVO persist(PrimaryDataStoreVO pool, Map<String, String> details);
-
-    /**
-     * Find pool by name.
-     * 
-     * @param name
-     *            name of pool.
-     * @return the single StoragePoolVO
-     */
-    List<PrimaryDataStoreVO> findPoolByName(String name);
-
-    /**
-     * Find pools by the pod that matches the details.
-     * 
-     * @param podId
-     *            pod id to find the pools in.
-     * @param details
-     *            details to match. All must match for the pool to be returned.
-     * @return List of StoragePoolVO
-     */
-    List<PrimaryDataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details);
-
-    List<PrimaryDataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
-
-    /**
-     * Find pool by UUID.
-     * 
-     * @param uuid
-     *            uuid of pool.
-     * @return the single StoragePoolVO
-     */
-    PrimaryDataStoreVO findPoolByUUID(String uuid);
-
-    List<PrimaryDataStoreVO> listByStorageHost(String hostFqdnOrIp);
-
-    PrimaryDataStoreVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
-
-    List<PrimaryDataStoreVO> listPoolByHostPath(String host, String path);
-
-    void updateDetails(long poolId, Map<String, String> details);
-
-    Map<String, String> getDetails(long poolId);
-
-    List<String> searchForStoragePoolDetails(long poolId, String value);
-
-    List<PrimaryDataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid);
-
-    List<PrimaryDataStoreVO> listByStatus(DataStoreStatus status);
-
-    long countPoolsByStatus(DataStoreStatus... statuses);
-
-    List<PrimaryDataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status);
-
-    List<PrimaryDataStoreVO> listPoolsByCluster(long clusterId);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
deleted file mode 100644
index 49dad27..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ /dev/null
@@ -1,365 +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.datastore.db;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
-import org.springframework.stereotype.Component;
-
-import com.cloud.storage.StoragePoolDetailVO;
-import com.cloud.storage.dao.StoragePoolDetailsDao;
-import com.cloud.storage.dao.StoragePoolDetailsDaoImpl;
-import com.cloud.utils.component.ComponentInject;
-import com.cloud.utils.component.ComponentLocator;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.GenericSearchBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.SearchCriteria.Func;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class PrimaryDataStoreDaoImpl extends GenericDaoBase<PrimaryDataStoreVO, Long> implements PrimaryDataStoreDao {
-    protected final SearchBuilder<PrimaryDataStoreVO> AllFieldSearch;
-    protected final SearchBuilder<PrimaryDataStoreVO> DcPodSearch;
-    protected final SearchBuilder<PrimaryDataStoreVO> DcPodAnyClusterSearch;
-    protected final SearchBuilder<PrimaryDataStoreVO> DeleteLvmSearch;
-    protected final GenericSearchBuilder<PrimaryDataStoreVO, Long> StatusCountSearch;
-
-    protected final PrimaryDataStoreDetailsDao _detailsDao = null;
-
-    private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and (";
-    private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
-    private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
-
-    public PrimaryDataStoreDaoImpl() {
-        AllFieldSearch = createSearchBuilder();
-        AllFieldSearch.and("name", AllFieldSearch.entity().getName(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("uuid", AllFieldSearch.entity().getUuid(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("datacenterId", AllFieldSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("hostAddress", AllFieldSearch.entity().getHostAddress(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("status", AllFieldSearch.entity().getStatus(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("path", AllFieldSearch.entity().getPath(), SearchCriteria.Op.EQ);
-        AllFieldSearch.and("podId", AllFieldSearch.entity().getPodId(), Op.EQ);
-        AllFieldSearch.and("clusterId", AllFieldSearch.entity().getClusterId(), Op.EQ);
-        AllFieldSearch.done();
-
-        DcPodSearch = createSearchBuilder();
-        DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL);
-        DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
-        DcPodSearch.cp();
-        DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL);
-        DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
-        DcPodSearch.cp();
-        DcPodSearch.done();
-
-        DcPodAnyClusterSearch = createSearchBuilder();
-        DcPodAnyClusterSearch.and("datacenterId", DcPodAnyClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        DcPodAnyClusterSearch.and().op("nullpod", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.NULL);
-        DcPodAnyClusterSearch.or("podId", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.EQ);
-        DcPodAnyClusterSearch.cp();
-        DcPodAnyClusterSearch.done();
-
-        DeleteLvmSearch = createSearchBuilder();
-        DeleteLvmSearch.and("ids", DeleteLvmSearch.entity().getId(), SearchCriteria.Op.IN);
-        DeleteLvmSearch.and().op("LVM", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
-        DeleteLvmSearch.or("Filesystem", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
-        DeleteLvmSearch.cp();
-        DeleteLvmSearch.done();
-
-        StatusCountSearch = createSearchBuilder(Long.class);
-        StatusCountSearch.and("status", StatusCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
-        StatusCountSearch.select(null, Func.COUNT, null);
-        StatusCountSearch.done();
-
-       // _detailsDao = ComponentInject.inject(PrimaryDataStoreDetailsDaoImpl.class);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> findPoolByName(String name) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("name", name);
-        return listIncludingRemovedBy(sc);
-    }
-
-    @Override
-    public PrimaryDataStoreVO findPoolByUUID(String uuid) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("uuid", uuid);
-        return findOneIncludingRemovedBy(sc);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("uuid", uuid);
-        return listBy(sc);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listByDataCenterId(long datacenterId) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("datacenterId", datacenterId);
-        return listBy(sc);
-    }
-
-    @Override
-    public void updateAvailable(long id, long available) {
-        PrimaryDataStoreVO pool = createForUpdate(id);
-        pool.setAvailableBytes(available);
-        update(id, pool);
-    }
-
-    @Override
-    public void updateCapacity(long id, long capacity) {
-        PrimaryDataStoreVO pool = createForUpdate(id);
-        pool.setCapacityBytes(capacity);
-        update(id, pool);
-
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listByStorageHost(String hostFqdnOrIp) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("hostAddress", hostFqdnOrIp);
-        return listIncludingRemovedBy(sc);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listByStatus(DataStoreStatus status) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("status", status);
-        return listBy(sc);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("status", status);
-        sc.setParameters("datacenterId", dcId);
-        return listBy(sc);
-    }
-
-    @Override
-    public PrimaryDataStoreVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("hostAddress", host);
-        sc.setParameters("path", path);
-        sc.setParameters("datacenterId", datacenterId);
-        sc.setParameters("podId", podId);
-        sc.setParameters("uuid", uuid);
-
-        return findOneBy(sc);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listBy(long datacenterId, long podId, Long clusterId) {
-        if (clusterId != null) {
-            SearchCriteria<PrimaryDataStoreVO> sc = DcPodSearch.create();
-            sc.setParameters("datacenterId", datacenterId);
-            sc.setParameters("podId", podId);
-
-            sc.setParameters("cluster", clusterId);
-            return listBy(sc);
-        } else {
-            SearchCriteria<PrimaryDataStoreVO> sc = DcPodAnyClusterSearch.create();
-            sc.setParameters("datacenterId", datacenterId);
-            sc.setParameters("podId", podId);
-            return listBy(sc);
-        }
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listPoolByHostPath(String host, String path) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("hostAddress", host);
-        sc.setParameters("path", path);
-
-        return listBy(sc);
-    }
-
-    public PrimaryDataStoreVO listById(Integer id) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("id", id);
-
-        return findOneIncludingRemovedBy(sc);
-    }
-
-    @Override
-    @DB
-    public PrimaryDataStoreVO persist(PrimaryDataStoreVO pool, Map<String, String> details) {
-        Transaction txn = Transaction.currentTxn();
-        txn.start();
-        pool = super.persist(pool);
-        if (details != null) {
-            for (Map.Entry<String, String> detail : details.entrySet()) {
-                PrimaryDataStoreDetailVO vo = new PrimaryDataStoreDetailVO(pool.getId(), detail.getKey(), detail.getValue());
-                _detailsDao.persist(vo);
-            }
-        }
-        txn.commit();
-        return pool;
-    }
-
-    @DB
-    @Override
-    public List<PrimaryDataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details) {
-        StringBuilder sql = new StringBuilder(DetailsSqlPrefix);
-        if (clusterId != null) {
-            sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND (");
-        }
-        for (Map.Entry<String, String> detail : details.entrySet()) {
-            sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR ");
-        }
-        sql.delete(sql.length() - 4, sql.length());
-        sql.append(DetailsSqlSuffix);
-        Transaction txn = Transaction.currentTxn();
-        PreparedStatement pstmt = null;
-        try {
-            pstmt = txn.prepareAutoCloseStatement(sql.toString());
-            int i = 1;
-            pstmt.setLong(i++, dcId);
-            pstmt.setLong(i++, podId);
-            if (clusterId != null) {
-                pstmt.setLong(i++, clusterId);
-            }
-            pstmt.setInt(i++, details.size());
-            ResultSet rs = pstmt.executeQuery();
-            List<PrimaryDataStoreVO> pools = new ArrayList<PrimaryDataStoreVO>();
-            while (rs.next()) {
-                pools.add(toEntityBean(rs, false));
-            }
-            return pools;
-        } catch (SQLException e) {
-            throw new CloudRuntimeException("Unable to execute " + pstmt, e);
-        }
-    }
-
-    protected Map<String, String> tagsToDetails(String[] tags) {
-        Map<String, String> details = new HashMap<String, String>(tags.length);
-        for (String tag : tags) {
-            details.put(tag, "true");
-        }
-        return details;
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) {
-        List<PrimaryDataStoreVO> storagePools = null;
-        if (tags == null || tags.length == 0) {
-            storagePools = listBy(dcId, podId, clusterId);
-        } else {
-            Map<String, String> details = tagsToDetails(tags);
-            storagePools = findPoolsByDetails(dcId, podId, clusterId, details);
-        }
-
-        if (shared == null) {
-            return storagePools;
-        } else {
-            List<PrimaryDataStoreVO> filteredStoragePools = new ArrayList<PrimaryDataStoreVO>(storagePools);
-            for (PrimaryDataStoreVO pool : storagePools) {
-                /*
-                 * if (shared != pool.isShared()) {
-                 * filteredStoragePools.remove(pool); }
-                 */
-            }
-
-            return filteredStoragePools;
-        }
-    }
-
-    @Override
-    @DB
-    public List<String> searchForStoragePoolDetails(long poolId, String value) {
-
-        StringBuilder sql = new StringBuilder(FindPoolTagDetails);
-
-        Transaction txn = Transaction.currentTxn();
-        PreparedStatement pstmt = null;
-        try {
-            pstmt = txn.prepareAutoCloseStatement(sql.toString());
-            pstmt.setLong(1, poolId);
-            pstmt.setString(2, value);
-
-            ResultSet rs = pstmt.executeQuery();
-            List<String> tags = new ArrayList<String>();
-
-            while (rs.next()) {
-                tags.add(rs.getString("name"));
-            }
-            return tags;
-        } catch (SQLException e) {
-            throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
-        }
-
-    }
-
-    @Override
-    public void updateDetails(long poolId, Map<String, String> details) {
-        if (details != null) {
-            _detailsDao.update(poolId, details);
-        }
-    }
-
-    @Override
-    public Map<String, String> getDetails(long poolId) {
-        return _detailsDao.getDetails(poolId);
-    }
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        super.configure(name, params);
-        _detailsDao.configure("DetailsDao", params);
-        return true;
-    }
-
-    @Override
-    public long countPoolsByStatus(DataStoreStatus... statuses) {
-        SearchCriteria<Long> sc = StatusCountSearch.create();
-
-        sc.setParameters("status", (Object[]) statuses);
-
-        List<Long> rs = customSearchIncludingRemoved(sc, null);
-        if (rs.size() == 0) {
-            return 0;
-        }
-
-        return rs.get(0);
-    }
-
-    @Override
-    public List<PrimaryDataStoreVO> listPoolsByCluster(long clusterId) {
-        SearchCriteria<PrimaryDataStoreVO> sc = AllFieldSearch.create();
-        sc.setParameters("clusterId", clusterId);
-
-        return listBy(sc);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
deleted file mode 100644
index d1f802d..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
+++ /dev/null
@@ -1,79 +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.datastore.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="storage_pool_details")
-public class PrimaryDataStoreDetailVO {
-    @Id
-    @GeneratedValue(strategy=GenerationType.IDENTITY)
-    @Column(name="id")
-    long id;
-    
-    @Column(name="pool_id")
-    long poolId;
-    
-    @Column(name="name")
-    String name;
-    
-    @Column(name="value")
-    String value;
-    
-    public PrimaryDataStoreDetailVO(long poolId, String name, String value) {
-        this.poolId = poolId;
-        this.name = name;
-        this.value = value;
-    }
-   
-    public long getId() {
-        return id;
-    }
-
-    public long getPoolId() {
-        return poolId;
-    }
-
-    public void setPoolId(long poolId) {
-        this.poolId = poolId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    protected PrimaryDataStoreDetailVO() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
deleted file mode 100644
index 906742b..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
+++ /dev/null
@@ -1,28 +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.datastore.db;
-
-import java.util.Map;
-
-import com.cloud.storage.StoragePoolDetailVO;
-import com.cloud.utils.db.GenericDao;
-
-public interface PrimaryDataStoreDetailsDao extends GenericDao<PrimaryDataStoreDetailVO, Long> {
-    
-    void update(long poolId, Map<String, String> details);
-    Map<String, String> getDetails(long poolId);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
deleted file mode 100644
index 59c488c..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
+++ /dev/null
@@ -1,71 +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.datastore.db;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-public class PrimaryDataStoreDetailsDaoImpl extends GenericDaoBase<PrimaryDataStoreDetailVO, Long> implements PrimaryDataStoreDetailsDao {
-    
-    protected final SearchBuilder<PrimaryDataStoreDetailVO> PoolSearch = null;
-    
-    protected PrimaryDataStoreDetailsDaoImpl() {
-        /*
-        super();
-        PoolSearch = createSearchBuilder();
-        PoolSearch.and("pool", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
-        PoolSearch.done();
-        */
-    }
-    
-    @Override
-    public void update(long poolId, Map<String, String> details) {
-        Transaction txn = Transaction.currentTxn();
-        SearchCriteria<PrimaryDataStoreDetailVO> sc = PoolSearch.create();
-        sc.setParameters("pool", poolId);
-        
-        txn.start();
-        expunge(sc);
-        for (Map.Entry<String, String> entry : details.entrySet()) {
-            PrimaryDataStoreDetailVO detail = new PrimaryDataStoreDetailVO(poolId, entry.getKey(), entry.getValue());
-            persist(detail);
-        }
-        txn.commit();
-    }
-    
-    @Override
-    public Map<String, String> getDetails(long poolId) {
-    	SearchCriteria<PrimaryDataStoreDetailVO> sc = PoolSearch.create();
-    	sc.setParameters("pool", poolId);
-    	
-    	List<PrimaryDataStoreDetailVO> details = listBy(sc);
-    	Map<String, String> detailsMap = new HashMap<String, String>();
-    	for (PrimaryDataStoreDetailVO detail : details) {
-    		detailsMap.put(detail.getName(), detail.getValue());
-    	}
-    	
-    	return detailsMap;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
deleted file mode 100644
index ebba01c..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
+++ /dev/null
@@ -1,25 +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.datastore.db;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface PrimaryDataStoreProviderDao extends GenericDao<PrimaryDataStoreProviderVO, Long> {
-    public PrimaryDataStoreProviderVO findByName(String name);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
deleted file mode 100644
index 0050c2f..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
+++ /dev/null
@@ -1,38 +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.datastore.db;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-class PrimaryDataStoreProviderDaoImpl extends GenericDaoBase<PrimaryDataStoreProviderVO, Long> implements PrimaryDataStoreProviderDao {
-
-    @Override
-    public PrimaryDataStoreProviderVO findByName(String name) {
-        SearchCriteriaService<PrimaryDataStoreProviderVO, PrimaryDataStoreProviderVO> sc = SearchCriteria2.create(PrimaryDataStoreProviderVO.class);
-        sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
-        return sc.find();
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
deleted file mode 100644
index 7e31d9c..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
+++ /dev/null
@@ -1,49 +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.datastore.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-@Entity
-@Table(name = "primary_data_store_provider")
-public class PrimaryDataStoreProviderVO {
-    @Id
-    @TableGenerator(name = "data_store_provider_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "data_store_provider_seq", allocationSize = 1)
-    @Column(name = "id", updatable = false, nullable = false)
-    private long id;
-
-    @Column(name = "name", nullable = false)
-    private String name;
-    
-    public long getId() {
-        return id;
-    }
-    
-    public String getName() {
-        return this.name;
-    }
-    
-    public void setName(String name) {
-        this.name = name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java
deleted file mode 100644
index 6c05d10..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java
+++ /dev/null
@@ -1,256 +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.datastore.db;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
-
-import com.cloud.api.Identity;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name = "storage_pool")
-public class PrimaryDataStoreVO implements Identity {
-    @Id
-    @TableGenerator(name = "storage_pool_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "storage_pool_seq", allocationSize = 1)
-    @Column(name = "id", updatable = false, nullable = false)
-    private long id;
-
-    @Column(name = "name", updatable = false, nullable = false, length = 255)
-    private String name = null;
-
-    @Column(name = "uuid", length = 255)
-    private String uuid = null;
-
-    @Column(name = "pool_type", updatable = false, nullable = false, length = 32)
-    private String protocol;
-
-    @Column(name = GenericDao.CREATED_COLUMN)
-    Date created;
-
-    @Column(name = GenericDao.REMOVED_COLUMN)
-    private Date removed;
-
-    @Column(name = "update_time", updatable = true)
-    @Temporal(value = TemporalType.TIMESTAMP)
-    private Date updateTime;
-
-    @Column(name = "data_center_id", updatable = true, nullable = false)
-    private long dataCenterId;
-
-    @Column(name = "pod_id", updatable = true)
-    private Long podId;
-
-    @Column(name = "available_bytes", updatable = true, nullable = true)
-    private long availableBytes;
-
-    @Column(name = "capacity_bytes", updatable = true, nullable = true)
-    private long capacityBytes;
-
-    @Column(name = "status", updatable = true, nullable = false)
-    @Enumerated(value = EnumType.STRING)
-    private DataStoreStatus status;
-
-    @Column(name = "storage_provider_id", updatable = true, nullable = false)
-    private Long storageProviderId;
-
-    @Column(name = "host_address")
-    private String hostAddress;
-
-    @Column(name = "path")
-    private String path;
-
-    @Column(name = "port")
-    private int port;
-
-    @Column(name = "user_info")
-    private String userInfo;
-
-    @Column(name = "cluster_id")
-    private Long clusterId;
-
-    public long getId() {
-        return id;
-    }
-
-    public DataStoreStatus getStatus() {
-        return status;
-    }
-
-    public PrimaryDataStoreVO() {
-        // TODO Auto-generated constructor stub
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getUuid() {
-        return uuid;
-    }
-
-    public String getPoolType() {
-        return protocol;
-    }
-    
-    public void setPoolType(String protocol) {
-        this.protocol = protocol;
-    }
-
-    public Date getCreated() {
-        return created;
-    }
-
-    public Date getRemoved() {
-        return removed;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public long getDataCenterId() {
-        return dataCenterId;
-    }
-
-    public long getAvailableBytes() {
-        return availableBytes;
-    }
-
-    public Long getStorageProviderId() {
-        return storageProviderId;
-    }
-
-    public void setStorageProviderId(Long provider) {
-        storageProviderId = provider;
-    }
-
-    public long getCapacityBytes() {
-        return capacityBytes;
-    }
-
-    public void setAvailableBytes(long available) {
-        availableBytes = available;
-    }
-
-    public void setCapacityBytes(long capacity) {
-        capacityBytes = capacity;
-    }
-
-    public Long getClusterId() {
-        return clusterId;
-    }
-
-    public void setClusterId(Long clusterId) {
-        this.clusterId = clusterId;
-    }
-
-    public String getHostAddress() {
-        return hostAddress;
-    }
-    
-    public void setHostAddress(String host) {
-        this.hostAddress = host;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public String getUserInfo() {
-        return userInfo;
-    }
-
-    public void setStatus(DataStoreStatus status) {
-        this.status = status;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public void setDataCenterId(long dcId) {
-        this.dataCenterId = dcId;
-    }
-
-    public void setPodId(Long podId) {
-        this.podId = podId;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    public void setUserInfo(String userInfo) {
-        this.userInfo = userInfo;
-    }
-
-    public int getPort() {
-        return port;
-    }
-    
-    public void setPort(int port) {
-        this.port = port;
-    }
-
-    public Long getPodId() {
-        return podId;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof PrimaryDataStoreVO) || obj == null) {
-            return false;
-        }
-        PrimaryDataStoreVO that = (PrimaryDataStoreVO) obj;
-        return this.id == that.id;
-    }
-
-    @Override
-    public int hashCode() {
-        return new Long(id).hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder("Pool[").append(id).append("|").append(protocol).append("]").toString();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
deleted file mode 100644
index c3ecb6e..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.apache.cloudstack.storage.datastore.driver;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.storage.command.CreateVolumeAnswer;
-import org.apache.cloudstack.storage.command.CreateVolumeCommand;
-import org.apache.cloudstack.storage.command.CreateVolumeFromBaseImageCommand;
-import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
-import org.apache.cloudstack.storage.to.VolumeTO;
-import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
-import org.apache.cloudstack.storage.volume.VolumeObject;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver {
-    private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreDriverImpl.class);
-
-    @Override
-    public boolean createVolume(VolumeObject vol) {
-        // The default driver will send createvolume command to one of hosts
-        // which can access its datastore
-        List<EndPoint> endPoints = vol.getDataStore().getEndPoints();
-        int retries = 3;
-        VolumeInfo volInfo = vol;
-        CreateVolumeCommand createCmd = new CreateVolumeCommand(new VolumeTO(volInfo));
-        Answer answer = null;
-        int i = 0;
-        boolean result = false;
-
-        for (EndPoint ep : endPoints) {
-            answer = ep.sendMessage(createCmd);
-            if (answer == null) {
-                if (i < retries) {
-                    s_logger.debug("create volume failed, retrying: " + i);
-                }
-                i++;
-            } else {
-                CreateVolumeAnswer volAnswer = (CreateVolumeAnswer) answer;
-                vol.setPath(volAnswer.getVolumeUuid());
-                result = true;
-            }
-        }
-
-        return result;
-    }
-
-    @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;
-    }
-
-    protected Answer sendOutCommand(Command cmd, List<EndPoint> endPoints) {
-        Answer answer = null;
-        int retries = 3;
-        int i = 0;
-        for (EndPoint ep : endPoints) {
-            answer = ep.sendMessage(cmd);
-            if (answer == null || answer.getDetails() != null) {
-                if (i < retries) {
-                    s_logger.debug("create volume failed, retrying: " + i);
-                }
-                i++;
-            } else {
-                break;
-            }
-        }
-        return answer;
-    }
-
-    @Override
-    public boolean createVolumeFromBaseImage(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template) {
-        VolumeTO vol = new VolumeTO(volume);
-        ImageOnPrimayDataStoreTO image = new ImageOnPrimayDataStoreTO(template);
-        CreateVolumeFromBaseImageCommand cmd = new CreateVolumeFromBaseImageCommand(vol, image);
-        List<EndPoint> endPoints = template.getPrimaryDataStore().getEndPoints();
-
-        Answer answer = sendOutCommand(cmd, endPoints);
-
-        if (answer == null || answer.getDetails() != null) {
-            if (answer == null) {
-                throw new CloudRuntimeException("Failed to created volume");
-            } else {
-                throw new CloudRuntimeException(answer.getDetails());
-            }
-        } else {
-            CreateVolumeAnswer volAnswer = (CreateVolumeAnswer) answer;
-            volume.setPath(volAnswer.getVolumeUuid());
-            return true;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
deleted file mode 100644
index e3ff0b7..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
+++ /dev/null
@@ -1,17 +0,0 @@
-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 interface PrimaryDataStoreDriver {
-    boolean createVolume(VolumeObject vol);
-
-    boolean createVolumeFromBaseImage(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template);
-
-    boolean deleteVolume(VolumeObject vo);
-
-    String grantAccess(VolumeObject vol, EndPoint ep);
-
-    boolean revokeAccess(VolumeObject vol, EndPoint ep);
-}