Skip to content

Commit 6a1355a

Browse files
author
Pearl Dsilva
committed
Update nw_rate & mc_rate to int unsigned to allow rates > 65Gbps
1 parent 21b2025 commit 6a1355a

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
import com.cloud.upgrade.dao.Upgrade42010to42100;
9393
import com.cloud.upgrade.dao.Upgrade42100to42200;
9494
import com.cloud.upgrade.dao.Upgrade42200to42210;
95+
import com.cloud.upgrade.dao.Upgrade42210to42220;
9596
import com.cloud.upgrade.dao.Upgrade420to421;
9697
import com.cloud.upgrade.dao.Upgrade421to430;
9798
import com.cloud.upgrade.dao.Upgrade430to440;
@@ -242,6 +243,7 @@ public DatabaseUpgradeChecker() {
242243
.next("4.20.1.0", new Upgrade42010to42100())
243244
.next("4.21.0.0", new Upgrade42100to42200())
244245
.next("4.22.0.0", new Upgrade42200to42210())
246+
.next("4.22.1.0", new Upgrade42210to42220())
245247
.build();
246248
}
247249

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.upgrade.dao;
18+
19+
import com.cloud.utils.exception.CloudRuntimeException;
20+
21+
import java.io.InputStream;
22+
import java.sql.Connection;
23+
24+
public class Upgrade42210to42220 extends DbUpgradeAbstractImpl implements DbUpgrade {
25+
26+
@Override
27+
public String[] getUpgradableVersionRange() {
28+
return new String[] {"4.22.1.0", "4.22.2.0"};
29+
}
30+
31+
@Override
32+
public String getUpgradedVersion() {
33+
return "4.22.2.0";
34+
}
35+
36+
@Override
37+
public InputStream[] getPrepareScripts() {
38+
final String scriptFile = "META-INF/db/schema-42210to42220.sql";
39+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
40+
if (script == null) {
41+
throw new CloudRuntimeException("Unable to find " + scriptFile);
42+
}
43+
return new InputStream[] {script};
44+
}
45+
46+
@Override
47+
public void performDataMigration(Connection conn) {
48+
}
49+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
--;
19+
-- Schema upgrade from 4.22.1.0 to 4.22.2.0
20+
--;
21+
22+
-- Change nw_rate and mc_rate column types from smallint unsigned to int unsigned
23+
-- to align with the Java Integer type and support larger rate values
24+
ALTER TABLE `cloud`.`service_offering`
25+
MODIFY COLUMN `nw_rate` int unsigned DEFAULT 200 COMMENT 'network rate throttle mbits/s',
26+
MODIFY COLUMN `mc_rate` int unsigned DEFAULT 10 COMMENT 'mcast rate throttle mbits/s';
27+
28+
ALTER TABLE `cloud`.`network_offerings`
29+
MODIFY COLUMN `nw_rate` int unsigned COMMENT 'network rate throttle mbits/s',
30+
MODIFY COLUMN `mc_rate` int unsigned COMMENT 'mcast rate throttle mbits/s';

0 commit comments

Comments
 (0)