From b38648f27f8945d5c7c3926aaf7b2817209317fc Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Mon, 19 Feb 2024 09:55:47 +0100 Subject: [PATCH 1/3] 4.19 -> 4.19.1 and enlarge field --- .../upgrade/dao/Upgrade41900to41910.java | 11 +++++----- .../META-INF/db/schema-41900-41910.sql | 22 +++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41900to41910.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41900to41910.java index 5c57fb31fcf8..4cdd1c3364df 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41900to41910.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41900to41910.java @@ -16,9 +16,10 @@ // under the License. package com.cloud.upgrade.dao; +import org.apache.log4j.Logger; + import com.cloud.upgrade.SystemVmTemplateRegistration; import com.cloud.utils.exception.CloudRuntimeException; -import org.apache.log4j.Logger; import java.io.InputStream; import java.sql.Connection; @@ -73,6 +74,10 @@ private void addIndexes(Connection conn) { DbUpgradeUtils.addIndexIfNeeded(conn, "vm_stats", "vm_id"); } + private void initSystemVmTemplateRegistration() { + systemVmTemplateRegistration = new SystemVmTemplateRegistration(""); + } + @Override public void updateSystemVmTemplates(Connection conn) { LOG.debug("Updating System Vm template IDs"); @@ -83,8 +88,4 @@ public void updateSystemVmTemplates(Connection conn) { throw new CloudRuntimeException("Failed to find / register SystemVM template(s)"); } } - - private void initSystemVmTemplateRegistration() { - systemVmTemplateRegistration = new SystemVmTemplateRegistration(""); - } } diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql b/engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql new file mode 100644 index 000000000000..103c0b7ea5ee --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql @@ -0,0 +1,22 @@ +-- 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. + +--; +-- Schema upgrade from 4.19.0.0 to 4.19.1.0 +--; + +ALTER TABLE `cloud`.`vm_template` MODIFY COLUMN `url` VARCHAR(1024) DEFAULT NULL COMMENT 'the url where the template exists externally'; From 839331ea42af03d8a506f1ae3575afe91c9f7c5a Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Wed, 3 Apr 2024 10:16:15 +0200 Subject: [PATCH 2/3] move statement to the right file --- .../META-INF/db/schema-41900-41910.sql | 22 ------------------- .../META-INF/db/schema-41900to41910.sql | 4 ++++ 2 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql b/engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql deleted file mode 100644 index 103c0b7ea5ee..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-41900-41910.sql +++ /dev/null @@ -1,22 +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. - ---; --- Schema upgrade from 4.19.0.0 to 4.19.1.0 ---; - -ALTER TABLE `cloud`.`vm_template` MODIFY COLUMN `url` VARCHAR(1024) DEFAULT NULL COMMENT 'the url where the template exists externally'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql b/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql index e704d61d70c1..a7dc6042c5d4 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql @@ -30,3 +30,7 @@ UPDATE cloud_usage.quota_tariff SET usage_unit = 'IOPS', updated_on = NOW() WHERE effective_on = '2010-05-04 00:00:00' AND name IN ('VM_DISK_IO_READ', 'VM_DISK_IO_WRITE'); + +-- allow for bigger urls + +ALTER TABLE `cloud`.`vm_template` MODIFY COLUMN `url` VARCHAR(1024) DEFAULT NULL COMMENT 'the url where the template exists externally'; From 02b0df4fa2981b43a40adf60865368d2c058f9c6 Mon Sep 17 00:00:00 2001 From: dahn Date: Mon, 22 Apr 2024 10:40:20 +0200 Subject: [PATCH 3/3] eof --- .../src/main/resources/META-INF/db/schema-41900to41910.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql b/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql index 3bbf2c706b41..de9c62258c84 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql @@ -48,4 +48,4 @@ CREATE TABLE IF NOT EXISTS `cloud_usage`.`usage_vpc` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB CHARSET=utf8; -CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.cloud_usage', 'state', 'VARCHAR(100) DEFAULT NULL'); \ No newline at end of file +CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.cloud_usage', 'state', 'VARCHAR(100) DEFAULT NULL');