Skip to content

Commit 13a2c77

Browse files
Merge branch '4.20' into 4.22
2 parents 83f705d + 1fc4cb9 commit 13a2c77

File tree

32 files changed

+1510
-1090
lines changed

32 files changed

+1510
-1090
lines changed

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 232 additions & 233 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
package com.cloud.upgrade;
1818

19+
import java.util.Arrays;
1920
import java.util.LinkedList;
2021
import java.util.List;
2122
import java.util.Map;
@@ -96,7 +97,9 @@ public DbUpgrade[] getPath(final CloudStackVersion fromVersion, final CloudStack
9697
// we cannot find the version specified, so get the
9798
// most recent one immediately before this version
9899
if (!contains(fromVersion)) {
99-
return getPath(getRecentVersion(fromVersion), toVersion);
100+
DbUpgrade[] dbUpgrades = getPath(getRecentVersion(fromVersion), toVersion);
101+
return Arrays.stream(dbUpgrades).filter(up -> CloudStackVersion.compare(up.getUpgradedVersion(), fromVersion.toString()) > 0)
102+
.toArray(DbUpgrade[]::new);
100103
}
101104

102105
final Predicate<? super VersionNode> predicate;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ public void setUpdated(Date updated) {
315315
public static final List<Pair<Hypervisor.HypervisorType, CPU.CPUArch>> hypervisorList = Arrays.asList(
316316
new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.amd64),
317317
new Pair<>(Hypervisor.HypervisorType.KVM, CPU.CPUArch.arm64),
318-
new Pair<>(Hypervisor.HypervisorType.VMware, null),
319-
new Pair<>(Hypervisor.HypervisorType.XenServer, null),
320-
new Pair<>(Hypervisor.HypervisorType.Hyperv, null),
321-
new Pair<>(Hypervisor.HypervisorType.LXC, null),
322-
new Pair<>(Hypervisor.HypervisorType.Ovm3, null)
318+
new Pair<>(Hypervisor.HypervisorType.VMware, CPU.CPUArch.amd64),
319+
new Pair<>(Hypervisor.HypervisorType.XenServer, CPU.CPUArch.amd64),
320+
new Pair<>(Hypervisor.HypervisorType.Hyperv, CPU.CPUArch.amd64),
321+
new Pair<>(Hypervisor.HypervisorType.LXC, CPU.CPUArch.amd64),
322+
new Pair<>(Hypervisor.HypervisorType.Ovm3, CPU.CPUArch.amd64)
323323
);
324324

325325
public static final Map<String, MetadataTemplateDetails> NewTemplateMap = new HashMap<>();

engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade42020to42030.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,4 @@ public void performDataMigration(Connection conn) {
5757
public InputStream[] getCleanupScripts() {
5858
return null;
5959
}
60-
61-
@Override
62-
public void updateSystemVmTemplates(Connection conn) {
63-
}
6460
}

engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.account', 'api_key_access', 'boolean
3131
CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.account', 'api_key_access', 'boolean DEFAULT NULL COMMENT "is api key access allowed for the account" ');
3232

3333
-- Create a new group for Usage Server related configurations
34-
INSERT INTO `cloud`.`configuration_group` (`name`, `description`, `precedence`) VALUES ('Usage Server', 'Usage Server related configuration', 9);
34+
INSERT IGNORE INTO `cloud`.`configuration_group` (`name`, `description`, `precedence`) VALUES ('Usage Server', 'Usage Server related configuration', 9);
3535
UPDATE `cloud`.`configuration_subgroup` set `group_id` = (SELECT `id` FROM `cloud`.`configuration_group` WHERE `name` = 'Usage Server'), `precedence` = 1 WHERE `name`='Usage';
3636
UPDATE `cloud`.`configuration` SET `group_id` = (SELECT `id` FROM `cloud`.`configuration_group` WHERE `name` = 'Usage Server') where `subgroup_id` = (SELECT `id` FROM `cloud`.`configuration_subgroup` WHERE `name` = 'Usage');
3737

engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import com.cloud.upgrade.dao.Upgrade41120to41200;
4545
import com.cloud.upgrade.dao.Upgrade41510to41520;
4646
import com.cloud.upgrade.dao.Upgrade41610to41700;
47+
import com.cloud.upgrade.dao.Upgrade42010to42100;
4748
import com.cloud.upgrade.dao.Upgrade452to453;
4849
import com.cloud.upgrade.dao.Upgrade453to460;
4950
import com.cloud.upgrade.dao.Upgrade460to461;
@@ -380,4 +381,23 @@ public void isNotStandalone() throws SQLException {
380381
assertFalse("DatabaseUpgradeChecker should not be a standalone component", checker.isStandalone());
381382
}
382383

384+
@Test
385+
public void testCalculateUpgradePath42010to42100() {
386+
387+
final CloudStackVersion dbVersion = CloudStackVersion.parse("4.20.1.0");
388+
assertNotNull(dbVersion);
389+
390+
final CloudStackVersion currentVersion = CloudStackVersion.parse("4.21.0.0");
391+
assertNotNull(currentVersion);
392+
393+
final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker();
394+
final DbUpgrade[] upgrades = checker.calculateUpgradePath(dbVersion, currentVersion);
395+
396+
assertNotNull(upgrades);
397+
assertEquals(1, upgrades.length);
398+
assertTrue(upgrades[0] instanceof Upgrade42010to42100);
399+
400+
assertArrayEquals(new String[]{"4.20.1.0", "4.21.0.0"}, upgrades[0].getUpgradableVersionRange());
401+
assertEquals(currentVersion.toString(), upgrades[0].getUpgradedVersion());
402+
}
383403
}

engine/schema/src/test/java/com/cloud/upgrade/SystemVmTemplateRegistrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public void test_parseMetadataFile_success() {
155155
templateDetails =
156156
SystemVmTemplateRegistration.NewTemplateMap.get("vmware");
157157
assertNotNull(templateDetails);
158-
assertNull(templateDetails.getArch());
158+
assertEquals(CPU.CPUArch.amd64, templateDetails.getArch());
159159
assertEquals(Hypervisor.HypervisorType.VMware, templateDetails.getHypervisorType());
160160
}
161161

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
<!--
2-
Licensed to the Apache Software Foundation (ASF) under one
3-
or more contributor license agreements. See the NOTICE file
4-
distributed with this work for additional information
5-
regarding copyright ownership. The ASF licenses this file
6-
to you under the Apache License, Version 2.0 (the
7-
"License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
9-
10-
http://www.apache.org/licenses/LICENSE-2.0
11-
12-
Unless required by applicable law or agreed to in writing,
13-
software distributed under the License is distributed on an
14-
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
KIND, either express or implied. See the License for the
16-
specific language governing permissions and limitations
17-
under the License.
18-
-->
19-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21-
<modelVersion>4.0.0</modelVersion>
22-
<parent>
23-
<groupId>org.apache.cloudstack</groupId>
24-
<artifactId>cloudstack-plugins</artifactId>
25-
<version>4.22.1.0-SNAPSHOT</version>
26-
<relativePath>../../pom.xml</relativePath>
27-
</parent>
28-
<artifactId>cloud-plugin-hypervisor-baremetal</artifactId>
29-
<name>Apache CloudStack Plugin - Hypervisor Baremetal</name>
30-
<dependencies>
31-
<dependency>
32-
<groupId>commons-lang</groupId>
33-
<artifactId>commons-lang</artifactId>
34-
</dependency>
35-
<dependency>
36-
<groupId>javax.xml.bind</groupId>
37-
<artifactId>jaxb-api</artifactId>
38-
<version>${cs.jaxb.version}</version>
39-
</dependency>
40-
<dependency>
41-
<groupId>com.sun.xml.bind</groupId>
42-
<artifactId>jaxb-core</artifactId>
43-
<version>${cs.jaxb.version}</version>
44-
</dependency>
45-
<dependency>
46-
<groupId>com.sun.xml.bind</groupId>
47-
<artifactId>jaxb-impl</artifactId>
48-
<version>${cs.jaxb.impl.version}</version>
49-
</dependency>
50-
</dependencies>
51-
</project>
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.apache.cloudstack</groupId>
24+
<artifactId>cloudstack-plugins</artifactId>
25+
<version>4.22.1.0-SNAPSHOT</version>
26+
<relativePath>../../pom.xml</relativePath>
27+
</parent>
28+
<artifactId>cloud-plugin-hypervisor-baremetal</artifactId>
29+
<name>Apache CloudStack Plugin - Hypervisor Baremetal</name>
30+
<dependencies>
31+
<dependency>
32+
<groupId>commons-lang</groupId>
33+
<artifactId>commons-lang</artifactId>
34+
</dependency>
35+
<dependency>
36+
<groupId>javax.xml.bind</groupId>
37+
<artifactId>jaxb-api</artifactId>
38+
<version>${cs.jaxb.version}</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.sun.xml.bind</groupId>
42+
<artifactId>jaxb-core</artifactId>
43+
<version>${cs.jaxb.version}</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>com.sun.xml.bind</groupId>
47+
<artifactId>jaxb-impl</artifactId>
48+
<version>${cs.jaxb.impl.version}</version>
49+
</dependency>
50+
</dependencies>
51+
</project>

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterResourceModifierActionWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ protected FirewallRule removeSshFirewallRule(final IpAddress publicIp, final lon
548548
List<FirewallRuleVO> firewallRules = firewallRulesDao.listByIpPurposeProtocolAndNotRevoked(publicIp.getId(), FirewallRule.Purpose.Firewall, NetUtils.TCP_PROTO);
549549
for (FirewallRuleVO firewallRule : firewallRules) {
550550
PortForwardingRuleVO pfRule = portForwardingRulesDao.findByNetworkAndPorts(networkId, firewallRule.getSourcePortStart(), firewallRule.getSourcePortEnd());
551-
if (firewallRule.getSourcePortStart() == CLUSTER_NODES_DEFAULT_START_SSH_PORT || (Objects.nonNull(pfRule) && pfRule.getDestinationPortStart() == DEFAULT_SSH_PORT) ) {
551+
if (Objects.equals(firewallRule.getSourcePortStart(), CLUSTER_NODES_DEFAULT_START_SSH_PORT) || (Objects.nonNull(pfRule) && pfRule.getDestinationPortStart() == DEFAULT_SSH_PORT) ) {
552552
rule = firewallRule;
553553
firewallService.revokeIngressFwRule(firewallRule.getId(), true);
554554
logger.debug("The SSH firewall rule {} with the id {} was revoked", firewallRule.getName(), firewallRule.getId());

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterScaleWorker.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ private void scaleKubernetesClusterIsolatedNetworkRules(final List<Long> cluster
139139

140140
// Remove existing SSH firewall rules
141141
FirewallRule firewallRule = removeSshFirewallRule(publicIp, network.getId());
142+
int existingFirewallRuleSourcePortEnd;
142143
if (firewallRule == null) {
143-
throw new ManagementServerException("Firewall rule for node SSH access can't be provisioned");
144+
logger.warn("SSH firewall rule not found for Kubernetes cluster: {}. It may have been manually deleted or modified.", kubernetesCluster.getName());
145+
existingFirewallRuleSourcePortEnd = CLUSTER_NODES_DEFAULT_START_SSH_PORT + clusterVMIds.size() - 1;
146+
} else {
147+
existingFirewallRuleSourcePortEnd = firewallRule.getSourcePortEnd();
144148
}
145-
int existingFirewallRuleSourcePortEnd = firewallRule.getSourcePortEnd();
149+
146150
try {
147151
removePortForwardingRules(publicIp, network, owner, CLUSTER_NODES_DEFAULT_START_SSH_PORT, existingFirewallRuleSourcePortEnd);
148152
} catch (ResourceUnavailableException e) {

0 commit comments

Comments
 (0)