Skip to content

Commit b0bf069

Browse files
committed
Merge branch '4.16' into main
2 parents 3f79436 + bdab514 commit b0bf069

File tree

11 files changed

+164
-11
lines changed

11 files changed

+164
-11
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
cloudstack (4.16.1.0-SNAPSHOT) unstable; urgency=low
2+
3+
* Update the version to 4.16.1.0-SNAPSHOT
4+
5+
-- the Apache CloudStack project <dev@cloudstack.apache.org> Wed, 10 Nov 2021 11:31:57 -0300
6+
17
cloudstack (4.16.0.0) unstable; urgency=low
28

39
* Update the version to 4.16.0.0

engine/schema/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
<source>
7676
def projectVersion = project.version
7777
String[] versionParts = projectVersion.tokenize('.')
78-
pom.properties['cs.version'] = versionParts[0] + "." + versionParts[1]
79-
pom.properties['patch.version'] = versionParts[2]
78+
pom.properties['cs.version'] = "4.16"
79+
pom.properties['patch.version'] = "0"
8080
</source>
8181
</configuration>
8282
</execution>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import javax.inject.Inject;
3131

3232
import com.cloud.upgrade.dao.Upgrade41510to41520;
33+
import com.cloud.upgrade.dao.Upgrade41600to41610;
3334
import org.apache.cloudstack.utils.CloudStackVersion;
3435
import org.apache.commons.lang.StringUtils;
3536
import org.apache.log4j.Logger;
@@ -201,6 +202,7 @@ public DatabaseUpgradeChecker() {
201202
.next("4.15.0.0", new Upgrade41500to41510())
202203
.next("4.15.1.0", new Upgrade41510to41520())
203204
.next("4.15.2.0", new Upgrade41520to41600())
205+
.next("4.16.0.0", new Upgrade41600to41610())
204206
.build();
205207
}
206208

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
5656
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
5757
import org.apache.commons.codec.digest.DigestUtils;
58+
import org.apache.commons.lang3.StringUtils;
5859
import org.apache.log4j.Logger;
5960
import org.ini4j.Ini;
6061

@@ -120,6 +121,8 @@ public class SystemVmTemplateRegistration {
120121
@Inject
121122
ConfigurationDao configurationDao;
122123

124+
private String systemVmTemplateVersion;
125+
123126
public SystemVmTemplateRegistration() {
124127
dataCenterDao = new DataCenterDaoImpl();
125128
vmTemplateDao = new VMTemplateDaoImpl();
@@ -131,6 +134,21 @@ public SystemVmTemplateRegistration() {
131134
configurationDao = new ConfigurationDaoImpl();
132135
}
133136

137+
/**
138+
* Convenience constructor method to use when there is no system VM template change for a new version.
139+
*/
140+
public SystemVmTemplateRegistration(String systemVmTemplateVersion) {
141+
this();
142+
this.systemVmTemplateVersion = systemVmTemplateVersion;
143+
}
144+
145+
public String getSystemVmTemplateVersion() {
146+
if (StringUtils.isEmpty(systemVmTemplateVersion)) {
147+
return String.format("%s.%s", CS_MAJOR_VERSION, CS_TINY_VERSION);
148+
}
149+
return systemVmTemplateVersion;
150+
}
151+
134152
private static class SystemVMTemplateDetails {
135153
Long id;
136154
String uuid;
@@ -658,7 +676,7 @@ public void registerTemplate(Pair<Hypervisor.HypervisorType, String> hypervisorA
658676
hypervisorImageFormat.get(hypervisor), hypervisorGuestOsMap.get(hypervisor), storeUrlAndId.second(), null, filePath, true);
659677
Map<String, String> configParams = new HashMap<>();
660678
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.first()), hypervisorAndTemplateName.second());
661-
configParams.put("minreq.sysvmtemplate.version", CS_MAJOR_VERSION + "." + CS_TINY_VERSION);
679+
configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion());
662680
updateConfigurationParams(configParams);
663681
updateSystemVMEntries(templateId, hypervisorAndTemplateName.first());
664682
} catch (Exception e) {
@@ -809,7 +827,7 @@ private void updateRegisteredTemplateDetails(Long templateId, Map.Entry<Hypervis
809827
// Change value of global configuration parameter router.template.* for the corresponding hypervisor and minreq.sysvmtemplate.version for the ACS version
810828
Map<String, String> configParams = new HashMap<>();
811829
configParams.put(RouterTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()), hypervisorAndTemplateName.getValue());
812-
configParams.put("minreq.sysvmtemplate.version", CS_MAJOR_VERSION + "." + CS_TINY_VERSION);
830+
configParams.put("minreq.sysvmtemplate.version", getSystemVmTemplateVersion());
813831
updateConfigurationParams(configParams);
814832
}
815833

@@ -854,11 +872,11 @@ public void doInTransactionWithoutResult(final TransactionStatus status) {
854872
registerTemplates(hypervisorsListInUse);
855873
break;
856874
} catch (final Exception e) {
857-
throw new CloudRuntimeException(String.format("%s.%s %s SystemVm template not found. Cannot upgrade system Vms", CS_MAJOR_VERSION, CS_TINY_VERSION, hypervisorAndTemplateName.getKey()));
875+
throw new CloudRuntimeException(String.format("%s %s SystemVm template not found. Cannot upgrade system Vms", getSystemVmTemplateVersion(), hypervisorAndTemplateName.getKey()));
858876
}
859877
} else {
860-
LOGGER.warn(String.format("%s.%s %s SystemVm template not found. Cannot upgrade system Vms hypervisor is not used, so not failing upgrade",
861-
CS_MAJOR_VERSION, CS_TINY_VERSION, hypervisorAndTemplateName.getKey()));
878+
LOGGER.warn(String.format("%s %s SystemVm template not found. Cannot upgrade system Vms hypervisor is not used, so not failing upgrade",
879+
getSystemVmTemplateVersion(), hypervisorAndTemplateName.getKey()));
862880
// Update the latest template URLs for corresponding hypervisor
863881
VMTemplateVO templateVO = vmTemplateDao.findLatestTemplateByTypeAndHypervisor(hypervisorAndTemplateName.getKey(), Storage.TemplateType.SYSTEM);
864882
if (templateVO != null) {
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
package com.cloud.upgrade.dao;
19+
20+
import com.cloud.upgrade.SystemVmTemplateRegistration;
21+
import com.cloud.utils.exception.CloudRuntimeException;
22+
import org.apache.log4j.Logger;
23+
24+
import java.io.InputStream;
25+
import java.sql.Connection;
26+
27+
public class Upgrade41600to41610 implements DbUpgrade, DbUpgradeSystemVmTemplate {
28+
29+
final static Logger LOG = Logger.getLogger(Upgrade41600to41610.class);
30+
private SystemVmTemplateRegistration systemVmTemplateRegistration;
31+
32+
@Override
33+
public String[] getUpgradableVersionRange() {
34+
return new String[] {"4.16.0.0", "4.16.1.0"};
35+
}
36+
37+
@Override
38+
public String getUpgradedVersion() {
39+
return "4.16.1.0";
40+
}
41+
42+
@Override
43+
public boolean supportsRollingUpgrade() {
44+
return false;
45+
}
46+
47+
@Override
48+
public InputStream[] getPrepareScripts() {
49+
final String scriptFile = "META-INF/db/schema-41600to41610.sql";
50+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
51+
if (script == null) {
52+
throw new CloudRuntimeException("Unable to find " + scriptFile);
53+
}
54+
55+
return new InputStream[] {script};
56+
}
57+
58+
@Override
59+
public void performDataMigration(Connection conn) {
60+
}
61+
62+
@Override
63+
public InputStream[] getCleanupScripts() {
64+
final String scriptFile = "META-INF/db/schema-41600to41610-cleanup.sql";
65+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
66+
if (script == null) {
67+
throw new CloudRuntimeException("Unable to find " + scriptFile);
68+
}
69+
70+
return new InputStream[] {script};
71+
}
72+
73+
private void initSystemVmTemplateRegistration() {
74+
systemVmTemplateRegistration = new SystemVmTemplateRegistration("4.16.0");
75+
}
76+
77+
@Override
78+
public void updateSystemVmTemplates(Connection conn) {
79+
LOG.debug("Updating System Vm template IDs");
80+
initSystemVmTemplateRegistration();
81+
try {
82+
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
83+
} catch (Exception e) {
84+
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
85+
}
86+
}
87+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 cleanup from 4.16.0.0 to 4.16.1.0
20+
--;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.16.0.0 to 4.16.1.0
20+
--;

tools/checkstyle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<name>Apache CloudStack Developer Tools - Checkstyle Configuration</name>
2323
<groupId>org.apache.cloudstack</groupId>
2424
<artifactId>checkstyle</artifactId>
25-
<version>4.16.0.0</version>
25+
<version>4.16.1.0-SNAPSHOT</version>
2626

2727
<properties>
2828
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

tools/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
FROM ubuntu:20.04
2121

2222
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
23-
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.16.0.0"
23+
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.16.1.0-SNAPSHOT"
2424

2525
ARG DEBIAN_FRONTEND=noninteractive
2626

tools/docker/Dockerfile.marvin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
FROM python:2
2121

2222
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
23-
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.16.0.0"
23+
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.16.1.0-SNAPSHOT"
2424

2525
ENV WORK_DIR=/marvin
2626

0 commit comments

Comments
 (0)