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/10/30 01:46:26 UTC

git commit: add more files

Updated Branches:
  refs/heads/javelin d70154609 -> f36b2f997


add more files


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

Branch: refs/heads/javelin
Commit: f36b2f99706e92db6aeda5cea7e87a895631fe53
Parents: d701546
Author: Edison Su <su...@gmail.com>
Authored: Mon Oct 29 17:45:54 2012 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Mon Oct 29 17:46:15 2012 -0700

----------------------------------------------------------------------
 .../datastore/DefaultPrimaryDataStoreImpl.java     |   18 ++--
 .../storage/datastore/PrimaryDataStore.java        |    1 -
 .../storage/datastore/PrimaryDataStoreInfo.java    |   31 +++++++
 .../datastore/PrimaryDataStoreInfoImpl.java        |   68 ++++++++++++++
 .../datastore/db/PrimaryDataStoreDaoImpl.java      |    2 +
 .../datastore/db/PrimaryDataStoreProviderDao.java  |   25 +++++
 .../db/PrimaryDataStoreProviderDaoImpl.java        |   28 ++++++
 .../datastore/db/PrimaryDataStoreProviderVO.java   |   23 +++++
 .../DefaultPrimaryDataStoreLifeCycleImpl.java      |   70 +++++++++++++++
 .../lifecycle/PrimaryDataStoreLifeCycle.java       |   31 +++++++
 .../DefaultPrimaryDataStoreManagerImpl.java        |   44 +++++++++
 .../datastore/manager/PrimaryDataStoreManager.java |   27 ++++++
 .../DefaultPrimaryDatastoreProviderImpl.java       |   30 ++++++-
 .../provider/PrimaryDataStoreProvider.java         |    4 +-
 .../cloudstack/storage/test/volumeServiceTest.java |    7 ++-
 .../com/cloud/utils/component/ComponentInject.java |    7 ++
 16 files changed, 401 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
index 54f535b..ae2d620 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java
@@ -4,6 +4,7 @@ import java.util.List;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
 import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
 import org.apache.cloudstack.storage.volume.Volume;
 import org.apache.cloudstack.storage.volume.db.VolumeDao;
@@ -12,12 +13,14 @@ import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
 
 public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
 	protected PrimaryDataStoreDriver driver;
-	protected List<VolumeDiskType> supportedDiskTypes;
+	protected DataStoreVO pdsv;
+	protected PrimaryDataStoreInfo pdsInfo;
 	@Inject
-	VolumeDao volumeDao;
-	public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, List<VolumeDiskType> types) {
+	public VolumeDao volumeDao;
+	public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, DataStoreVO pdsv, PrimaryDataStoreInfo pdsInfo) {
 		this.driver = driver;
-		this.supportedDiskTypes = types;
+		this.pdsv = pdsv;
+		this.pdsInfo = pdsInfo;
 	}
 	
 	@Override
@@ -46,7 +49,7 @@ public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
 			return null;
 		}
 		
-		if (!this.getSupportedDiskTypes().contains(diskType)) {
+		if (!pdsInfo.isVolumeDiskTypeSupported(diskType)) {
 			return null;
 		}
 		
@@ -55,9 +58,4 @@ public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
 		vol.update();
 		return vol;
 	}
-
-	@Override
-	public List<VolumeDiskType> getSupportedDiskTypes() {
-		return this.supportedDiskTypes;
-	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
index e7ff49a..3e06156 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
@@ -28,5 +28,4 @@ public interface PrimaryDataStore {
 	List<Volume> getVolumes();
 	boolean deleteVolume(long id);
 	Volume createVolume(long id, VolumeDiskType diskType);
-	List<VolumeDiskType> getSupportedDiskTypes();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfo.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfo.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfo.java
new file mode 100644
index 0000000..d30a5c8
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfo.java
@@ -0,0 +1,31 @@
+/*
+ * 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 org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+
+public interface PrimaryDataStoreInfo {
+	public boolean isHypervisorSupported(HypervisorType hypervisor);
+	public boolean isLocalStorageSupported();
+	public boolean isVolumeDiskTypeSupported(VolumeDiskType diskType);
+	public long getCapacity();
+	public long getAvailableCapacity();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
new file mode 100644
index 0000000..c453d33
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.storage.datastore.db.DataStoreVO;
+import org.apache.cloudstack.storage.volume.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;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index 28744ab..4429499 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -29,6 +29,7 @@ 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;
@@ -44,6 +45,7 @@ import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.exception.CloudRuntimeException;
 
+@Component
 public class PrimaryDataStoreDaoImpl extends GenericDaoBase<DataStoreVO, Long>  implements PrimaryDataStoreDao {
     protected final SearchBuilder<DataStoreVO> AllFieldSearch;
 	protected final SearchBuilder<DataStoreVO> DcPodSearch;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
new file mode 100644
index 0000000..cebcacf
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
@@ -0,0 +1,25 @@
+/*
+ * 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> {
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
new file mode 100644
index 0000000..bd0571d
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+@Component
+class PrimaryDataStoreProviderDaoImpl extends GenericDaoBase<PrimaryDataStoreProviderVO, Long> implements PrimaryDataStoreProviderDao {
+	
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
new file mode 100644
index 0000000..0ec6bf0
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.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.db;
+
+public class PrimaryDataStoreProviderVO {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
new file mode 100644
index 0000000..fe4562c
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.lifecycle;
+
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class DefaultPrimaryDataStoreLifeCycleImpl implements PrimaryDataStoreLifeCycle {
+
+	@Override
+	public boolean registerDataStore(Map<String, String> dsInfos) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean attach(long scope) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean dettach(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean unmanaged(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean maintain(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean cancelMaintain(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean deleteDataStore(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
new file mode 100644
index 0000000..2e41a62
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
@@ -0,0 +1,31 @@
+/*
+ * 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.lifecycle;
+
+import java.util.Map;
+
+public interface PrimaryDataStoreLifeCycle {
+	public boolean registerDataStore(Map<String, String> dsInfos);
+	public boolean attach(long scope);
+	public boolean dettach(long dataStoreId);
+	public boolean unmanaged(long dataStoreId);
+	public boolean maintain(long dataStoreId);
+	public boolean cancelMaintain(long dataStoreId);
+	public boolean deleteDataStore(long dataStoreId);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
new file mode 100644
index 0000000..dfa4663
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.manager;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreProviderDao;
+import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DefaultPrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
+	@Inject
+	PrimaryDataStoreProviderDao dataStoreProviderDao;
+	@Override
+	public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
new file mode 100644
index 0000000..b6ac34d
--- /dev/null
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
@@ -0,0 +1,27 @@
+/*
+ * 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.manager;
+
+import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
+
+public interface PrimaryDataStoreManager {
+	public PrimaryDataStore getPrimaryDataStore(long dataStoreId);
+	public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
index dd7e061..7ca9000 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
@@ -2,15 +2,41 @@ package org.apache.cloudstack.storage.datastore.provider;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.PrimaryDataStoreInfo;
+import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDriverImpl;
 import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
+import org.springframework.stereotype.Component;
 
+import com.cloud.utils.component.ComponentInject;
+
+@Component
 public class DefaultPrimaryDatastoreProviderImpl implements
 		PrimaryDataStoreProvider {
+	protected PrimaryDataStoreDriver driver;
 	@Inject
-	public PrimaryDataStoreDriver driver;
+	public PrimaryDataStoreDao dataStoreDao;
+
+	public DefaultPrimaryDatastoreProviderImpl() {
+		this.driver = new DefaultPrimaryDataStoreDriverImpl();
+	}
+	@Override
+	public PrimaryDataStore getDataStore(long dataStoreId) {
+		DataStoreVO dsv = dataStoreDao.findById(dataStoreId);
+		if (dsv == null) {
+			return null;
+		}
+		
+		PrimaryDataStore pds = new DefaultPrimaryDataStoreImpl(driver, dsv, null);
+		pds = ComponentInject.inject(pds);
+		return pds;
+	}
+	
 	@Override
-	public PrimaryDataStore getDataStore(String dataStoreId) {
+	public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId) {
 		// TODO Auto-generated method stub
 		return null;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
index 8a8d101..a346d32 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
@@ -1,7 +1,9 @@
 package org.apache.cloudstack.storage.datastore.provider;
 
 import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.storage.datastore.PrimaryDataStoreInfo;
 
 public interface PrimaryDataStoreProvider {
-	public PrimaryDataStore getDataStore(String dataStoreId);
+	public PrimaryDataStore getDataStore(long dataStoreId);
+	public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f36b2f99/platform/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java b/platform/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
index b8229e4..ca3a366 100644
--- a/platform/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
+++ b/platform/storage/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
@@ -25,6 +25,7 @@ import java.util.LinkedList;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
 import org.apache.cloudstack.storage.datastore.provider.DefaultPrimaryDatastoreProviderImpl;
 import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider;
 import org.apache.cloudstack.storage.volume.VolumeMotionService;
@@ -102,6 +103,10 @@ public class volumeServiceTest {
 	@Test
 	public void testStaticBean() {
 		DefaultPrimaryDatastoreProviderImpl provider = ComponentInject.inject(DefaultPrimaryDatastoreProviderImpl.class);
-		assertNotNull(provider.driver);
+		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/f36b2f99/utils/src/com/cloud/utils/component/ComponentInject.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/ComponentInject.java b/utils/src/com/cloud/utils/component/ComponentInject.java
index 4578ea1..c88cd3f 100644
--- a/utils/src/com/cloud/utils/component/ComponentInject.java
+++ b/utils/src/com/cloud/utils/component/ComponentInject.java
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
 public class ComponentInject {
 	
 	private static AutowireCapableBeanFactory beanFactory;
+	@SuppressWarnings("unused")
 	@Inject
 	private void setbeanFactory(AutowireCapableBeanFactory bf) {
 		ComponentInject.beanFactory = bf;
@@ -17,4 +18,10 @@ public class ComponentInject {
 	public static <T> T inject(Class<T> clazz) {
 		return beanFactory.createBean(clazz);
 	}
+	
+	public static <T> T inject(T obj) {
+		beanFactory.autowireBean(obj);
+		beanFactory.initializeBean(obj, null);
+		return obj;
+	}
 }