You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/04/25 00:20:32 UTC
git commit: updated refs/heads/object_store to 0a976d5
Updated Branches:
refs/heads/object_store f16f92dd1 -> 0a976d5fd
Change Upload table to store dataStoreId instead of hostId.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0a976d5f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0a976d5f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0a976d5f
Branch: refs/heads/object_store
Commit: 0a976d5fd508aa62e24e634c17c750bf48a3f85d
Parents: f16f92d
Author: Min Chen <mi...@citrix.com>
Authored: Wed Apr 24 15:20:09 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Wed Apr 24 15:20:09 2013 -0700
----------------------------------------------------------------------
api/src/com/cloud/storage/Upload.java | 2 +-
core/src/com/cloud/storage/UploadVO.java | 22 +++++++-------
.../src/com/cloud/storage/dao/UploadDaoImpl.java | 2 +-
.../cloud/storage/upload/UploadMonitorImpl.java | 6 ++--
setup/db/db/schema-410to420.sql | 10 +++++--
5 files changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a976d5f/api/src/com/cloud/storage/Upload.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/Upload.java b/api/src/com/cloud/storage/Upload.java
index ac3836c..69e1041 100755
--- a/api/src/com/cloud/storage/Upload.java
+++ b/api/src/com/cloud/storage/Upload.java
@@ -35,7 +35,7 @@ public interface Upload extends InternalIdentity, Identity {
FTP_UPLOAD, HTTP_DOWNLOAD
}
- long getHostId();
+ long getDataStoreId();
Date getCreated();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a976d5f/core/src/com/cloud/storage/UploadVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/UploadVO.java b/core/src/com/cloud/storage/UploadVO.java
index d761bf1..fe8b812 100755
--- a/core/src/com/cloud/storage/UploadVO.java
+++ b/core/src/com/cloud/storage/UploadVO.java
@@ -32,7 +32,6 @@ import javax.persistence.TemporalType;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.GenericDaoBase;
-import org.apache.cloudstack.api.InternalIdentity;
@Entity
@Table(name="upload")
@@ -45,7 +44,7 @@ public class UploadVO implements Upload {
private String uuid;
@Column(name="host_id")
- private long hostId;
+ private long storeId;
@Column(name="type_id")
private long typeId;
@@ -85,12 +84,12 @@ public class UploadVO implements Upload {
private String installPath;
@Override
- public long getHostId() {
- return hostId;
+ public long getDataStoreId() {
+ return storeId;
}
- public void setHostId(long hostId) {
- this.hostId = hostId;
+ public void setDataStoreId(long hostId) {
+ this.storeId = hostId;
}
@Override
@@ -99,7 +98,8 @@ public class UploadVO implements Upload {
}
- public String getUuid() {
+ @Override
+ public String getUuid() {
return uuid;
}
@@ -119,7 +119,7 @@ public class UploadVO implements Upload {
public UploadVO(long hostId, long templateId) {
super();
- this.hostId = hostId;
+ this.storeId = hostId;
this.typeId = templateId;
this.uuid = UUID.randomUUID().toString();
}
@@ -128,7 +128,7 @@ public class UploadVO implements Upload {
Status uploadState, Type type,
String uploadUrl, Mode mode) {
super();
- this.hostId = hostId;
+ this.storeId = hostId;
this.typeId = typeId;
this.lastUpdated = lastUpdated;
this.uploadState = uploadState;
@@ -142,7 +142,7 @@ public class UploadVO implements Upload {
Status uploadState, int uploadPercent, Type type,
Mode mode) {
super();
- this.hostId = hostId;
+ this.storeId = hostId;
this.typeId = typeId;
this.lastUpdated = lastUpdated;
this.uploadState = uploadState;
@@ -182,7 +182,7 @@ public class UploadVO implements Upload {
public boolean equals(Object obj) {
if (obj instanceof UploadVO) {
UploadVO other = (UploadVO)obj;
- return (this.typeId==other.getTypeId() && this.hostId==other.getHostId() && this.type == other.getType());
+ return (this.typeId==other.getTypeId() && this.storeId==other.getDataStoreId() && this.type == other.getType());
}
return false;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a976d5f/server/src/com/cloud/storage/dao/UploadDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/dao/UploadDaoImpl.java b/server/src/com/cloud/storage/dao/UploadDaoImpl.java
index 31fad43..4c6da39 100755
--- a/server/src/com/cloud/storage/dao/UploadDaoImpl.java
+++ b/server/src/com/cloud/storage/dao/UploadDaoImpl.java
@@ -54,7 +54,7 @@ public class UploadDaoImpl extends GenericDaoBase<UploadVO, Long> implements Upl
typeUploadStatusSearch.done();
typeHostAndUploadStatusSearch = createSearchBuilder();
- typeHostAndUploadStatusSearch.and("host_id", typeHostAndUploadStatusSearch.entity().getHostId(), SearchCriteria.Op.EQ);
+ typeHostAndUploadStatusSearch.and("host_id", typeHostAndUploadStatusSearch.entity().getDataStoreId(), SearchCriteria.Op.EQ);
typeHostAndUploadStatusSearch.and("upload_state", typeHostAndUploadStatusSearch.entity().getUploadState(), SearchCriteria.Op.EQ);
typeHostAndUploadStatusSearch.done();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a976d5f/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
index 0d0883e..9eac227 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
@@ -282,7 +282,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
// Create Symlink at ssvm
String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4) ; // last 4 characters of the path specify the format like .vhd
- DataStore secStore = this.storeMgr.getDataStore(ApiDBUtils.findUploadById(uploadId).getHostId(), DataStoreRole.Image);
+ DataStore secStore = this.storeMgr.getDataStore(ApiDBUtils.findUploadById(uploadId).getDataStoreId(), DataStoreRole.Image);
EndPoint ep = _epSelector.select(secStore);
if( ep == null ) {
errorString = "There is no secondary storage VM for secondary storage host " + secStore.getName();
@@ -459,14 +459,14 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
for (UploadVO extractJob : extractJobs){
if( getTimeDiff(extractJob.getLastUpdated()) > EXTRACT_URL_LIFE_LIMIT_IN_SECONDS ){
String path = extractJob.getInstallPath();
- DataStore secStore = this.storeMgr.getDataStore(extractJob.getHostId(), DataStoreRole.Image);
+ DataStore secStore = this.storeMgr.getDataStore(extractJob.getDataStoreId(), DataStoreRole.Image);
// Would delete the symlink for the Type and if Type == VOLUME then also the volume
DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path, extractJob.getType(),extractJob.getUploadUrl(), ((ImageStoreVO)secStore).getParent());
EndPoint ep = _epSelector.select(secStore);
if( ep == null ) {
- s_logger.warn("UploadMonitor cleanup: There is no secondary storage VM for secondary storage host " + extractJob.getHostId());
+ s_logger.warn("UploadMonitor cleanup: There is no secondary storage VM for secondary storage host " + extractJob.getDataStoreId());
continue; //TODO: why continue? why not break?
}
if (s_logger.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a976d5f/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 9519266..7e3704d 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -136,7 +136,7 @@ CREATE TABLE `cloud`.`template_store_ref` (
`destroyed` tinyint(1) COMMENT 'indicates whether the template_store entry was destroyed by the user or not',
`is_copy` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates whether this was copied ',
PRIMARY KEY (`id`),
--- CONSTRAINT `fk_template_store_ref__store_id` FOREIGN KEY `fk_template_store_ref__store_id` (`store_id`) REFERENCES `image_data_store` (`id`) ON DELETE CASCADE,
+-- CONSTRAINT `fk_template_store_ref__store_id` FOREIGN KEY `fk_template_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE,
INDEX `i_template_store_ref__store_id`(`store_id`),
CONSTRAINT `fk_template_store_ref__template_id` FOREIGN KEY `fk_template_store_ref__template_id` (`template_id`) REFERENCES `vm_template` (`id`),
INDEX `i_template_store_ref__template_id`(`template_id`)
@@ -149,6 +149,10 @@ CREATE TABLE `cloud`.`template_store_ref` (
-- ALTER TABLE `cloud`.`snapshots` DROP COLUMN `s3_id`;
-- ALTER TABLE `cloud`.`snapshots` DROP COLUMN `sechost_id`;
+-- change upload host_id FK to point to image_store table
+ALTER TABLE `cloud`.`upload` DROP FOREIGN KEY `fk_upload__host_id`;
+ALTER TABLE `cloud`.`upload` ADD CONSTRAINT `fk_upload__store_id` FOREIGN KEY(`host_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE;
+
CREATE TABLE `cloud`.`snapshot_store_ref` (
`id` bigint unsigned NOT NULL auto_increment,
`store_id` bigint unsigned NOT NULL,
@@ -162,7 +166,7 @@ CREATE TABLE `cloud`.`snapshot_store_ref` (
`state` varchar(255) NOT NULL,
`destroyed` tinyint(1) COMMENT 'indicates whether the snapshot_store entry was destroyed by the user or not',
PRIMARY KEY (`id`),
- CONSTRAINT `fk_snapshot_store_ref__store_id` FOREIGN KEY `fk_snapshot_store_ref__store_id` (`store_id`) REFERENCES `image_data_store` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk_snapshot_store_ref__store_id` FOREIGN KEY `fk_snapshot_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE,
INDEX `i_snapshot_store_ref__store_id`(`store_id`),
CONSTRAINT `fk_snapshot_store_ref__snapshot_id` FOREIGN KEY `fk_snapshot_store_ref__snapshot_id` (`snapshot_id`) REFERENCES `snapshots` (`id`),
INDEX `i_snapshot_store_ref__snapshot_id`(`snapshot_id`)
@@ -189,7 +193,7 @@ CREATE TABLE `cloud`.`volume_store_ref` (
`format` varchar(32) NOT NULL COMMENT 'format for the volume',
`destroyed` tinyint(1) COMMENT 'indicates whether the volume_host entry was destroyed by the user or not',
PRIMARY KEY (`id`),
- CONSTRAINT `fk_volume_store_ref__store_id` FOREIGN KEY `fk_volume_store_ref__store_id` (`store_id`) REFERENCES `image_data_store` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk_volume_store_ref__store_id` FOREIGN KEY `fk_volume_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE,
INDEX `i_volume_store_ref__store_id`(`store_id`),
CONSTRAINT `fk_volume_store_ref__volume_id` FOREIGN KEY `fk_volume_store_ref__volume_id` (`volume_id`) REFERENCES `volumes` (`id`),
INDEX `i_volume_store_ref__volume_id`(`volume_id`)