You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/09/22 04:11:21 UTC
[cloudstack] branch master updated: schema: change upgrade path to
4.14 (from 4.13) and intensify check (#4331)
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new cfbb4ff schema: change upgrade path to 4.14 (from 4.13) and intensify check (#4331)
cfbb4ff is described below
commit cfbb4ff3dd5a53f55040d3345b96bc7e97964eb2
Author: Pearl Dsilva <pe...@gmail.com>
AuthorDate: Tue Sep 22 09:40:51 2020 +0530
schema: change upgrade path to 4.14 (from 4.13) and intensify check (#4331)
* change upgrade path to 4.14 (from 4.13) and intensify check
* extracted check
Co-authored-by: Pearl Dsilva <pe...@shapeblue.com>
---
.../resources/META-INF/db/schema-41310to41400.sql | 27 ----------------------
.../resources/META-INF/db/schema-41400to41500.sql | 26 +++++++++++++++++++++
.../resource/NfsSecondaryStorageResource.java | 16 +++++++++++--
3 files changed, 40 insertions(+), 29 deletions(-)
diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql b/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql
index a1a2e74..baa7bcf 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql
@@ -53,33 +53,6 @@ ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `backup_offering_id` bigint unsigne
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `backup_external_id` varchar(255) DEFAULT NULL COMMENT 'ID of external backup job or container if any';
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `backup_volumes` text DEFAULT NULL COMMENT 'details of backedup volumes';
-ALTER TABLE `cloud`.`image_store` ADD COLUMN `readonly` boolean DEFAULT false COMMENT 'defines status of image store';
-
-ALTER VIEW `cloud`.`image_store_view` AS
- select
- image_store.id,
- image_store.uuid,
- image_store.name,
- image_store.image_provider_name,
- image_store.protocol,
- image_store.url,
- image_store.scope,
- image_store.role,
- image_store.readonly,
- image_store.removed,
- data_center.id data_center_id,
- data_center.uuid data_center_uuid,
- data_center.name data_center_name,
- image_store_details.name detail_name,
- image_store_details.value detail_value
- from
- `cloud`.`image_store`
- left join
- `cloud`.`data_center` ON image_store.data_center_id = data_center.id
- left join
- `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id;
-
-
CREATE TABLE IF NOT EXISTS `cloud`.`backups` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`uuid` varchar(40) NOT NULL UNIQUE,
diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql b/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
index ab715f3..20ed35c 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
@@ -194,3 +194,29 @@ INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hype
-- Copy XenServer 8.0 hypervisor guest OS mappings to XenServer8.1
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '8.1.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.0.0';
+
+ALTER TABLE `cloud`.`image_store` ADD COLUMN `readonly` boolean DEFAULT false COMMENT 'defines status of image store';
+
+ALTER VIEW `cloud`.`image_store_view` AS
+ select
+ image_store.id,
+ image_store.uuid,
+ image_store.name,
+ image_store.image_provider_name,
+ image_store.protocol,
+ image_store.url,
+ image_store.scope,
+ image_store.role,
+ image_store.readonly,
+ image_store.removed,
+ data_center.id data_center_id,
+ data_center.uuid data_center_uuid,
+ data_center.name data_center_name,
+ image_store_details.name detail_name,
+ image_store_details.value detail_value
+ from
+ `cloud`.`image_store`
+ left join
+ `cloud`.`data_center` ON image_store.data_center_id = data_center.id
+ left join
+ `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id;
diff --git a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 0832ab6..dd002a9 100644
--- a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -1044,13 +1044,25 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
}
}
+ private boolean shouldPerformDataMigration(DataTO srcData, DataTO destData) {
+ DataStoreTO srcDataStore = srcData.getDataStore();
+ DataStoreTO destDataStore = destData.getDataStore();
+ if (DataStoreRole.Image == srcDataStore.getRole() && DataStoreRole.Image == destDataStore.getRole() &&
+ srcDataStore instanceof NfsTO && destDataStore instanceof NfsTO &&
+ ((srcData.getObjectType() == DataObjectType.TEMPLATE && destData.getObjectType() == DataObjectType.TEMPLATE) ||
+ (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.SNAPSHOT) ||
+ (srcData.getObjectType() == DataObjectType.VOLUME && destData.getObjectType() == DataObjectType.VOLUME))) {
+ return true;
+ }
+ return false;
+ }
+
protected Answer execute(CopyCommand cmd) {
DataTO srcData = cmd.getSrcTO();
DataTO destData = cmd.getDestTO();
DataStoreTO srcDataStore = srcData.getDataStore();
DataStoreTO destDataStore = destData.getDataStore();
-
- if (DataStoreRole.Image == srcDataStore.getRole() && DataStoreRole.Image == destDataStore.getRole()) {
+ if (shouldPerformDataMigration(srcData, destData)) {
return copyFromNfsToNfs(cmd);
}