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:39 UTC

[4/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/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
deleted file mode 100644
index e6508e6..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeManagerImpl.java
+++ /dev/null
@@ -1,103 +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.volume;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-import org.apache.cloudstack.storage.volume.db.VolumeDao;
-import org.apache.cloudstack.storage.volume.db.VolumeVO;
-import org.springframework.stereotype.Component;
-
-import com.cloud.storage.Volume;
-import com.cloud.storage.Volume.Event;
-import com.cloud.storage.Volume.State;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.fsm.NoTransitionException;
-import com.cloud.utils.fsm.StateMachine2;
-
-@Component
-public class VolumeManagerImpl implements VolumeManager {
-    @Inject
-    protected VolumeDao _volumeDao;
-    private final static StateMachine2<State, Event, VolumeVO> s_fsm = new StateMachine2<State, Event, VolumeVO>();
-    public VolumeManagerImpl() {
-        initStateMachine();
-    }
-
-    public VolumeVO allocateDuplicateVolume(VolumeVO oldVol) {
-        /*
-        VolumeVO newVol = new VolumeVO(oldVol.getVolumeType(), oldVol.getName(), oldVol.getDataCenterId(), oldVol.getDomainId(), oldVol.getAccountId(), oldVol.getDiskOfferingId(), oldVol.getSize());
-        newVol.setTemplateId(oldVol.getTemplateId());
-        newVol.setDeviceId(oldVol.getDeviceId());
-        newVol.setInstanceId(oldVol.getInstanceId());
-        newVol.setRecreatable(oldVol.isRecreatable());
-        newVol.setReservationId(oldVol.getReservationId());
-        */
-        return null;
-        // return _volumeDao.persist(newVol);
-    }
-    
-    private void initStateMachine() {
-            s_fsm.addTransition(Volume.State.Allocated, Event.CreateRequested, Volume.State.Creating);
-            s_fsm.addTransition(Volume.State.Allocated, Event.DestroyRequested, Volume.State.Destroy);
-            s_fsm.addTransition(Volume.State.Creating, Event.OperationRetry, Volume.State.Creating);
-            s_fsm.addTransition(Volume.State.Creating, Event.OperationFailed, Volume.State.Allocated);
-            s_fsm.addTransition(Volume.State.Creating, Event.OperationSucceeded, Volume.State.Ready);
-            s_fsm.addTransition(Volume.State.Creating, Event.DestroyRequested, Volume.State.Destroy);
-            s_fsm.addTransition(Volume.State.Creating, Event.CreateRequested, Volume.State.Creating);            
-            s_fsm.addTransition(Volume.State.Allocated, Event.UploadRequested, Volume.State.UploadOp);
-            s_fsm.addTransition(Volume.State.UploadOp, Event.CopyRequested, Volume.State.Creating);// CopyRequested for volume from sec to primary storage            
-            s_fsm.addTransition(Volume.State.Creating, Event.CopySucceeded, Volume.State.Ready);
-            s_fsm.addTransition(Volume.State.Creating, Event.CopyFailed, Volume.State.UploadOp);// Copying volume from sec to primary failed.  
-            s_fsm.addTransition(Volume.State.UploadOp, Event.DestroyRequested, Volume.State.Destroy);
-            s_fsm.addTransition(Volume.State.Ready, Event.DestroyRequested, Volume.State.Destroy);
-            s_fsm.addTransition(Volume.State.Destroy, Event.ExpungingRequested, Volume.State.Expunging);
-            s_fsm.addTransition(Volume.State.Ready, Event.SnapshotRequested, Volume.State.Snapshotting);
-            s_fsm.addTransition(Volume.State.Snapshotting, Event.OperationSucceeded, Volume.State.Ready);
-            s_fsm.addTransition(Volume.State.Snapshotting, Event.OperationFailed, Volume.State.Ready);
-            s_fsm.addTransition(Volume.State.Ready, Event.MigrationRequested, Volume.State.Migrating);
-            s_fsm.addTransition(Volume.State.Migrating, Event.OperationSucceeded, Volume.State.Ready);
-            s_fsm.addTransition(Volume.State.Migrating, Event.OperationFailed, Volume.State.Ready);
-            s_fsm.addTransition(Volume.State.Destroy, Event.OperationSucceeded, Volume.State.Destroy);
-    }
-    
-    @Override
-    public StateMachine2<State, Event, VolumeVO> getStateMachine() {
-        return s_fsm;
-    }
-
-    public VolumeVO processEvent(Volume vol, Volume.Event event) throws NoTransitionException {
-        // _volStateMachine.transitTo(vol, event, null, _volumeDao);
-        return _volumeDao.findById(vol.getId());
-    }
-
-    public VolumeProfile getProfile(long volumeId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public VolumeVO getVolume(long volumeId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public VolumeVO updateVolume(VolumeVO volume) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java
deleted file mode 100644
index 9349e6b..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeMotionService.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.volume;
-
-public interface VolumeMotionService {
-    boolean copyVolume(String volumeUri, String destVolumeUri);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
deleted file mode 100644
index f0eb1b5..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.apache.cloudstack.storage.volume;
-
-import java.util.Date;
-
-import javax.inject.Inject;
-
-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.engine.subsystem.api.storage.disktype.VolumeDiskTypeHelper;
-import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
-import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeTypeHelper;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.volume.db.VolumeDao;
-import org.apache.cloudstack.storage.volume.db.VolumeVO;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.storage.Volume;
-import com.cloud.storage.Volume.State;
-import com.cloud.utils.component.ComponentInject;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.fsm.NoTransitionException;
-import com.cloud.utils.fsm.StateMachine2;
-
-public class VolumeObject implements VolumeInfo {
-    private static final Logger s_logger = Logger.getLogger(VolumeObject.class);
-    protected VolumeVO volumeVO;
-    private StateMachine2<Volume.State, Volume.Event, VolumeVO> _volStateMachine;
-    protected PrimaryDataStore dataStore;
-    @Inject
-    VolumeDiskTypeHelper diskTypeHelper;
-    @Inject
-    VolumeTypeHelper volumeTypeHelper;
-    @Inject
-    VolumeDao volumeDao;
-    @Inject
-    VolumeManager volumeMgr;
-    private VolumeObject(PrimaryDataStore dataStore, VolumeVO volumeVO) {
-        this.volumeVO = volumeVO;
-        this.dataStore = dataStore;
-    }
-    
-    public static VolumeObject getVolumeObject(PrimaryDataStore dataStore, VolumeVO volumeVO) {
-        VolumeObject vo = new VolumeObject(dataStore, volumeVO);
-        vo = ComponentInject.inject(vo);
-        return vo;
-    }
-
-    public String getUuid() {
-        return volumeVO.getUuid();
-    }
-
-    public void setPath(String uuid) {
-        volumeVO.setUuid(uuid);
-    }
-
-    public String getPath() {
-        return volumeVO.getPath();
-    }
-
-    public String getTemplateUuid() {
-        return null;
-    }
-
-    public String getTemplatePath() {
-        return null;
-    }
-
-    public PrimaryDataStoreInfo getDataStoreInfo() {
-        return dataStore.getDataStoreInfo();
-    }
-
-    public Volume.State getState() {
-        return volumeVO.getState();
-    }
-
-    public PrimaryDataStore getDataStore() {
-        return dataStore;
-    }
-
-    public long getSize() {
-        return volumeVO.getSize();
-    }
-
-    public VolumeDiskType getDiskType() {
-        return diskTypeHelper.getDiskType(volumeVO.getDiskType());
-    }
-
-    public VolumeType getType() {
-        return volumeTypeHelper.getType(volumeVO.getVolumeType());
-    }
-
-    public long getVolumeId() {
-        return volumeVO.getId();
-    }
-
-    public void setVolumeDiskType(VolumeDiskType type) {
-        volumeVO.setDiskType(type.toString());
-    }
-
-    public boolean stateTransit(Volume.Event event) {
-        boolean result = false;
-        _volStateMachine = volumeMgr.getStateMachine();
-        try {
-            result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao);
-        } catch (NoTransitionException e) {
-            String errorMessage = "Failed to transit volume: " + this.getVolumeId() + ", due to: " + e.toString();
-            s_logger.debug(errorMessage);
-            throw new CloudRuntimeException(errorMessage);
-        }
-        return result;
-    }
-
-    public void update() {
-        volumeDao.update(volumeVO.getId(), volumeVO);
-        volumeVO = volumeDao.findById(volumeVO.getId());
-    }
-
-    @Override
-    public long getId() {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public State getCurrentState() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public State getDesiredState() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Date getCreatedData() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
deleted file mode 100644
index 0e6ed9f..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ /dev/null
@@ -1,187 +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.volume;
-
-import javax.inject.Inject;
-
-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.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
-import org.apache.cloudstack.engine.subsystem.api.storage.type.BaseImage;
-import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreManager;
-import org.apache.cloudstack.storage.image.TemplateEntityImpl;
-import org.apache.cloudstack.storage.image.TemplateInfo;
-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.Service;
-
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-import com.cloud.storage.Volume;
-import com.cloud.utils.db.DB;
-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
-public class VolumeServiceImpl implements VolumeService {
-    @Inject
-    VolumeDao volDao;
-    @Inject
-    PrimaryDataStoreManager dataStoreMgr;
-    @Inject
-    TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
-    @Inject
-    ImageMotionService imageMotion;
-
-    @Override
-    public VolumeInfo createVolume(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType) {
-        PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(dataStoreId);
-        if (dataStore == null) {
-            throw new CloudRuntimeException("Can't find dataStoreId: " + dataStoreId);
-        }
-
-        if (dataStore.exists(volume)) {
-            return volume;
-        }
-
-        VolumeObject vo = (VolumeObject) volume;
-        vo.stateTransit(Volume.Event.CreateRequested);
-
-        try {
-            VolumeInfo vi = dataStore.createVolume(vo, diskType);
-            vo.stateTransit(Volume.Event.OperationSucceeded);
-            return vi;
-        } catch (Exception e) {
-            vo.stateTransit(Volume.Event.OperationFailed);
-            throw new CloudRuntimeException(e.toString());
-        }
-    }
-
-    @DB
-    @Override
-    public boolean deleteVolume(long volumeId) {
-        return true;
-    }
-
-    @Override
-    public boolean cloneVolume(long volumeId, long baseVolId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean createVolumeFromSnapshot(long volumeId, long snapshotId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean rokeAccess(long volumeId, long endpointId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId) {
-        VolumeVO vo = volDao.allocVolume(size, type, volName, templateId);
-        return new VolumeEntityImpl(VolumeObject.getVolumeObject(null, vo), this);
-    }
-
-    @Override
-    public VolumeEntity getVolumeEntity(long volumeId) {
-        VolumeVO vo = volDao.findById(volumeId);
-        if (vo == null) {
-            return null;
-        }
-
-        if (vo.getPoolId() == null) {
-            return new VolumeEntityImpl(VolumeObject.getVolumeObject(null, vo), this);
-        } else {
-            PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(vo.getPoolId());
-            return new VolumeEntityImpl(dataStore.getVolume(volumeId), this);
-        }
-    }
-
-    @Override
-    public String grantAccess(VolumeInfo volume, EndPoint endpointId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    protected TemplateOnPrimaryDataStoreObject createBaseImage(PrimaryDataStore dataStore, TemplateInfo template) {
-        TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = (TemplateOnPrimaryDataStoreObject) templatePrimaryStoreMgr.createTemplateOnPrimaryDataStore(template, dataStore);
-        templateOnPrimaryStoreObj.updateStatus(Status.CREATING);
-        try {
-            dataStore.installTemplate(templateOnPrimaryStoreObj);
-            templateOnPrimaryStoreObj.updateStatus(Status.CREATED);
-        } catch (Exception e) {
-            templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
-            throw new CloudRuntimeException(e.toString());
-        }
-
-        templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOAD_IN_PROGRESS);
-        try {
-            imageMotion.copyTemplate(templateOnPrimaryStoreObj);
-            templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOADED);
-        } catch (Exception e) {
-            templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
-            throw new CloudRuntimeException(e.toString());
-        }
-
-        return templateOnPrimaryStoreObj;
-    }
-
-    @Override
-    public VolumeInfo createVolumeFromTemplate(VolumeInfo volume, long dataStoreId, VolumeDiskType diskType, TemplateInfo template) {
-        PrimaryDataStore pd = dataStoreMgr.getPrimaryDataStore(dataStoreId);
-        TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore = pd.getTemplate(template);
-        if (templateOnPrimaryStore == null) {
-            templateOnPrimaryStore = createBaseImage(pd, template);
-        }
-
-        VolumeObject vo = (VolumeObject) volume;
-        try {
-            vo.stateTransit(Volume.Event.CreateRequested);
-        } catch (Exception e) {
-            throw new CloudRuntimeException(e.toString());
-        }
-
-        try {
-            volume = pd.createVoluemFromBaseImage(volume, templateOnPrimaryStore);
-            vo.stateTransit(Volume.Event.OperationSucceeded);
-        } catch (Exception e) {
-            vo.stateTransit(Volume.Event.OperationFailed);
-            throw new CloudRuntimeException(e.toString());
-        }
-        return volume;
-    }
-
-    @Override
-    public TemplateOnPrimaryDataStoreInfo grantAccess(TemplateOnPrimaryDataStoreInfo template, EndPoint endPoint) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/AllTests.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/AllTests.java b/engine/storage/test/org/apache/cloudstack/storage/test/AllTests.java
deleted file mode 100644
index dde4484..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/AllTests.java
+++ /dev/null
@@ -1,29 +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.test;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ volumeServiceTest.class })
-public class AllTests {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/AopTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/AopTest.java b/engine/storage/test/org/apache/cloudstack/storage/test/AopTest.java
deleted file mode 100644
index 0c2a2ad..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/AopTest.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.cloudstack.storage.test;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Target({TYPE, METHOD})
-@Retention(RUNTIME)
-public @interface AopTest {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/AopTestAdvice.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/AopTestAdvice.java b/engine/storage/test/org/apache/cloudstack/storage/test/AopTestAdvice.java
deleted file mode 100644
index ba356e3..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/AopTestAdvice.java
+++ /dev/null
@@ -1,18 +0,0 @@
-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/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java b/engine/storage/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
deleted file mode 100644
index 51679ba..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.apache.cloudstack.storage.test;
-
-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 new DirectAgentManagerImpl();
-	}
-/*	@Override
-	@Bean
-	public PrimaryDataStoreDao primaryDataStoreDao() {
-		return Mockito.mock(PrimaryDataStoreDaoImpl.class);
-	}*/
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java b/engine/storage/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java
deleted file mode 100644
index 1345410..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java
+++ /dev/null
@@ -1,193 +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.test;
-
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.Listener;
-import com.cloud.agent.StartupCommandProcessor;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.manager.AgentAttache;
-import com.cloud.agent.manager.Commands;
-import com.cloud.exception.AgentUnavailableException;
-import com.cloud.exception.ConnectionException;
-import com.cloud.exception.OperationTimedoutException;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status.Event;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.resource.ServerResource;
-
-public class DirectAgentManagerImpl implements AgentManager {
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean start() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean stop() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public String getName() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer easySend(Long hostId, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer send(Long hostId, Command cmd) throws AgentUnavailableException, OperationTimedoutException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer[] send(Long hostId, Commands cmds) throws AgentUnavailableException, OperationTimedoutException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer[] send(Long hostId, Commands cmds, int timeout) throws AgentUnavailableException, OperationTimedoutException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public long send(Long hostId, Commands cmds, Listener listener) throws AgentUnavailableException {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public int registerForInitialConnects(StartupCommandProcessor creator, boolean priority) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public void unregisterForHostEvents(int id) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) throws AgentUnavailableException {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public Answer sendToSecStorage(HostVO ssHost, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean agentStatusTransitTo(HostVO host, Event e, long msId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public AgentAttache findAttache(long hostId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public void disconnectWithoutInvestigation(long hostId, Event event) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void pullAgentToMaintenance(long hostId) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void pullAgentOutMaintenance(long hostId) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public boolean reconnect(long hostId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Answer sendToSSVM(Long dcId, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/Future2.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/Future2.java b/engine/storage/test/org/apache/cloudstack/storage/test/Future2.java
deleted file mode 100644
index bc2fd7a..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/Future2.java
+++ /dev/null
@@ -1,114 +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.test;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-
-public class Future2<T> {
-	
-	private Callable<T> callable;
-	private Callable<T> success;
-	private Callable<T> failed;
-	private ExecutorService executor = Executors.newFixedThreadPool(2);
-	private Future<T> f;
-	
-	public  class Func<T> implements Callable<T> {
-		private Callable<T> f;
-		private Callable<T> fs;
-		public T func() throws Exception {
-			return f.call();
-		}
-		
-		public T success() throws Exception {
-			return fs.call();
-		}
-		
-		public Func (Callable<T> f, Callable<T> s) {
-			this.f = f;
-			this.fs = s;
-		}
-		
-		
-		@Override
-		public T call() throws Exception {
-			func();
-			success();
-			return null;
-		}
-		
-	}
-	public Future2 (Callable<T> callable) {
-		this.callable = callable;
-	}
-	
-	public void onSuccess(Callable<T> s) {
-		this.success = s;
-	}
-	
-	public void go() {
-		Func<T> ft = new Func<T>(this.callable, this.success);
-		f = executor.submit(ft);
-	}
-	
-	public T get() {
-		try {
-			return this.f.get();
-		} catch (InterruptedException e) {
-			return null;
-		} catch (ExecutionException e) {
-			// TODO Auto-generated catch block
-			return null;
-		}
-	}
-	
-	public void shutdown() {
-		this.executor.shutdown();
-	}
-	
-	public static void main(String[] args) {
-		Callable<String> fun = new Callable<String> () {
-
-			@Override
-			public String call() throws Exception {
-				System.out.println("execing");
-				return "test";
-			}
-			
-		};
-		Future2<String> f2 = new Future2<String>(fun);
-		f2.onSuccess(new Callable<String>() {
-
-			@Override
-			public String call() throws Exception {
-				Thread.sleep(1000);
-				System.out.println("success");
-				return null;
-			}
-		});
-		
-		 f2.go();
-		//f2.get();
-		f2.shutdown();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/SimpleTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/SimpleTest.java b/engine/storage/test/org/apache/cloudstack/storage/test/SimpleTest.java
deleted file mode 100644
index a9b3f93..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/SimpleTest.java
+++ /dev/null
@@ -1,41 +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.test;
-
-import static org.junit.Assert.*;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.junit.Test;
-
-public class SimpleTest {
-
-	@Test
-	public void test() {
-		try {
-			URI u = new URI("http://myproxy.domain.com:3128");
-			System.out.print(u.getHost());
-		} catch (URISyntaxException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-}

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

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/225ad3c2/engine/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java b/engine/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
deleted file mode 100644
index c6eafa5..0000000
--- a/engine/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
+++ /dev/null
@@ -1,294 +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.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) {
-			
-		} catch (OperationTimedoutException e) {
-			
-		}
-		//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/test/resource/storageContext.xml
----------------------------------------------------------------------
diff --git a/engine/storage/test/resource/storageContext.xml b/engine/storage/test/resource/storageContext.xml
deleted file mode 100644
index 86811c3..0000000
--- a/engine/storage/test/resource/storageContext.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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/volume/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/volume/pom.xml b/engine/storage/volume/pom.xml
new file mode 100644
index 0000000..a5db9e8
--- /dev/null
+++ b/engine/storage/volume/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-volume</artifactId>
+  <name>Apache CloudStack Engine Storage Volume 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/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
new file mode 100644
index 0000000..5c61da0
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
@@ -0,0 +1,23 @@
+/*
+ * 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/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
new file mode 100644
index 0000000..4d94d25
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
@@ -0,0 +1,171 @@
+package org.apache.cloudstack.storage.datastore;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+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.volume.TemplateOnPrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.volume.TemplatePrimaryDataStoreManager;
+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.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.utils.component.ComponentInject;
+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/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
new file mode 100644
index 0000000..c5ed961
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
new file mode 100644
index 0000000..24a5c79
--- /dev/null
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
@@ -0,0 +1,116 @@
+/*
+ * 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