You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/11/05 18:23:42 UTC
[14/18] Moved platform to engine
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index 7efa561..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore;
-
-import java.util.List;
-
-import org.apache.cloudstack.storage.EndPoint;
-import org.apache.cloudstack.storage.volume.Volume;
-import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
-
-public interface PrimaryDataStore {
- Volume getVolume(long id);
- List<Volume> getVolumes();
- boolean deleteVolume(long id);
- Volume createVolume(long id, VolumeDiskType diskType);
- List<EndPoint> getEndPoints();
- PrimaryDataStoreInfo getDataStoreInfo();
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index d30a5c8..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfo.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore;
-
-import 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/3dafea6e/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
deleted file mode 100644
index c453d33..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreInfoImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore;
-
-import java.util.List;
-
-import org.apache.cloudstack.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/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreVO.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreVO.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreVO.java
deleted file mode 100644
index 52f3bbf..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreVO.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.db;
-
-import java.util.Date;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
-
-import com.cloud.api.Identity;
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name="storage_pool")
-public class DataStoreVO implements Identity {
- @Id
- @TableGenerator(name="storage_pool_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="storage_pool_seq", allocationSize=1)
- @Column(name="id", updatable=false, nullable = false)
- private long id;
-
- @Column(name="name", updatable=false, nullable=false, length=255)
- private String name = null;
-
- @Column(name="uuid", length=255)
- private String uuid = null;
-
- @Column(name="pool_type", updatable=false, nullable=false, length=32)
- private String protocol;
-
- @Column(name=GenericDao.CREATED_COLUMN)
- Date created;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- private Date removed;
-
- @Column(name="update_time", updatable=true)
- @Temporal(value=TemporalType.TIMESTAMP)
- private Date updateTime;
-
- @Column(name="data_center_id", updatable=true, nullable=false)
- private long dataCenterId;
-
- @Column(name="pod_id", updatable=true)
- private Long podId;
-
- @Column(name="available_bytes", updatable=true, nullable=true)
- private long availableBytes;
-
- @Column(name="capacity_bytes", updatable=true, nullable=true)
- private long capacityBytes;
-
- @Column(name="status", updatable=true, nullable=false)
- @Enumerated(value=EnumType.STRING)
- private DataStoreStatus status;
-
- @Column(name="storage_provider", updatable=true, nullable=false)
- private Long storageProvider;
-
- @Column(name="storage_type", nullable=false)
- private String storageType;
-
- @Column(name="host_address")
- private String hostAddress;
-
- @Column(name="path")
- private String path;
-
- @Column(name="port")
- private int port;
-
- @Column(name="user_info")
- private String userInfo;
-
- @Column(name="cluster_id")
- private Long clusterId;
-
- public long getId() {
- return id;
- }
-
- public DataStoreStatus getStatus() {
- return status;
- }
-
- public DataStoreVO() {
- // TODO Auto-generated constructor stub
- }
-
- public String getName() {
- return name;
- }
-
- public String getUuid() {
- return uuid;
- }
-
-
- public String getPoolType() {
- return protocol;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public Date getRemoved() {
- return removed;
- }
-
- public Date getUpdateTime() {
- return updateTime;
- }
-
- public long getDataCenterId() {
- return dataCenterId;
- }
-
- public long getAvailableBytes() {
- return availableBytes;
- }
-
- public Long getStorageProviderId() {
- return storageProvider;
- }
-
- public void setStorageProviderId(Long provider) {
- storageProvider = provider;
- }
-
- public String getStorageType() {
- return storageType;
- }
-
- public void setStorageType(String type) {
- storageType = type;
- }
-
- public long getCapacityBytes() {
- return capacityBytes;
- }
-
- public void setAvailableBytes(long available) {
- availableBytes = available;
- }
-
- public void setCapacityBytes(long capacity) {
- capacityBytes = capacity;
- }
-
-
- public Long getClusterId() {
- return clusterId;
- }
-
- public void setClusterId(Long clusterId) {
- this.clusterId = clusterId;
- }
-
- public String getHostAddress() {
- return hostAddress;
- }
-
- public String getPath() {
- return path;
- }
-
- public String getUserInfo() {
- return userInfo;
- }
-
- public void setStatus(DataStoreStatus status)
- {
- this.status = status;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public void setDataCenterId(long dcId) {
- this.dataCenterId = dcId;
- }
-
- public void setPodId(Long podId) {
- this.podId = podId;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public void setUserInfo(String userInfo) {
- this.userInfo = userInfo;
- }
-
- public int getPort() {
- return port;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof DataStoreVO) || obj == null) {
- return false;
- }
- DataStoreVO that = (DataStoreVO)obj;
- return this.id == that.id;
- }
-
- @Override
- public int hashCode() {
- return new Long(id).hashCode();
- }
-
- @Override
- public String toString() {
- return new StringBuilder("Pool[").append(id).append("|").append(protocol).append("]").toString();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
deleted file mode 100644
index 8016559..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.db;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
-
-import com.cloud.utils.db.GenericDao;
-
-
-public interface PrimaryDataStoreDao extends GenericDao<DataStoreVO, Long> {
-
- /**
- * @param datacenterId -- the id of the datacenter (availability zone)
- */
- List<DataStoreVO> listByDataCenterId(long datacenterId);
-
- /**
- * @param datacenterId -- the id of the datacenter (availability zone)
- */
- List<DataStoreVO> listBy(long datacenterId, long podId, Long clusterId);
-
- /**
- * Set capacity of storage pool in bytes
- * @param id pool id.
- * @param capacity capacity in bytes
- */
- void updateCapacity(long id, long capacity);
-
- /**
- * Set available bytes of storage pool in bytes
- * @param id pool id.
- * @param available available capacity in bytes
- */
- void updateAvailable(long id, long available);
-
-
- DataStoreVO persist(DataStoreVO pool, Map<String, String> details);
-
- /**
- * Find pool by name.
- *
- * @param name name of pool.
- * @return the single StoragePoolVO
- */
- List<DataStoreVO> 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<DataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details);
-
- List<DataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
-
- /**
- * Find pool by UUID.
- *
- * @param uuid uuid of pool.
- * @return the single StoragePoolVO
- */
- DataStoreVO findPoolByUUID(String uuid);
-
- List<DataStoreVO> listByStorageHost(String hostFqdnOrIp);
-
- DataStoreVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
-
- List<DataStoreVO> 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<DataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid);
-
- List<DataStoreVO> listByStatus(DataStoreStatus status);
-
- long countPoolsByStatus(DataStoreStatus... statuses);
-
- List<DataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status);
-
- List<DataStoreVO> listPoolsByCluster(long clusterId);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index 4429499..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.db;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
-import org.springframework.stereotype.Component;
-
-import com.cloud.storage.StoragePoolDetailVO;
-import com.cloud.storage.dao.StoragePoolDetailsDao;
-import com.cloud.storage.dao.StoragePoolDetailsDaoImpl;
-import com.cloud.utils.component.ComponentLocator;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.GenericSearchBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.SearchCriteria.Func;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-public class PrimaryDataStoreDaoImpl extends GenericDaoBase<DataStoreVO, Long> implements PrimaryDataStoreDao {
- protected final SearchBuilder<DataStoreVO> AllFieldSearch;
- protected final SearchBuilder<DataStoreVO> DcPodSearch;
- protected final SearchBuilder<DataStoreVO> DcPodAnyClusterSearch;
- protected final SearchBuilder<DataStoreVO> DeleteLvmSearch;
- protected final GenericSearchBuilder<DataStoreVO, Long> StatusCountSearch;
-
-
-
- protected final 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.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 = ?";
-
- protected PrimaryDataStoreDaoImpl() {
- AllFieldSearch = createSearchBuilder();
- AllFieldSearch.and("name", AllFieldSearch.entity().getName(), SearchCriteria.Op.EQ);
- AllFieldSearch.and("uuid", AllFieldSearch.entity().getUuid(), SearchCriteria.Op.EQ);
- AllFieldSearch.and("datacenterId", AllFieldSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- AllFieldSearch.and("hostAddress", AllFieldSearch.entity().getHostAddress(), SearchCriteria.Op.EQ);
- AllFieldSearch.and("status",AllFieldSearch.entity().getStatus(),SearchCriteria.Op.EQ);
- AllFieldSearch.and("path", AllFieldSearch.entity().getPath(), SearchCriteria.Op.EQ);
- AllFieldSearch.and("podId", AllFieldSearch.entity().getPodId(), Op.EQ);
- AllFieldSearch.and("clusterId", AllFieldSearch.entity().getClusterId(), Op.EQ);
- AllFieldSearch.done();
-
- DcPodSearch = createSearchBuilder();
- DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL);
- DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
- DcPodSearch.cp();
- DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL);
- DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
- DcPodSearch.cp();
- DcPodSearch.done();
-
- DcPodAnyClusterSearch = createSearchBuilder();
- DcPodAnyClusterSearch.and("datacenterId", DcPodAnyClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
- DcPodAnyClusterSearch.and().op("nullpod", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.NULL);
- DcPodAnyClusterSearch.or("podId", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.EQ);
- DcPodAnyClusterSearch.cp();
- DcPodAnyClusterSearch.done();
-
- DeleteLvmSearch = createSearchBuilder();
- DeleteLvmSearch.and("ids", DeleteLvmSearch.entity().getId(), SearchCriteria.Op.IN);
- DeleteLvmSearch.and().op("LVM", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
- DeleteLvmSearch.or("Filesystem", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ);
- DeleteLvmSearch.cp();
- DeleteLvmSearch.done();
-
-
-
- StatusCountSearch = createSearchBuilder(Long.class);
- StatusCountSearch.and("status", StatusCountSearch.entity().getStatus(), SearchCriteria.Op.IN);
- StatusCountSearch.select(null, Func.COUNT, null);
- StatusCountSearch.done();
-
- _detailsDao = ComponentLocator.inject(StoragePoolDetailsDaoImpl.class);
- }
-
- @Override
- public List<DataStoreVO> findPoolByName(String name) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("name", name);
- return listIncludingRemovedBy(sc);
- }
-
-
- @Override
- public DataStoreVO findPoolByUUID(String uuid) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("uuid", uuid);
- return findOneIncludingRemovedBy(sc);
- }
-
-
-
- @Override
- public List<DataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("uuid", uuid);
- return listBy(sc);
- }
-
-
- @Override
- public List<DataStoreVO> listByDataCenterId(long datacenterId) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("datacenterId", datacenterId);
- return listBy(sc);
- }
-
-
- @Override
- public void updateAvailable(long id, long available) {
- DataStoreVO pool = createForUpdate(id);
- pool.setAvailableBytes(available);
- update(id, pool);
- }
-
-
- @Override
- public void updateCapacity(long id, long capacity) {
- DataStoreVO pool = createForUpdate(id);
- pool.setCapacityBytes(capacity);
- update(id, pool);
-
- }
-
- @Override
- public List<DataStoreVO> listByStorageHost(String hostFqdnOrIp) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("hostAddress", hostFqdnOrIp);
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- public List<DataStoreVO> listByStatus(DataStoreStatus status){
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("status", status);
- return listBy(sc);
- }
-
- @Override
- public List<DataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status){
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("status", status);
- sc.setParameters("datacenterId", dcId);
- return listBy(sc);
- }
-
- @Override
- public DataStoreVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("hostAddress", host);
- sc.setParameters("path", path);
- sc.setParameters("datacenterId", datacenterId);
- sc.setParameters("podId", podId);
- sc.setParameters("uuid", uuid);
-
- return findOneBy(sc);
- }
-
- @Override
- public List<DataStoreVO> listBy(long datacenterId, long podId, Long clusterId) {
- if (clusterId != null) {
- SearchCriteria<DataStoreVO> sc = DcPodSearch.create();
- sc.setParameters("datacenterId", datacenterId);
- sc.setParameters("podId", podId);
-
- sc.setParameters("cluster", clusterId);
- return listBy(sc);
- } else {
- SearchCriteria<DataStoreVO> sc = DcPodAnyClusterSearch.create();
- sc.setParameters("datacenterId", datacenterId);
- sc.setParameters("podId", podId);
- return listBy(sc);
- }
- }
-
- @Override
- public List<DataStoreVO> listPoolByHostPath(String host, String path) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("hostAddress", host);
- sc.setParameters("path", path);
-
- return listBy(sc);
- }
-
- public DataStoreVO listById(Integer id)
- {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("id", id);
-
- return findOneIncludingRemovedBy(sc);
- }
-
- @Override @DB
- public DataStoreVO persist(DataStoreVO 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<DataStoreVO> 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<DataStoreVO> pools = new ArrayList<DataStoreVO>();
- 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<DataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) {
- List<DataStoreVO> 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<DataStoreVO> filteredStoragePools = new ArrayList<DataStoreVO>(storagePools);
- for (DataStoreVO pool : storagePools) {
- /*
- if (shared != pool.isShared()) {
- filteredStoragePools.remove(pool);
- }*/
- }
-
- return filteredStoragePools;
- }
- }
-
- @Override
- @DB
- public List<String> searchForStoragePoolDetails(long poolId, String value){
-
- StringBuilder sql = new StringBuilder(FindPoolTagDetails);
-
- Transaction txn = Transaction.currentTxn();
- PreparedStatement pstmt = null;
- try {
- pstmt = txn.prepareAutoCloseStatement(sql.toString());
- pstmt.setLong(1, poolId);
- pstmt.setString(2, value);
-
- ResultSet rs = pstmt.executeQuery();
- List<String> tags = new ArrayList<String>();
-
- while (rs.next()) {
- tags.add(rs.getString("name"));
- }
- return tags;
- } catch (SQLException e) {
- throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e);
- }
-
- }
-
- @Override
- public void updateDetails(long poolId, Map<String, String> details) {
- if (details != null) {
- _detailsDao.update(poolId, details);
- }
- }
-
- @Override
- public Map<String, String> getDetails(long poolId) {
- return _detailsDao.getDetails(poolId);
- }
-
- @Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- super.configure(name, params);
- _detailsDao.configure("DetailsDao", params);
- return true;
- }
-
-
-
- @Override
- public long countPoolsByStatus( DataStoreStatus... statuses) {
- SearchCriteria<Long> sc = StatusCountSearch.create();
-
- sc.setParameters("status", (Object[])statuses);
-
- List<Long> rs = customSearchIncludingRemoved(sc, null);
- if (rs.size() == 0) {
- return 0;
- }
-
- return rs.get(0);
- }
-
- @Override
- public List<DataStoreVO> listPoolsByCluster(long clusterId) {
- SearchCriteria<DataStoreVO> sc = AllFieldSearch.create();
- sc.setParameters("clusterId", clusterId);
-
- return listBy(sc);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index cebcacf..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.db;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface PrimaryDataStoreProviderDao extends GenericDao<PrimaryDataStoreProviderVO, Long> {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index bd0571d..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderDaoImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.db;
-
-import 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/3dafea6e/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
deleted file mode 100644
index 0d15580..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreProviderVO.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-@Entity
-@Table(name="data_store_provider")
-public class PrimaryDataStoreProviderVO {
- @Id
- @TableGenerator(name="data_store_provider_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="data_store_provider_seq", allocationSize=1)
- @Column(name="id", updatable=false, nullable = false)
- private long id;
-
- public long getId() {
- return id;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
deleted file mode 100644
index 935f214..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.cloudstack.storage.datastore.driver;
-
-import java.util.List;
-
-import org.apache.cloudstack.storage.EndPoint;
-import org.apache.cloudstack.storage.command.CreateVolumeAnswer;
-import org.apache.cloudstack.storage.command.CreateVolumeCommand;
-import org.apache.cloudstack.storage.volume.Volume;
-import org.apache.cloudstack.storage.volume.VolumeInfo;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.agent.api.Answer;
-
-@Component
-public class DefaultPrimaryDataStoreDriverImpl implements
- PrimaryDataStoreDriver {
- private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreDriverImpl.class);
- @Override
- public boolean createVolume(Volume vol) {
- //The default driver will send createvolume command to one of hosts which can access its datastore
- List<EndPoint> endPoints = vol.getDataStore().getEndPoints();
- int retries = 3;
- VolumeInfo volInfo = new VolumeInfo(vol);
- CreateVolumeCommand createCmd = new CreateVolumeCommand(volInfo);
- Answer answer = null;
- int i = 0;
- boolean result = false;
-
- for (EndPoint ep : endPoints) {
- answer = ep.sendMessage(createCmd);
- if (answer == null) {
- if (i < retries) {
- s_logger.debug("create volume failed, retrying: " + i);
- }
- i++;
- } else {
- CreateVolumeAnswer volAnswer = (CreateVolumeAnswer)answer;
- vol.setUuid(volAnswer.getVolumeUuid());
- result = true;
- }
- }
-
- return result;
- }
-
- @Override
- public boolean deleteVolume(Volume vo) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String grantAccess(Volume vol, EndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean revokeAccess(Volume vol, EndPoint ep) {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
deleted file mode 100644
index a35118a..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.cloudstack.storage.datastore.driver;
-
-import org.apache.cloudstack.storage.EndPoint;
-import org.apache.cloudstack.storage.volume.Volume;
-
-public interface PrimaryDataStoreDriver {
- boolean createVolume(Volume vol);
- boolean deleteVolume(Volume vo);
- String grantAccess(Volume vol, EndPoint ep);
- boolean revokeAccess(Volume vol, EndPoint ep);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index fe4562c..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.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/3dafea6e/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
deleted file mode 100644
index 2e41a62..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/lifecycle/PrimaryDataStoreLifeCycle.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.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/3dafea6e/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
deleted file mode 100644
index 4949b2f..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreManagerImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.manager;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
-import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreProviderDao;
-import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
-import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider;
-import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProviderManager;
-import org.springframework.stereotype.Component;
-
-@Component
-public class DefaultPrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
- @Inject
- PrimaryDataStoreProviderDao dataStoreProviderDao;
- @Inject
- PrimaryDataStoreProviderManager providerManager;
- @Inject
- PrimaryDataStoreDao dataStoreDao;
- @Override
- public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
- DataStoreVO dataStoreVO = dataStoreDao.findById(dataStoreId);
- Long providerId = dataStoreVO.getStorageProviderId();
- PrimaryDataStoreProvider provider = providerManager.getDataStoreProvider(providerId);
- PrimaryDataStore dataStore = provider.getDataStore(dataStoreId);
- return dataStore;
- }
-
- @Override
- public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index b6ac34d..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreManager.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.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/3dafea6e/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
deleted file mode 100644
index 7ca9000..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-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 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 PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/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
deleted file mode 100644
index a346d32..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java
+++ /dev/null
@@ -1,9 +0,0 @@
-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(long dataStoreId);
- public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
deleted file mode 100644
index 4ef9a5c..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.cloudstack.storage.datastore.provider;
-
-public interface PrimaryDataStoreProviderManager {
- public PrimaryDataStoreProvider getDataStoreProvider(Long providerId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
deleted file mode 100644
index 0875553..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManagerImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.provider;
-
-import org.springframework.stereotype.Component;
-
-@Component
-public class PrimaryDataStoreProviderManagerImpl implements PrimaryDataStoreProviderManager {
-
- @Override
- public PrimaryDataStoreProvider getDataStoreProvider(Long providerId) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java
deleted file mode 100644
index 8f3fe8c..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.type;
-
-public interface DataStoreType {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
deleted file mode 100644
index 26d36de..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.type;
-
-import org.apache.cloudstack.storage.BaseType;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ISCSI extends BaseType implements DataStoreType {
- private final String type = "iscsi";
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
deleted file mode 100644
index 9340975..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.type;
-
-import org.apache.cloudstack.storage.BaseType;
-import org.springframework.stereotype.Component;
-
-@Component
-public class NetworkFileSystem extends BaseType implements DataStoreType {
- private final String type = "nfs";
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java b/platform/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
deleted file mode 100644
index c97a893..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.type;
-
-import org.apache.cloudstack.storage.BaseType;
-
-public class SharedMount extends BaseType implements DataStoreType {
- private final String type = "SharedMountPoint";
- @Override
- public String toString() {
- return type;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java b/platform/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
deleted file mode 100644
index 245af06..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/driver/AbstractStorageDriver.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.driver;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateStrategy;
-import com.cloud.agent.api.storage.DownloadProgressCommand;
-import com.cloud.agent.api.storage.DownloadProgressCommand.RequestType;
-import com.cloud.agent.api.storage.DownloadCommand;
-import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
-import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
-
-public abstract class AbstractStorageDriver implements DataStoreDriver {
- protected DataStore _ds;
- protected TemplateStrategy _ts;
-
- public AbstractStorageDriver(DataStore ds) {
- _ds = ds;
- _ts = ds.getTemplateStrategy();
- }
-
- public TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep) {
- PrimaryStorageDownloadCommand dcmd = new PrimaryStorageDownloadCommand(tp.getName(), tp.getUrl(), tp.getFormat(),
- 0, _ds.getId(), _ds.getUUID(), _ts.getDownloadWait());
- dcmd.setSecondaryStorageUrl(tp.getImageStorageUri());
- dcmd.setPrimaryStorageUrl(_ds.getURI());
- PrimaryStorageDownloadAnswer asw = (PrimaryStorageDownloadAnswer)ep.sendCommand(dcmd);
-
- tp.setLocalPath(asw.getInstallPath());
- return tp;
- }
-
- public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep, boolean freshDownload) {
-
- DownloadCommand dcmd =
- new DownloadCommand(_ds.getURI(), tp.getTemplate(), _ts.getMaxTemplateSizeInBytes());
- dcmd.setProxy(_ts.getHttpProxy());
- if (!freshDownload) {
- dcmd = new DownloadProgressCommand(dcmd, tp.getJobId(), RequestType.GET_OR_RESTART);
- }
-
- ep.sendCommand(dcmd);
- return tp;
- }
- /*
- public VolumeProfile createVolumeFromTemplate(VolumeProfile volProfile, TemplateProfile tp, DataStoreEndPoint ep) {
- CreateCommand cmd = new CreateCommand(volProfile, tp.getLocalPath(), _ds.getTO());
- CreateAnswer ans = (CreateAnswer)ep.sendCommand(cmd);
- VolumeTO created = ans.getVolume();
- DiskProfile diskProfile = new VolumeProfile(volProfile);
- diskProfile.setPath(created.getPath());
- diskProfile.setSize(created.getSize());
- return diskProfile;
- return null;
- }*/
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java b/platform/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
deleted file mode 100644
index 8e6fa1d..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/driver/DefaultNfsSecondaryDriver.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.driver;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.platform.subsystem.api.storage.VolumeProfile;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.storage.TemplateProfile;
-
-public class DefaultNfsSecondaryDriver extends AbstractStorageDriver {
-
- /**
- * @param ds
- */
- public DefaultNfsSecondaryDriver(DataStore ds) {
- super(ds);
- // TODO Auto-generated constructor stub
- }
-
- public String getDriverType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject create(DataObject obj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataStore dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject move(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean delete(DataObject obj) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java b/platform/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.java
deleted file mode 100644
index 811b4c7..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/driver/XenServerStorageDriver.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 org.apache.cloudstack.storage.driver;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStoreEndPoint;
-import org.apache.cloudstack.platform.subsystem.api.storage.VolumeProfile;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-
-public class XenServerStorageDriver extends AbstractStorageDriver {
- protected DataStore _ds;
- public XenServerStorageDriver(DataStore ds) {
- super(ds);
- _ds = ds;
- }
-
- public String getDriverType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject create(DataObject obj) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataStore dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject copy(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataObject move(DataObject src, DataObject dest) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Answer sendMessage(DataStoreEndPoint dsep, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean delete(DataObject obj) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile register(org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint ep) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public VolumeProfile createVolumeFromTemplate(VolumeProfile vol, org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile tp, DataStoreEndPoint dp) {
- // TODO Auto-generated method stub
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/ImageManager.java b/platform/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
deleted file mode 100644
index ffe0efe..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/ImageManager.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile;
-
-
-import com.cloud.api.commands.RegisterTemplateCmd;
-
-
-public interface ImageManager {
- TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds);
- TemplateProfile getProfile(long templateId);
- TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java b/platform/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
deleted file mode 100644
index 7c956da..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/ImageManagerImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image;
-
-import java.util.List;
-
-import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile;
-import org.apache.log4j.Logger;
-
-import com.cloud.api.commands.RegisterTemplateCmd;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.Storage.TemplateType;
-import com.cloud.storage.VMTemplateHostVO;
-import com.cloud.storage.VMTemplateStoragePoolVO;
-import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
-import com.cloud.storage.VMTemplateVO;
-import com.cloud.storage.dao.VMTemplateDao;
-import com.cloud.storage.dao.VMTemplatePoolDao;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.utils.EnumUtils;
-import com.cloud.utils.component.Inject;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class ImageManagerImpl implements ImageManager {
- private static final Logger s_logger = Logger.getLogger(ImageManagerImpl.class);
- @Inject
- VMTemplateDao _templateDao;
- @Inject
- VMTemplatePoolDao _templatePoolDao;
- @Inject
- DataCenterDao _dcDao;
-
- public boolean contains(VirtualMachineTemplate template, DataStore ds) {
- long templateId = template.getId();
- long poolId = ds.getId();
- VMTemplateStoragePoolVO templateStoragePoolRef = null;
- templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
- return templateStoragePoolRef == null ? false : true;
- }
-
- public TemplateProfile AssociateTemplateStoragePool(TemplateProfile tp, DataStore ds) {
- long templateId = tp.getTemplateId();
- long poolId = ds.getId();
- VMTemplateStoragePoolVO templateStoragePoolRef = null;
- long templateStoragePoolRefId;
-
- templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
- if (templateStoragePoolRef != null) {
- templateStoragePoolRef.setMarkedForGC(false);
- _templatePoolDao.update(templateStoragePoolRef.getId(), templateStoragePoolRef);
-
- if (templateStoragePoolRef.getDownloadState() == Status.DOWNLOADED) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Template " + templateId + " has already been downloaded to pool " + poolId);
- }
-
- tp.setLocalPath(templateStoragePoolRef.getInstallPath());
- tp.setTemplatePoolRefId(templateStoragePoolRef.getId());
- return tp;
- }
- }
-
- if (templateStoragePoolRef == null) {
- templateStoragePoolRef = new VMTemplateStoragePoolVO(poolId, templateId);
- try {
- templateStoragePoolRef = _templatePoolDao.persist(templateStoragePoolRef);
- templateStoragePoolRefId = templateStoragePoolRef.getId();
- } catch (Exception e) {
- s_logger.debug("Assuming we're in a race condition: " + e.getMessage());
- templateStoragePoolRef = _templatePoolDao.findByPoolTemplate(poolId, templateId);
- if (templateStoragePoolRef == null) {
- throw new CloudRuntimeException("Unable to persist a reference for pool " + poolId + " and template " + templateId);
- }
- templateStoragePoolRefId = templateStoragePoolRef.getId();
- }
- } else {
- templateStoragePoolRefId = templateStoragePoolRef.getId();
- }
- tp.setTemplatePoolRefId(templateStoragePoolRefId);
- return tp;
- }
-
- public TemplateProfile getProfile(long templateId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected TemplateProfile persistTemplate(TemplateProfile profile) {
- Long zoneId = profile.getZoneId();
- VMTemplateVO template = new VMTemplateVO(profile.getTemplateId(), profile.getName(), profile.getFormat(), profile.getIsPublic(),
- profile.getFeatured(), profile.getIsExtractable(), TemplateType.USER, profile.getUrl(), profile.getRequiresHVM(),
- profile.getBits(), profile.getAccountId(), profile.getCheckSum(), profile.getDisplayText(),
- profile.getPasswordEnabled(), profile.getGuestOsId(), profile.getBootable(), profile.getHypervisorType(), profile.getTemplateTag(),
- profile.getDetails(), profile.getSshKeyEnabled());
-
- if (zoneId == null || zoneId.longValue() == -1) {
- List<DataCenterVO> dcs = _dcDao.listAll();
-
- if (dcs.isEmpty()) {
- throw new CloudRuntimeException("No zones are present in the system, can't add template");
- }
-
- template.setCrossZones(true);
- for (DataCenterVO dc: dcs) {
- _templateDao.addTemplateToZone(template, dc.getId());
- }
- } else {
- _templateDao.addTemplateToZone(template, zoneId);
- }
-
- return getProfile(template.getId());
- }
-
- protected boolean parameterCheck(RegisterTemplateCmd cmd) {
- Long zoneId = cmd.getZoneId();
- if (zoneId == -1) {
- zoneId = null;
- }
-
- ImageFormat imgfmt = ImageFormat.valueOf(cmd.getFormat().toUpperCase());
- if (imgfmt == null) {
- throw new IllegalArgumentException("Image format is incorrect " + cmd.getFormat() + ". Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
- }
-
- // If a zoneId is specified, make sure it is valid
- if (zoneId != null) {
- DataCenterVO zone = _dcDao.findById(zoneId);
- if (zone == null) {
- throw new IllegalArgumentException("Please specify a valid zone.");
- }
- }
-
- List<VMTemplateVO> systemvmTmplts = _templateDao.listAllSystemVMTemplates();
- for (VMTemplateVO template : systemvmTmplts) {
- if (template.getName().equalsIgnoreCase(cmd.getTemplateName()) || template.getDisplayText().equalsIgnoreCase(cmd.getDisplayText())) {
- throw new IllegalArgumentException("Cannot use reserved names for templates");
- }
- }
-
- return true;
- }
-
- public TemplateProfile allocateTemplateInDB(RegisterTemplateCmd cmd) {
- parameterCheck(cmd);
- //TemplateProfile tp = new TemplateProfile(cmd);
- return persistTemplate(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/ImageMotionService.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/ImageMotionService.java b/platform/storage/src/org/apache/cloudstack/storage/image/ImageMotionService.java
deleted file mode 100644
index dd35e5d..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/ImageMotionService.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image;
-
-public interface ImageMotionService {
- boolean copyTemplate(String templateUri, String destTemplateUri);
- boolean copyIso(String isoUri, String destIsoUri);
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dafea6e/platform/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
----------------------------------------------------------------------
diff --git a/platform/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java b/platform/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
deleted file mode 100644
index f759d6b..0000000
--- a/platform/storage/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image;
-
-public interface ImageOrchestrator {
- void registerTemplate(long templateId);
- void registerSnapshot(long snapshotId);
- void registerVolume(long volumeId);
- void registerIso(long isoId);
-}