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 2013/03/08 03:26:16 UTC
[2/2] git commit: refs/heads/master - CLOUDSTACK-1426: We has strong
implication that VO must implement an interface,
otherwise EntityManagerImpl can't the vo
Updated Branches:
refs/heads/master eca1a7089 -> 409ec9c6b
CLOUDSTACK-1426: We has strong implication that VO must implement an interface, otherwise EntityManagerImpl can't the vo
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/409ec9c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/409ec9c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/409ec9c6
Branch: refs/heads/master
Commit: 409ec9c6b6c52a53476e1ff3ab282abd4c881655
Parents: eca1a70
Author: Edison Su <su...@gmail.com>
Authored: Thu Mar 7 18:25:31 2013 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Thu Mar 7 18:25:57 2013 -0800
----------------------------------------------------------------------
.../src/com/cloud/storage/StoragePoolDetailVO.java | 81 ---
.../storage/datastore/db/PrimaryDataStoreDao.java | 148 ++--
.../datastore/db/PrimaryDataStoreDaoImpl.java | 544 ++++++++-------
.../storage/datastore/db/StoragePoolDetailVO.java | 81 +++
.../datastore/db/StoragePoolDetailsDao.java | 28 +
.../storage/datastore/db/StoragePoolVO.java | 9 +-
.../cloud/entity/api/VMEntityManagerImpl.java | 4 +-
.../storage/allocator/StorageAllocatorTest.java | 8 +-
.../StorageAllocatorTestConfiguration.java | 4 +-
.../snapshot/strategy/AncientSnasphotStrategy.java | 4 +-
.../allocator/AbstractStoragePoolAllocator.java | 4 +-
.../allocator/ZoneWideStoragePoolAllocator.java | 4 +-
.../AncientPrimaryDataStoreLifeCycleImpl.java | 2 +-
.../com/cloud/agent/manager/AgentManagerImpl.java | 4 +-
.../allocator/impl/RecreateHostAllocator.java | 4 +-
server/src/com/cloud/api/ApiDBUtils.java | 5 +-
.../com/cloud/capacity/dao/CapacityDaoImpl.java | 4 +-
.../consoleproxy/ConsoleProxyManagerImpl.java | 4 +-
server/src/com/cloud/deploy/FirstFitPlanner.java | 4 +-
server/src/com/cloud/ha/RecreatableFencer.java | 4 +-
.../com/cloud/resource/ResourceManagerImpl.java | 4 +-
.../src/com/cloud/server/ManagementServerImpl.java | 4 +-
.../cloud/storage/LocalStoragePoolListener.java | 4 +-
server/src/com/cloud/storage/OCFS2ManagerImpl.java | 4 +-
.../src/com/cloud/storage/StorageManagerImpl.java | 2 +-
.../src/com/cloud/storage/VolumeManagerImpl.java | 4 +-
.../src/com/cloud/storage/dao/StoragePoolDao.java | 113 ---
.../com/cloud/storage/dao/StoragePoolDaoImpl.java | 432 ------------
.../cloud/storage/dao/StoragePoolDetailsDao.java | 28 -
.../storage/dao/StoragePoolDetailsDaoImpl.java | 3 +-
.../cloud/storage/listener/StoragePoolMonitor.java | 4 +-
.../storage/snapshot/SnapshotManagerImpl.java | 4 +-
.../com/cloud/template/TemplateManagerImpl.java | 4 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 4 +-
.../com/cloud/vm/VirtualMachineManagerImpl.java | 5 +-
.../cloud/vm/snapshot/VMSnapshotManagerImpl.java | 4 +-
.../com/cloud/storage/dao/StoragePoolDaoTest.java | 3 +-
.../dao/StoragePoolDaoTestConfiguration.java | 3 +-
.../cloud/vm/snapshot/VMSnapshotManagerTest.java | 4 +-
39 files changed, 559 insertions(+), 1024 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/core/src/com/cloud/storage/StoragePoolDetailVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/StoragePoolDetailVO.java b/core/src/com/cloud/storage/StoragePoolDetailVO.java
deleted file mode 100644
index 48487e5..0000000
--- a/core/src/com/cloud/storage/StoragePoolDetailVO.java
+++ /dev/null
@@ -1,81 +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 com.cloud.storage;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="storage_pool_details")
-public class StoragePoolDetailVO implements InternalIdentity {
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="id")
- long id;
-
- @Column(name="pool_id")
- long poolId;
-
- @Column(name="name")
- String name;
-
- @Column(name="value")
- String value;
-
- public StoragePoolDetailVO(long poolId, String name, String value) {
- this.poolId = poolId;
- this.name = name;
- this.value = value;
- }
-
- public long getId() {
- return id;
- }
-
- public long getPoolId() {
- return poolId;
- }
-
- public void setPoolId(long poolId) {
- this.poolId = poolId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- protected StoragePoolDetailVO() {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
index 1530ced..4d84525 100644
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
@@ -1,116 +1,112 @@
-/*
- * 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.
- */
+// 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.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus;
+import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
+import com.cloud.storage.StoragePoolStatus;
import com.cloud.utils.db.GenericDao;
-
+/**
+ * Data Access Object for storage_pool table
+ */
public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
- /**
- * @param datacenterId
- * -- the id of the datacenter (availability zone)
- */
- List<StoragePoolVO> listByDataCenterId(long datacenterId);
-
- /**
- * @param datacenterId
- * -- the id of the datacenter (availability zone)
- */
- List<StoragePoolVO> listBy(long datacenterId, long podId, Long clusterId);
-
- /**
- * Set capacity of storage pool in bytes
- *
- * @param id
- * pool id.
- * @param capacity
- * capacity in bytes
- */
+ /**
+ * @param datacenterId -- the id of the datacenter (availability zone)
+ */
+ List<StoragePoolVO> listByDataCenterId(long datacenterId);
+
+ /**
+ * @param datacenterId -- the id of the datacenter (availability zone)
+ */
+ List<StoragePoolVO> listBy(long datacenterId, long podId, Long clusterId, ScopeType scope);
+
+ /**
+ * 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
- */
+
+ /**
+ * Set available bytes of storage pool in bytes
+ * @param id pool id.
+ * @param available available capacity in bytes
+ */
void updateAvailable(long id, long available);
-
+
+
StoragePoolVO persist(StoragePoolVO pool, Map<String, String> details);
-
+
/**
* Find pool by name.
*
- * @param name
- * name of pool.
- * @return the single StoragePoolVO
+ * @param name name of pool.
+ * @return the single StoragePoolVO
*/
List<StoragePoolVO> 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.
+ * @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<StoragePoolVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details);
-
- List<StoragePoolVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
-
+ List<StoragePoolVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details, ScopeType scope);
+
+ List<StoragePoolVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags);
+
/**
* Find pool by UUID.
*
- * @param uuid
- * uuid of pool.
- * @return the single StoragePoolVO
+ * @param uuid uuid of pool.
+ * @return the single StoragePoolVO
*/
StoragePoolVO findPoolByUUID(String uuid);
List<StoragePoolVO> listByStorageHost(String hostFqdnOrIp);
StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
-
+
List<StoragePoolVO> 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<String> searchForStoragePoolDetails(long poolId, String value);
+
+ List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid);
- List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid);
+ List<StoragePoolVO> listByStatus(StoragePoolStatus status);
- List<StoragePoolVO> listByStatus(DataStoreStatus status);
+ long countPoolsByStatus(StoragePoolStatus... statuses);
- long countPoolsByStatus(DataStoreStatus... statuses);
+ List<StoragePoolVO> listByStatusInZone(long dcId, StoragePoolStatus status);
+
+ List<StoragePoolVO> listPoolsByCluster(long clusterId);
- List<StoragePoolVO> listByStatusInZone(long dcId, DataStoreStatus status);
+ List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId,
+ Long clusterId, String[] tags);
- List<StoragePoolVO> listPoolsByCluster(long clusterId);
-}
\ No newline at end of file
+ List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index 023b42b..7fcddf1 100644
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -1,21 +1,19 @@
-/*
- * 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.
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
package org.apache.cloudstack.storage.datastore.db;
import java.sql.PreparedStatement;
@@ -26,12 +24,17 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus;
+import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
import org.springframework.stereotype.Component;
+import com.cloud.host.Status;
+
+import com.cloud.storage.StoragePoolStatus;
+
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
@@ -39,128 +42,147 @@ import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.SearchCriteria2;
+import com.cloud.utils.db.SearchCriteriaService;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
@Component
-public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long> implements PrimaryDataStoreDao {
+@Local(value={PrimaryDataStoreDao.class}) @DB(txn=false)
+public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long> implements PrimaryDataStoreDao {
protected final SearchBuilder<StoragePoolVO> AllFieldSearch;
- protected final SearchBuilder<StoragePoolVO> DcPodSearch;
+ protected final SearchBuilder<StoragePoolVO> DcPodSearch;
protected final SearchBuilder<StoragePoolVO> DcPodAnyClusterSearch;
protected final SearchBuilder<StoragePoolVO> DeleteLvmSearch;
protected final GenericSearchBuilder<StoragePoolVO, Long> StatusCountSearch;
-
- @Inject protected PrimaryDataStoreDetailsDao _detailsDao;
-
- private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and (";
- private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
- private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
-
+
+ @Inject protected StoragePoolDetailsDao _detailsDao;
+
+ private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and storage_pool.scope = ? and (";
+ private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
+ private final String ZoneWideDetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.status = 'Up' and storage_pool.data_center_id = ? and storage_pool.scope = ? and (";
+ private final String ZoneWideDetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
+
+ private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?";
+
public PrimaryDataStoreDaoImpl() {
AllFieldSearch = createSearchBuilder();
AllFieldSearch.and("name", AllFieldSearch.entity().getName(), SearchCriteria.Op.EQ);
AllFieldSearch.and("uuid", AllFieldSearch.entity().getUuid(), SearchCriteria.Op.EQ);
AllFieldSearch.and("datacenterId", AllFieldSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
AllFieldSearch.and("hostAddress", AllFieldSearch.entity().getHostAddress(), SearchCriteria.Op.EQ);
- AllFieldSearch.and("status", AllFieldSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+ AllFieldSearch.and("status",AllFieldSearch.entity().getStatus(),SearchCriteria.Op.EQ);
AllFieldSearch.and("path", AllFieldSearch.entity().getPath(), SearchCriteria.Op.EQ);
AllFieldSearch.and("podId", AllFieldSearch.entity().getPodId(), Op.EQ);
AllFieldSearch.and("clusterId", AllFieldSearch.entity().getClusterId(), Op.EQ);
- AllFieldSearch.done();
-
- DcPodSearch = createSearchBuilder();
- DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL);
- DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
- DcPodSearch.cp();
- DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL);
- DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
- DcPodSearch.cp();
- DcPodSearch.done();
-
- DcPodAnyClusterSearch = createSearchBuilder();
+ AllFieldSearch.done();
+
+ DcPodSearch = createSearchBuilder();
+ DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ DcPodSearch.and("status", DcPodSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+ DcPodSearch.and("scope", DcPodSearch.entity().getScope(), SearchCriteria.Op.EQ);
+ DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL);
+ DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
+ DcPodSearch.cp();
+ DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL);
+ DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
+ DcPodSearch.cp();
+ DcPodSearch.done();
+
+ DcPodAnyClusterSearch = createSearchBuilder();
DcPodAnyClusterSearch.and("datacenterId", DcPodAnyClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+ DcPodAnyClusterSearch.and("status", DcPodAnyClusterSearch.entity().getStatus(), SearchCriteria.Op.EQ);
+ DcPodAnyClusterSearch.and("scope", DcPodAnyClusterSearch.entity().getScope(), SearchCriteria.Op.EQ);
DcPodAnyClusterSearch.and().op("nullpod", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.NULL);
DcPodAnyClusterSearch.or("podId", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.EQ);
DcPodAnyClusterSearch.cp();
DcPodAnyClusterSearch.done();
-
+
DeleteLvmSearch = createSearchBuilder();
DeleteLvmSearch.and("ids", DeleteLvmSearch.entity().getId(), SearchCriteria.Op.IN);
DeleteLvmSearch.and().op("LVM", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
DeleteLvmSearch.or("Filesystem", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
DeleteLvmSearch.cp();
- DeleteLvmSearch.done();
+ DeleteLvmSearch.done();
+
+
StatusCountSearch = createSearchBuilder(Long.class);
StatusCountSearch.and("status", StatusCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
StatusCountSearch.select(null, Func.COUNT, null);
StatusCountSearch.done();
- }
- @Override
- public List<StoragePoolVO> findPoolByName(String name) {
- SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
+ }
+
+ @Override
+ public List<StoragePoolVO> findPoolByName(String name) {
+ SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("name", name);
return listIncludingRemovedBy(sc);
- }
+ }
- @Override
- public StoragePoolVO findPoolByUUID(String uuid) {
- SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
+
+ @Override
+ public StoragePoolVO findPoolByUUID(String uuid) {
+ SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("uuid", uuid);
return findOneIncludingRemovedBy(sc);
- }
+ }
+
+
- @Override
- public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
- SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
+ @Override
+ public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
+ SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("uuid", uuid);
return listBy(sc);
- }
+ }
- @Override
- public List<StoragePoolVO> listByDataCenterId(long datacenterId) {
- SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
+
+ @Override
+ public List<StoragePoolVO> listByDataCenterId(long datacenterId) {
+ SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("datacenterId", datacenterId);
return listBy(sc);
- }
+ }
- @Override
- public void updateAvailable(long id, long available) {
- StoragePoolVO pool = createForUpdate(id);
- pool.setAvailableBytes(available);
- update(id, pool);
- }
- @Override
- public void updateCapacity(long id, long capacity) {
- StoragePoolVO pool = createForUpdate(id);
- pool.setCapacityBytes(capacity);
- update(id, pool);
+ @Override
+ public void updateAvailable(long id, long available) {
+ StoragePoolVO pool = createForUpdate(id);
+ pool.setAvailableBytes(available);
+ update(id, pool);
+ }
- }
+ @Override
+ public void updateCapacity(long id, long capacity) {
+ StoragePoolVO pool = createForUpdate(id);
+ pool.setCapacityBytes(capacity);
+ update(id, pool);
+
+ }
+
@Override
public List<StoragePoolVO> listByStorageHost(String hostFqdnOrIp) {
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("hostAddress", hostFqdnOrIp);
return listIncludingRemovedBy(sc);
}
-
+
@Override
- public List<StoragePoolVO> listByStatus(DataStoreStatus status) {
+ public List<StoragePoolVO> listByStatus(StoragePoolStatus status){
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
- sc.setParameters("status", status);
- return listBy(sc);
+ sc.setParameters("status", status);
+ return listBy(sc);
}
-
+
@Override
- public List<StoragePoolVO> listByStatusInZone(long dcId, DataStoreStatus status) {
+ public List<StoragePoolVO> listByStatusInZone(long dcId, StoragePoolStatus status){
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
- sc.setParameters("status", status);
- sc.setParameters("datacenterId", dcId);
- return listBy(sc);
+ sc.setParameters("status", status);
+ sc.setParameters("datacenterId", dcId);
+ return listBy(sc);
}
@Override
@@ -171,190 +193,238 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
sc.setParameters("datacenterId", datacenterId);
sc.setParameters("podId", podId);
sc.setParameters("uuid", uuid);
-
+
return findOneBy(sc);
}
- @Override
- public List<StoragePoolVO> listBy(long datacenterId, long podId, Long clusterId) {
- if (clusterId != null) {
- SearchCriteria<StoragePoolVO> sc = DcPodSearch.create();
+ @Override
+ public List<StoragePoolVO> listBy(long datacenterId, long podId, Long clusterId, ScopeType scope) {
+ if (clusterId != null) {
+ SearchCriteria<StoragePoolVO> sc = DcPodSearch.create();
sc.setParameters("datacenterId", datacenterId);
sc.setParameters("podId", podId);
-
+ sc.setParameters("status", Status.Up);
+ sc.setParameters("scope", scope);
+
sc.setParameters("cluster", clusterId);
return listBy(sc);
- } else {
- SearchCriteria<StoragePoolVO> sc = DcPodAnyClusterSearch.create();
- sc.setParameters("datacenterId", datacenterId);
- sc.setParameters("podId", podId);
- return listBy(sc);
- }
- }
-
- @Override
- public List<StoragePoolVO> listPoolByHostPath(String host, String path) {
+ } else {
+ SearchCriteria<StoragePoolVO> sc = DcPodAnyClusterSearch.create();
+ sc.setParameters("datacenterId", datacenterId);
+ sc.setParameters("podId", podId);
+ sc.setParameters("status", Status.Up);
+ sc.setParameters("scope", scope);
+ return listBy(sc);
+ }
+ }
+
+ @Override
+ public List<StoragePoolVO> listPoolByHostPath(String host, String path) {
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("hostAddress", host);
sc.setParameters("path", path);
-
+
return listBy(sc);
- }
-
- public StoragePoolVO listById(Integer id) {
+ }
+
+ public StoragePoolVO listById(Integer id)
+ {
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("id", id);
-
+
return findOneIncludingRemovedBy(sc);
- }
-
- @Override
- @DB
- public StoragePoolVO persist(StoragePoolVO pool, Map<String, String> details) {
- Transaction txn = Transaction.currentTxn();
- txn.start();
- pool = super.persist(pool);
- if (details != null) {
- for (Map.Entry<String, String> detail : details.entrySet()) {
- PrimaryDataStoreDetailVO vo = new PrimaryDataStoreDetailVO(pool.getId(), detail.getKey(), detail.getValue());
- _detailsDao.persist(vo);
- }
- }
- txn.commit();
- return pool;
- }
-
- @DB
- @Override
- public List<StoragePoolVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details) {
- StringBuilder sql = new StringBuilder(DetailsSqlPrefix);
- if (clusterId != null) {
- sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND (");
- }
- for (Map.Entry<String, String> detail : details.entrySet()) {
- sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR ");
- }
- sql.delete(sql.length() - 4, sql.length());
- sql.append(DetailsSqlSuffix);
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- pstmt = txn.prepareAutoCloseStatement(sql.toString());
- int i = 1;
- pstmt.setLong(i++, dcId);
- pstmt.setLong(i++, podId);
- if (clusterId != null) {
- pstmt.setLong(i++, clusterId);
- }
- pstmt.setInt(i++, details.size());
- ResultSet rs = pstmt.executeQuery();
- List<StoragePoolVO> pools = new ArrayList<StoragePoolVO>();
- while (rs.next()) {
- pools.add(toEntityBean(rs, false));
- }
- return pools;
- } catch (SQLException e) {
- throw new CloudRuntimeException("Unable to execute " + pstmt, e);
+ }
+
+ @Override @DB
+ public StoragePoolVO persist(StoragePoolVO pool, Map<String, String> details) {
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+ pool = super.persist(pool);
+ if (details != null) {
+ for (Map.Entry<String, String> detail : details.entrySet()) {
+ StoragePoolDetailVO vo = new StoragePoolDetailVO(pool.getId(), detail.getKey(), detail.getValue());
+ _detailsDao.persist(vo);
+ }
}
+ txn.commit();
+ return pool;
+ }
+
+ @DB
+ @Override
+ public List<StoragePoolVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details, ScopeType scope) {
+ StringBuilder sql = new StringBuilder(DetailsSqlPrefix);
+ if (clusterId != null) {
+ sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND (");
+ }
+
+ for (Map.Entry<String, String> detail : details.entrySet()) {
+ sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR ");
+ }
+ sql.delete(sql.length() - 4, sql.length());
+ sql.append(DetailsSqlSuffix);
+ Transaction txn = Transaction.currentTxn();
+ PreparedStatement pstmt = null;
+ try {
+ pstmt = txn.prepareAutoCloseStatement(sql.toString());
+ int i = 1;
+ pstmt.setLong(i++, dcId);
+ pstmt.setLong(i++, podId);
+ pstmt.setString(i++, scope.toString());
+ if (clusterId != null) {
+ pstmt.setLong(i++, clusterId);
+ }
+ pstmt.setInt(i++, details.size());
+ ResultSet rs = pstmt.executeQuery();
+ List<StoragePoolVO> pools = new ArrayList<StoragePoolVO>();
+ while (rs.next()) {
+ pools.add(toEntityBean(rs, false));
+ }
+ return pools;
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable to execute " + pstmt, e);
+ }
+ }
+
+ protected Map<String, String> tagsToDetails(String[] tags) {
+ Map<String, String> details = new HashMap<String, String>(tags.length);
+ for (String tag: tags) {
+ details.put(tag, "true");
+ }
+ return details;
+ }
+
+ @Override
+ public List<StoragePoolVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags) {
+ List<StoragePoolVO> storagePools = null;
+ if (tags == null || tags.length == 0) {
+ storagePools = listBy(dcId, podId, clusterId, ScopeType.CLUSTER);
+ } else {
+ Map<String, String> details = tagsToDetails(tags);
+ storagePools = findPoolsByDetails(dcId, podId, clusterId, details, ScopeType.CLUSTER);
+ }
+
+ return storagePools;
+ }
+
+ @Override
+ public List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags) {
+ List<StoragePoolVO> storagePools = null;
+ if (tags == null || tags.length == 0) {
+ storagePools = listBy(dcId, podId, clusterId, ScopeType.HOST);
+ } else {
+ Map<String, String> details = tagsToDetails(tags);
+ storagePools = findPoolsByDetails(dcId, podId, clusterId, details, ScopeType.HOST);
+ }
+
+ return storagePools;
+ }
+
+ @Override
+ public List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags) {
+ List<StoragePoolVO> storagePools = null;
+ if (tags == null || tags.length == 0) {
+ SearchCriteriaService<StoragePoolVO, StoragePoolVO> sc = SearchCriteria2.create(StoragePoolVO.class);
+ sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
+ sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
+ sc.addAnd(sc.getEntity().getScope(), Op.EQ, ScopeType.ZONE);
+ return sc.list();
+ } else {
+ Map<String, String> details = tagsToDetails(tags);
+
+ StringBuilder sql = new StringBuilder(ZoneWideDetailsSqlPrefix);
+
+ for (Map.Entry<String, String> detail : details.entrySet()) {
+ sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR ");
+ }
+ sql.delete(sql.length() - 4, sql.length());
+ sql.append(ZoneWideDetailsSqlSuffix);
+ Transaction txn = Transaction.currentTxn();
+ PreparedStatement pstmt = null;
+ try {
+ pstmt = txn.prepareAutoCloseStatement(sql.toString());
+ int i = 1;
+ pstmt.setLong(i++, dcId);
+ pstmt.setString(i++, ScopeType.ZONE.toString());
+ pstmt.setInt(i++, details.size());
+ ResultSet rs = pstmt.executeQuery();
+ List<StoragePoolVO> pools = new ArrayList<StoragePoolVO>();
+ while (rs.next()) {
+ pools.add(toEntityBean(rs, false));
+ }
+ return pools;
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable to execute " + pstmt, e);
+ }
+ }
+ }
+
+ @Override
+ @DB
+ public List<String> searchForStoragePoolDetails(long poolId, String value){
+
+ StringBuilder sql = new StringBuilder(FindPoolTagDetails);
+
+ Transaction txn = Transaction.currentTxn();
+ PreparedStatement pstmt = null;
+ try {
+ pstmt = txn.prepareAutoCloseStatement(sql.toString());
+ pstmt.setLong(1, poolId);
+ pstmt.setString(2, value);
+
+ ResultSet rs = pstmt.executeQuery();
+ List<String> tags = new ArrayList<String>();
+
+ while (rs.next()) {
+ tags.add(rs.getString("name"));
+ }
+ return tags;
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
+ }
+
+ }
+
+ @Override
+ public void updateDetails(long poolId, Map<String, String> details) {
+ if (details != null) {
+ _detailsDao.update(poolId, details);
+ }
}
-
- protected Map<String, String> tagsToDetails(String[] tags) {
- Map<String, String> details = new HashMap<String, String>(tags.length);
- for (String tag : tags) {
- details.put(tag, "true");
- }
- return details;
- }
-
- @Override
- public List<StoragePoolVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) {
- List<StoragePoolVO> storagePools = null;
- if (tags == null || tags.length == 0) {
- storagePools = listBy(dcId, podId, clusterId);
- } else {
- Map<String, String> details = tagsToDetails(tags);
- storagePools = findPoolsByDetails(dcId, podId, clusterId, details);
- }
-
- if (shared == null) {
- return storagePools;
- } else {
- List<StoragePoolVO> filteredStoragePools = new ArrayList<StoragePoolVO>(storagePools);
- for (StoragePoolVO pool : storagePools) {
- /*
- * if (shared != pool.isShared()) {
- * filteredStoragePools.remove(pool); }
- */
- }
-
- return filteredStoragePools;
- }
- }
-
- @Override
- @DB
- public List<String> searchForStoragePoolDetails(long poolId, String value) {
-
- StringBuilder sql = new StringBuilder(FindPoolTagDetails);
-
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- pstmt = txn.prepareAutoCloseStatement(sql.toString());
- pstmt.setLong(1, poolId);
- pstmt.setString(2, value);
-
- ResultSet rs = pstmt.executeQuery();
- List<String> tags = new ArrayList<String>();
-
- while (rs.next()) {
- tags.add(rs.getString("name"));
- }
- return tags;
- } catch (SQLException e) {
- throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
- }
-
- }
-
- @Override
- public void updateDetails(long poolId, Map<String, String> details) {
- if (details != null) {
- _detailsDao.update(poolId, details);
- }
- }
-
- @Override
- public Map<String, String> getDetails(long poolId) {
- return _detailsDao.getDetails(poolId);
- }
-
- @Override
+
+ @Override
+ public Map<String, String> getDetails(long poolId) {
+ return _detailsDao.getDetails(poolId);
+ }
+
+ @Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- super.configure(name, params);
- _detailsDao.configure("DetailsDao", params);
- return true;
- }
-
+ super.configure(name, params);
+ _detailsDao.configure("DetailsDao", params);
+ return true;
+ }
+
+
+
@Override
- public long countPoolsByStatus(DataStoreStatus... statuses) {
+ public long countPoolsByStatus( StoragePoolStatus... statuses) {
SearchCriteria<Long> sc = StatusCountSearch.create();
-
- sc.setParameters("status", (Object[]) statuses);
-
+
+ sc.setParameters("status", (Object[])statuses);
+
List<Long> rs = customSearchIncludingRemoved(sc, null);
if (rs.size() == 0) {
return 0;
}
-
+
return rs.get(0);
}
-
+
@Override
public List<StoragePoolVO> listPoolsByCluster(long clusterId) {
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
sc.setParameters("clusterId", clusterId);
-
+
return listBy(sc);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java
new file mode 100644
index 0000000..699beef
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailVO.java
@@ -0,0 +1,81 @@
+// 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.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="storage_pool_details")
+public class StoragePoolDetailVO implements InternalIdentity {
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ long id;
+
+ @Column(name="pool_id")
+ long poolId;
+
+ @Column(name="name")
+ String name;
+
+ @Column(name="value")
+ String value;
+
+ public StoragePoolDetailVO(long poolId, String name, String value) {
+ this.poolId = poolId;
+ this.name = name;
+ this.value = value;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public long getPoolId() {
+ return poolId;
+ }
+
+ public void setPoolId(long poolId) {
+ this.poolId = poolId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ protected StoragePoolDetailVO() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailsDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailsDao.java
new file mode 100644
index 0000000..be71670
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolDetailsDao.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 java.util.Map;
+
+
+import com.cloud.utils.db.GenericDao;
+
+public interface StoragePoolDetailsDao extends GenericDao<StoragePoolDetailVO, Long> {
+
+ void update(long poolId, Map<String, String> details);
+ Map<String, String> getDetails(long poolId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
index 1782f16..579eaef 100644
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
@@ -32,12 +32,13 @@ import javax.persistence.TemporalType;
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.utils.db.GenericDao;
@Entity
@Table(name="storage_pool")
-public class StoragePoolVO {
+public class StoragePoolVO implements StoragePool{
@Id
@TableGenerator(name = "storage_pool_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "storage_pool_seq", allocationSize = 1)
@Column(name = "id", updatable = false, nullable = false)
@@ -301,4 +302,10 @@ public class StoragePoolVO {
public boolean isLocal() {
return !isShared();
}
+
+ @Override
+ public boolean isInMaintenance() {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index d7bab4a..8b9b100 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -28,6 +28,7 @@ import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMEntityDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.springframework.stereotype.Component;
import com.cloud.dc.DataCenter;
@@ -50,7 +51,6 @@ import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.DiskOfferingDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.dao.AccountDao;
@@ -101,7 +101,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
protected VolumeDao _volsDao;
@Inject
- protected StoragePoolDao _storagePoolDao;
+ protected PrimaryDataStoreDao _storagePoolDao;
@Inject
DataStoreManager dataStoreMgr;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
index 81dfb62..414e231 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTest.java
@@ -30,6 +30,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.junit.Before;
import org.junit.Test;
@@ -54,14 +57,11 @@ import com.cloud.org.Managed.ManagedState;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolDetailVO;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.dao.DiskOfferingDao;
-import com.cloud.storage.dao.StoragePoolDao;
-import com.cloud.storage.dao.StoragePoolDetailsDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.utils.component.ComponentContext;
import com.cloud.vm.DiskProfile;
@@ -71,7 +71,7 @@ import com.cloud.vm.VirtualMachineProfile;
@ContextConfiguration(locations = "classpath:/storageContext.xml")
public class StorageAllocatorTest {
@Inject
- StoragePoolDao storagePoolDao;
+ PrimaryDataStoreDao storagePoolDao;
@Inject
StorageManager storageMgr;
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
index 1601702..b815fc1 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.storage.allocator;
import java.io.IOException;
import org.apache.cloudstack.storage.allocator.StorageAllocatorTestConfiguration.Library;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -33,7 +34,6 @@ import com.cloud.dc.dao.DataCenterDaoImpl;
import com.cloud.domain.dao.DomainDaoImpl;
import com.cloud.host.dao.HostDaoImpl;
import com.cloud.storage.StorageManager;
-import com.cloud.storage.dao.StoragePoolDaoImpl;
import com.cloud.storage.dao.StoragePoolDetailsDaoImpl;
import com.cloud.storage.dao.VMTemplateDaoImpl;
import com.cloud.utils.component.SpringComponentScanUtils;
@@ -43,7 +43,7 @@ import com.cloud.vm.UserVmManager;
@Configuration
@ComponentScan(basePackageClasses={
StoragePoolDetailsDaoImpl.class,
- StoragePoolDaoImpl.class,
+ PrimaryDataStoreDaoImpl.class,
VMTemplateDaoImpl.class,
HostDaoImpl.class,
DomainDaoImpl.class,
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java
index 5cbe224..ea3b0af 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java
@@ -44,6 +44,7 @@ import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.framework.async.AsyncRpcConext;
import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.motion.DataMotionService;
import org.apache.cloudstack.storage.snapshot.SnapshotObject;
import org.apache.cloudstack.storage.snapshot.SnapshotStateMachineManager;
@@ -71,7 +72,6 @@ import com.cloud.storage.StoragePool;
import com.cloud.storage.VolumeManager;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.SnapshotDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.storage.s3.S3Manager;
import com.cloud.storage.snapshot.SnapshotManager;
@@ -96,7 +96,7 @@ public class AncientSnasphotStrategy implements SnapshotStrategy {
@Inject
protected UserVmDao _vmDao;
@Inject
- protected StoragePoolDao _storagePoolDao;
+ protected PrimaryDataStoreDao _storagePoolDao;
@Inject
protected ClusterDao _clusterDao;
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
index 4c5f0e6..6334ca7 100755
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
@@ -29,6 +29,7 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import com.cloud.configuration.dao.ConfigurationDao;
@@ -43,7 +44,6 @@ import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
import com.cloud.storage.Volume.Type;
import com.cloud.storage.dao.DiskOfferingDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.Account;
import com.cloud.utils.NumbersUtil;
@@ -55,7 +55,7 @@ import com.cloud.vm.VirtualMachineProfile;
public abstract class AbstractStoragePoolAllocator extends AdapterBase implements StoragePoolAllocator {
private static final Logger s_logger = Logger.getLogger(AbstractStoragePoolAllocator.class);
@Inject StorageManager storageMgr;
- protected @Inject StoragePoolDao _storagePoolDao;
+ protected @Inject PrimaryDataStoreDao _storagePoolDao;
@Inject VolumeDao _volumeDao;
@Inject ConfigurationDao _configDao;
@Inject ClusterDao _clusterDao;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
index 6f78497..c45f8a8 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
@@ -22,6 +22,7 @@ import java.util.List;
import javax.inject.Inject;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -31,7 +32,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
@@ -39,7 +39,7 @@ import com.cloud.vm.VirtualMachineProfile;
@Component
public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
private static final Logger s_logger = Logger.getLogger(ZoneWideStoragePoolAllocator.class);
- @Inject StoragePoolDao _storagePoolDao;
+ @Inject PrimaryDataStoreDao _storagePoolDao;
@Inject DataStoreManager dataStoreMgr;
@Override
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
index 7a5b0d0..6154a66 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCycleImpl.java
@@ -532,7 +532,7 @@ public class AncientPrimaryDataStoreLifeCycleImpl implements
// if they dont, then just stop all vms on this one
List<StoragePoolVO> upPools = primaryDataStoreDao
.listByStatusInZone(pool.getDataCenterId(),
- DataStoreStatus.Up);
+ StoragePoolStatus.Up);
boolean restart = true;
if (upPools == null || upPools.size() == 0) {
restart = false;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index 5342a4f..c1bbb58 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -39,6 +39,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -100,7 +101,6 @@ import com.cloud.resource.ServerResource;
import com.cloud.server.ManagementService;
import com.cloud.storage.StorageManager;
import com.cloud.storage.StorageService;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.storage.resource.DummySecondaryStorageResource;
@@ -172,7 +172,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
@Inject
protected ConfigurationDao _configDao = null;
@Inject
- protected StoragePoolDao _storagePoolDao = null;
+ protected PrimaryDataStoreDao _storagePoolDao = null;
@Inject
protected StoragePoolHostDao _storagePoolHostDao = null;
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
index dc2082f..3b659c0 100755
--- a/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
+++ b/server/src/com/cloud/agent/manager/allocator/impl/RecreateHostAllocator.java
@@ -27,6 +27,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -49,7 +50,6 @@ import com.cloud.host.dao.HostDao;
import com.cloud.org.Grouping;
import com.cloud.resource.ResourceManager;
import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.utils.Pair;
import com.cloud.vm.VirtualMachine;
@@ -61,7 +61,7 @@ public class RecreateHostAllocator extends FirstFitRoutingAllocator {
private final static Logger s_logger = Logger.getLogger(RecreateHostAllocator.class);
@Inject HostPodDao _podDao;
- @Inject StoragePoolDao _poolDao;
+ @Inject PrimaryDataStoreDao _poolDao;
@Inject ClusterDao _clusterDao;
@Inject VolumeDao _volsDao;
@Inject DataCenterDao _dcDao;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 95879ee..8e6f806 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -45,6 +45,7 @@ import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.springframework.stereotype.Component;
@@ -254,7 +255,7 @@ public class ApiDBUtils {
static HostPodDao _podDao;
static ServiceOfferingDao _serviceOfferingDao;
static SnapshotDao _snapshotDao;
- static StoragePoolDao _storagePoolDao;
+ static PrimaryDataStoreDao _storagePoolDao;
static VMTemplateDao _templateDao;
static VMTemplateDetailsDao _templateDetailsDao;
static VMTemplateHostDao _templateHostDao;
@@ -357,7 +358,7 @@ public class ApiDBUtils {
@Inject private HostPodDao podDao;
@Inject private ServiceOfferingDao serviceOfferingDao;
@Inject private SnapshotDao snapshotDao;
- @Inject private StoragePoolDao storagePoolDao;
+ @Inject private PrimaryDataStoreDao storagePoolDao;
@Inject private VMTemplateDao templateDao;
@Inject private VMTemplateDetailsDao templateDetailsDao;
@Inject private VMTemplateHostDao templateHostDao;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
index 1c23cb8..c3d9817 100755
--- a/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
+++ b/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java
@@ -27,6 +27,7 @@ import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -34,7 +35,6 @@ import org.springframework.stereotype.Component;
import com.cloud.capacity.Capacity;
import com.cloud.capacity.CapacityVO;
import com.cloud.storage.Storage;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.utils.Pair;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
@@ -62,7 +62,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
private final SearchBuilder<CapacityVO> _hostIdTypeSearch;
private final SearchBuilder<CapacityVO> _hostOrPoolIdSearch;
private final SearchBuilder<CapacityVO> _allFieldsSearch;
- @Inject protected StoragePoolDao _storagePoolDao;
+ @Inject protected PrimaryDataStoreDao _storagePoolDao;
private static final String LIST_HOSTS_IN_CLUSTER_WITH_ENOUGH_CAPACITY = " SELECT host_capacity.host_id FROM (`cloud`.`host` JOIN `cloud`.`op_host_capacity` host_capacity ON (host.id = host_capacity.host_id AND host.cluster_id = ?) JOIN `cloud`.`cluster_details` cluster_details ON (host_capacity.cluster_id = cluster_details.cluster_id) AND host.type = ? AND cluster_details.name='cpuOvercommitRatio' AND ((host_capacity.total_capacity *cluster_details.value ) - host_capacity.used_capacity) >= ? and host_capacity.capacity_type = '1' " +
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 69f70e5..544a803 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -31,6 +31,7 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
@@ -115,7 +116,6 @@ import com.cloud.storage.VMTemplateHostVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import com.cloud.storage.dao.DiskOfferingDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VMTemplateHostDao;
import com.cloud.template.TemplateManager;
@@ -221,7 +221,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
@Inject
NetworkOfferingDao _networkOfferingDao;
@Inject
- StoragePoolDao _storagePoolDao;
+ PrimaryDataStoreDao _storagePoolDao;
@Inject
UserVmDetailsDao _vmDetailsDao;
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/deploy/FirstFitPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java
index 187ceab..c219cfc 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -29,6 +29,7 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import com.cloud.agent.manager.allocator.HostAllocator;
@@ -67,7 +68,6 @@ import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.GuestOSCategoryDao;
import com.cloud.storage.dao.GuestOSDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.AccountManager;
@@ -96,7 +96,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
@Inject protected VolumeDao _volsDao;
@Inject protected CapacityManager _capacityMgr;
@Inject protected ConfigurationDao _configDao;
- @Inject protected StoragePoolDao _storagePoolDao;
+ @Inject protected PrimaryDataStoreDao _storagePoolDao;
@Inject protected CapacityDao _capacityDao;
@Inject protected AccountManager _accountMgr;
@Inject protected StorageManager _storageMgr;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/ha/RecreatableFencer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/RecreatableFencer.java b/server/src/com/cloud/ha/RecreatableFencer.java
index dd3e71c..50aa1b7 100644
--- a/server/src/com/cloud/ha/RecreatableFencer.java
+++ b/server/src/com/cloud/ha/RecreatableFencer.java
@@ -21,12 +21,12 @@ import java.util.List;
import javax.ejb.Local;
import javax.inject.Inject;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.host.HostVO;
import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VMInstanceVO;
@@ -37,7 +37,7 @@ import com.cloud.vm.VirtualMachine;
public class RecreatableFencer extends AdapterBase implements FenceBuilder {
private static final Logger s_logger = Logger.getLogger(RecreatableFencer.class);
@Inject VolumeDao _volsDao;
- @Inject StoragePoolDao _poolDao;
+ @Inject PrimaryDataStoreDao _poolDao;
public RecreatableFencer() {
super();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index a4a08aa..47b1d55 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -45,6 +45,7 @@ import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -117,7 +118,6 @@ import com.cloud.storage.Swift;
import com.cloud.storage.SwiftVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.dao.GuestOSCategoryDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.s3.S3Manager;
@@ -193,7 +193,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
@Inject
protected GuestOSCategoryDao _guestOSCategoryDao;
@Inject
- protected StoragePoolDao _storagePoolDao;
+ protected PrimaryDataStoreDao _storagePoolDao;
@Inject
protected DataCenterIpAddressDao _privateIPAddressDao;
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 3c615e1..11400de 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -109,6 +109,7 @@ import org.apache.cloudstack.api.command.user.vpn.*;
import org.apache.cloudstack.api.command.user.zone.*;
import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
@@ -220,7 +221,6 @@ import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.GuestOSCategoryDao;
import com.cloud.storage.dao.GuestOSDao;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.UploadDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
@@ -355,7 +355,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject
private GuestOSCategoryDao _guestOSCategoryDao;
@Inject
- private StoragePoolDao _poolDao;
+ private PrimaryDataStoreDao _poolDao;
@Inject
private NetworkDao _networkDao;
@Inject
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/storage/LocalStoragePoolListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/LocalStoragePoolListener.java b/server/src/com/cloud/storage/LocalStoragePoolListener.java
index a04c79c..244f7fb 100755
--- a/server/src/com/cloud/storage/LocalStoragePoolListener.java
+++ b/server/src/com/cloud/storage/LocalStoragePoolListener.java
@@ -18,6 +18,7 @@ package com.cloud.storage;
import javax.inject.Inject;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import com.cloud.agent.Listener;
@@ -33,13 +34,12 @@ import com.cloud.dc.dao.DataCenterDao;
import com.cloud.exception.ConnectionException;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.utils.db.DB;
public class LocalStoragePoolListener implements Listener {
private final static Logger s_logger = Logger.getLogger(LocalStoragePoolListener.class);
- @Inject StoragePoolDao _storagePoolDao;
+ @Inject PrimaryDataStoreDao _storagePoolDao;
@Inject StoragePoolHostDao _storagePoolHostDao;
@Inject CapacityDao _capacityDao;
@Inject StorageManager _storageMgr;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/storage/OCFS2ManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/OCFS2ManagerImpl.java b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
index 5c526a6..476bf04 100755
--- a/server/src/com/cloud/storage/OCFS2ManagerImpl.java
+++ b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
@@ -25,6 +25,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -43,7 +44,6 @@ import com.cloud.resource.ResourceListener;
import com.cloud.resource.ResourceManager;
import com.cloud.resource.ServerResource;
import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.utils.Ternary;
import com.cloud.utils.component.ManagerBase;
@@ -63,7 +63,7 @@ public class OCFS2ManagerImpl extends ManagerBase implements OCFS2Manager, Resou
@Inject ClusterDao _clusterDao;
@Inject ResourceManager _resourceMgr;
@Inject StoragePoolHostDao _poolHostDao;
- @Inject StoragePoolDao _poolDao;
+ @Inject PrimaryDataStoreDao _poolDao;
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index f510792..b0a1da1 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1395,7 +1395,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
List<StoragePoolVO> spes = _storagePoolDao.listBy(
primaryStorage.getDataCenterId(), primaryStorage.getPodId(),
- primaryStorage.getClusterId());
+ primaryStorage.getClusterId(), ScopeType.CLUSTER);
for (StoragePoolVO sp : spes) {
if (sp.getStatus() == StoragePoolStatus.PrepareForMaintenance) {
throw new CloudRuntimeException(
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index 336dbcb..f0e6028 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -1444,8 +1444,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
List<StoragePoolVO> matchingVMPools = _storagePoolDao
.findPoolsByTags(vmRootVolumePool.getDataCenterId(),
vmRootVolumePool.getPodId(),
- vmRootVolumePool.getClusterId(), volumeTags,
- isVolumeOnSharedPool);
+ vmRootVolumePool.getClusterId(), volumeTags
+ );
boolean moveVolumeNeeded = true;
if (matchingVMPools.size() == 0) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/409ec9c6/server/src/com/cloud/storage/dao/StoragePoolDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/dao/StoragePoolDao.java b/server/src/com/cloud/storage/dao/StoragePoolDao.java
deleted file mode 100644
index 28ead9c..0000000
--- a/server/src/com/cloud/storage/dao/StoragePoolDao.java
+++ /dev/null
@@ -1,113 +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 com.cloud.storage.dao;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
-import com.cloud.storage.StoragePoolStatus;
-import com.cloud.utils.db.GenericDao;
-/**
- * Data Access Object for storage_pool table
- */
-public interface StoragePoolDao extends GenericDao<StoragePoolVO, Long> {
-
- /**
- * @param datacenterId -- the id of the datacenter (availability zone)
- */
- List<StoragePoolVO> listByDataCenterId(long datacenterId);
-
- /**
- * @param datacenterId -- the id of the datacenter (availability zone)
- */
- List<StoragePoolVO> listBy(long datacenterId, long podId, Long clusterId, ScopeType scope);
-
- /**
- * 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);
-
-
- StoragePoolVO persist(StoragePoolVO pool, Map<String, String> details);
-
- /**
- * Find pool by name.
- *
- * @param name name of pool.
- * @return the single StoragePoolVO
- */
- List<StoragePoolVO> 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<StoragePoolVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details, ScopeType scope);
-
- List<StoragePoolVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags);
-
- /**
- * Find pool by UUID.
- *
- * @param uuid uuid of pool.
- * @return the single StoragePoolVO
- */
- StoragePoolVO findPoolByUUID(String uuid);
-
- List<StoragePoolVO> listByStorageHost(String hostFqdnOrIp);
-
- StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
-
- List<StoragePoolVO> 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<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid);
-
- List<StoragePoolVO> listByStatus(StoragePoolStatus status);
-
- long countPoolsByStatus(StoragePoolStatus... statuses);
-
- List<StoragePoolVO> listByStatusInZone(long dcId, StoragePoolStatus status);
-
- List<StoragePoolVO> listPoolsByCluster(long clusterId);
-
- List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId,
- Long clusterId, String[] tags);
-
- List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags);
-}