Skip to content

Commit 01d4434

Browse files
committedMar 21, 2024
Merge remote-tracking branch 'origin/4.19'
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Conflicts: plugins/network-elements/juniper-contrail/pom.xml pom.xml tools/marvin/setup.py Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2 parents 502a633 + 2e88eb4 commit 01d4434

File tree

18 files changed

+76
-48
lines changed

18 files changed

+76
-48
lines changed
 

‎client/pom.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
<artifactId>jetty-util</artifactId>
6969
</dependency>
7070
<dependency>
71-
<groupId>mysql</groupId>
72-
<artifactId>mysql-connector-java</artifactId>
71+
<groupId>com.mysql</groupId>
72+
<artifactId>mysql-connector-j</artifactId>
7373
</dependency>
7474
<dependency>
7575
<groupId>org.apache.cloudstack</groupId>
@@ -714,8 +714,8 @@
714714
<dependencies>
715715
<!-- specify the dependent jdbc driver here -->
716716
<dependency>
717-
<groupId>mysql</groupId>
718-
<artifactId>mysql-connector-java</artifactId>
717+
<groupId>com.mysql</groupId>
718+
<artifactId>mysql-connector-j</artifactId>
719719
<version>${cs.mysql.version}</version>
720720
</dependency>
721721
<dependency>
@@ -903,8 +903,8 @@
903903
<outputDirectory>${project.build.directory}/pythonlibs</outputDirectory>
904904
</artifactItem>
905905
<artifactItem>
906-
<groupId>mysql</groupId>
907-
<artifactId>mysql-connector-java</artifactId>
906+
<groupId>com.mysql</groupId>
907+
<artifactId>mysql-connector-j</artifactId>
908908
<overWrite>false</overWrite>
909909
<outputDirectory>${project.build.directory}/lib</outputDirectory>
910910
</artifactItem>
@@ -978,7 +978,7 @@
978978
<exclude>org.bouncycastle:bcprov-jdk15on</exclude>
979979
<exclude>org.bouncycastle:bcpkix-jdk15on</exclude>
980980
<exclude>org.bouncycastle:bctls-jdk15on</exclude>
981-
<exclude>mysql:mysql-connector-java</exclude>
981+
<exclude>com.mysql:mysql-connector-j</exclude>
982982
<exclude>org.apache.cloudstack:cloud-plugin-storage-volume-storpool</exclude>
983983
<exclude>org.apache.cloudstack:cloud-plugin-storage-volume-linstor</exclude>
984984
<exclude>org.apache.cloudstack:cloud-usage</exclude>

‎developer/pom.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@
112112
<dependencies>
113113
<!-- specify the dependent jdbc driver here -->
114114
<dependency>
115-
<groupId>mysql</groupId>
116-
<artifactId>mysql-connector-java</artifactId>
115+
<groupId>com.mysql</groupId>
116+
<artifactId>mysql-connector-j</artifactId>
117117
<version>${cs.mysql.version}</version>
118118
</dependency>
119119
</dependencies>
@@ -180,8 +180,8 @@
180180
<version>1.2.1</version>
181181
<dependencies>
182182
<dependency>
183-
<groupId>mysql</groupId>
184-
<artifactId>mysql-connector-java</artifactId>
183+
<groupId>com.mysql</groupId>
184+
<artifactId>mysql-connector-j</artifactId>
185185
<version>${cs.mysql.version}</version>
186186
</dependency>
187187
</dependencies>
@@ -238,8 +238,8 @@
238238
<version>1.2.1</version>
239239
<dependencies>
240240
<dependency>
241-
<groupId>mysql</groupId>
242-
<artifactId>mysql-connector-java</artifactId>
241+
<groupId>com.mysql</groupId>
242+
<artifactId>mysql-connector-j</artifactId>
243243
<version>${cs.mysql.version}</version>
244244
</dependency>
245245
</dependencies>

‎engine/schema/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<version>${project.version}</version>
5050
</dependency>
5151
<dependency>
52-
<groupId>mysql</groupId>
53-
<artifactId>mysql-connector-java</artifactId>
52+
<groupId>com.mysql</groupId>
53+
<artifactId>mysql-connector-j</artifactId>
5454
</dependency>
5555
<dependency>
5656
<groupId>org.ini4j</groupId>

‎engine/schema/src/main/java/com/cloud/upgrade/DatabaseCreator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private static void runScript(Connection conn, Reader reader, String filename, b
7474

7575
private static void runQuery(String host, String port, String rootPassword, String query, boolean dryRun) {
7676
System.out.println("============> Running query: " + query);
77-
try (Connection conn = DriverManager.getConnection(String.format("jdbc:mysql://%s:%s/", host, port), "root", rootPassword);
77+
try (Connection conn = DriverManager.getConnection(String.format("jdbc:mysql://%s:%s/?" + TransactionLegacy.CONNECTION_PARAMS, host, port), "root", rootPassword);
7878
Statement stmt = conn.createStatement();){
7979
if (!dryRun)
8080
stmt.executeUpdate(query);

‎engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41900to41910.java

+26-4
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
// under the License.
1717
package com.cloud.upgrade.dao;
1818

19+
import com.cloud.upgrade.SystemVmTemplateRegistration;
1920
import com.cloud.utils.exception.CloudRuntimeException;
2021

2122
import java.io.InputStream;
2223
import java.sql.Connection;
2324

24-
public class Upgrade41900to41910 implements DbUpgrade {
25+
public class Upgrade41900to41910 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate {
26+
private SystemVmTemplateRegistration systemVmTemplateRegistration;
2527

2628
@Override
2729
public String[] getUpgradableVersionRange() {
28-
return new String[] {"4.19.0.0", "4.19.1.0"};
30+
return new String[]{"4.19.0.0", "4.19.1.0"};
2931
}
3032

3133
@Override
@@ -46,11 +48,12 @@ public InputStream[] getPrepareScripts() {
4648
throw new CloudRuntimeException("Unable to find " + scriptFile);
4749
}
4850

49-
return new InputStream[] {script};
51+
return new InputStream[]{script};
5052
}
5153

5254
@Override
5355
public void performDataMigration(Connection conn) {
56+
addIndexes(conn);
5457
}
5558

5659
@Override
@@ -61,6 +64,25 @@ public InputStream[] getCleanupScripts() {
6164
throw new CloudRuntimeException("Unable to find " + scriptFile);
6265
}
6366

64-
return new InputStream[] {script};
67+
return new InputStream[]{script};
68+
}
69+
70+
private void addIndexes(Connection conn) {
71+
DbUpgradeUtils.addIndexIfNeeded(conn, "vm_stats", "vm_id");
72+
}
73+
74+
@Override
75+
public void updateSystemVmTemplates(Connection conn) {
76+
logger.debug("Updating System Vm template IDs");
77+
initSystemVmTemplateRegistration();
78+
try {
79+
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
80+
} catch (Exception e) {
81+
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
82+
}
83+
}
84+
85+
private void initSystemVmTemplateRegistration() {
86+
systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
6587
}
6688
}

‎framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class TransactionLegacy implements Closeable {
8383
public static final short SIMULATOR_DB = 3;
8484

8585
public static final short CONNECTED_DB = -1;
86+
public static final String CONNECTION_PARAMS = "scrollTolerantForwardOnly=true";
8687

8788
private static AtomicLong s_id = new AtomicLong();
8889
private static final TransactionMBeanImpl s_mbean = new TransactionMBeanImpl();
@@ -1212,6 +1213,9 @@ protected static String buildConnectionUri(String loadBalanceStrategy, String dr
12121213
connectionUri.append(loadBalanceStrategy);
12131214
}
12141215

1216+
connectionUri.append("&");
1217+
connectionUri.append(CONNECTION_PARAMS);
1218+
12151219
return connectionUri.toString();
12161220
}
12171221

@@ -1276,7 +1280,7 @@ private static String getDBHAParams(String dbName, Properties dbProps) {
12761280

12771281
@SuppressWarnings({"unchecked", "rawtypes"})
12781282
private static DataSource getDefaultDataSource(final String database) {
1279-
final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://localhost:3306/" + database, "cloud", "cloud");
1283+
final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://localhost:3306/" + database + "?" + CONNECTION_PARAMS, "cloud", "cloud");
12801284
final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null);
12811285
final GenericObjectPool connectionPool = new GenericObjectPool(poolableConnectionFactory);
12821286
return new PoolingDataSource(connectionPool);

‎plugins/database/mysql-ha/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
</parent>
3030
<dependencies>
3131
<dependency>
32-
<groupId>mysql</groupId>
33-
<artifactId>mysql-connector-java</artifactId>
32+
<groupId>com.mysql</groupId>
33+
<artifactId>mysql-connector-j</artifactId>
3434
<scope>provided</scope>
3535
</dependency>
3636
</dependencies>

‎plugins/database/quota/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<version>${project.version}</version>
5050
</dependency>
5151
<dependency>
52-
<groupId>mysql</groupId>
53-
<artifactId>mysql-connector-java</artifactId>
52+
<groupId>com.mysql</groupId>
53+
<artifactId>mysql-connector-j</artifactId>
5454
<scope>provided</scope>
5555
</dependency>
5656
<dependency>

‎plugins/network-elements/juniper-contrail/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
<artifactId>reload4j</artifactId>
125125
</dependency>
126126
<dependency>
127-
<groupId>mysql</groupId>
128-
<artifactId>mysql-connector-java</artifactId>
127+
<groupId>com.mysql</groupId>
128+
<artifactId>mysql-connector-j</artifactId>
129129
<scope>provided</scope>
130130
</dependency>
131131
<dependency>

‎plugins/storage/volume/cloudbyte/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<version>${project.version}</version>
4040
</dependency>
4141
<dependency>
42-
<groupId>mysql</groupId>
43-
<artifactId>mysql-connector-java</artifactId>
42+
<groupId>com.mysql</groupId>
43+
<artifactId>mysql-connector-j</artifactId>
4444
<scope>provided</scope>
4545
</dependency>
4646
<dependency>

‎pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<cs.kafka-clients.version>2.7.0</cs.kafka-clients.version>
167167
<cs.libvirt-java.version>0.5.3</cs.libvirt-java.version>
168168
<cs.mail.version>1.5.0-b01</cs.mail.version>
169-
<cs.mysql.version>8.0.19</cs.mysql.version>
169+
<cs.mysql.version>8.0.33</cs.mysql.version>
170170
<cs.neethi.version>2.0.4</cs.neethi.version>
171171
<cs.nitro.version>10.1</cs.nitro.version>
172172
<cs.opensaml.version>2.6.6</cs.opensaml.version>
@@ -465,8 +465,8 @@
465465
</exclusions>
466466
</dependency>
467467
<dependency>
468-
<groupId>mysql</groupId>
469-
<artifactId>mysql-connector-java</artifactId>
468+
<groupId>com.mysql</groupId>
469+
<artifactId>mysql-connector-j</artifactId>
470470
<version>${cs.mysql.version}</version>
471471
<scope>test</scope>
472472
</dependency>

‎server/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
<dependencies>
3737
<dependency>
38-
<groupId>mysql</groupId>
39-
<artifactId>mysql-connector-java</artifactId>
38+
<groupId>com.mysql</groupId>
39+
<artifactId>mysql-connector-j</artifactId>
4040
</dependency>
4141
<dependency>
4242
<groupId>commons-io</groupId>

‎test/src-not-used/main/java/com/cloud/test/regression/TestCase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void setConn(String dbPassword) {
8686
this.conn = null;
8787
try {
8888
Class.forName("com.mysql.jdbc.Driver");
89-
this.conn = DriverManager.getConnection("jdbc:mysql://" + param.get("db") + "/cloud", "root", dbPassword);
89+
this.conn = DriverManager.getConnection("jdbc:mysql://" + param.get("db") + "/cloud?" + TransactionLegacy.CONNECTION_PARAMS, "root", dbPassword);
9090
if (!this.conn.isValid(0)) {
9191
LOGGER.error("Connection to DB failed to establish");
9292
}

‎tools/devcloud-kvm/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
</parent>
3131
<dependencies>
3232
<dependency>
33-
<groupId>mysql</groupId>
34-
<artifactId>mysql-connector-java</artifactId>
33+
<groupId>com.mysql</groupId>
34+
<artifactId>mysql-connector-j</artifactId>
3535
<scope>provided</scope>
3636
</dependency>
3737
<dependency>
@@ -80,8 +80,8 @@
8080
<dependencies>
8181
<!-- specify the dependent jdbc driver here -->
8282
<dependency>
83-
<groupId>mysql</groupId>
84-
<artifactId>mysql-connector-java</artifactId>
83+
<groupId>com.mysql</groupId>
84+
<artifactId>mysql-connector-j</artifactId>
8585
<version>${cs.mysql.version}</version>
8686
</dependency>
8787
</dependencies>

‎tools/devcloud4/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
</parent>
3131
<dependencies>
3232
<dependency>
33-
<groupId>mysql</groupId>
34-
<artifactId>mysql-connector-java</artifactId>
33+
<groupId>com.mysql</groupId>
34+
<artifactId>mysql-connector-j</artifactId>
3535
<scope>provided</scope>
3636
</dependency>
3737
<dependency>
@@ -80,8 +80,8 @@
8080
<dependencies>
8181
<!-- specify the dependent jdbc driver here -->
8282
<dependency>
83-
<groupId>mysql</groupId>
84-
<artifactId>mysql-connector-java</artifactId>
83+
<groupId>com.mysql</groupId>
84+
<artifactId>mysql-connector-j</artifactId>
8585
<version>${cs.mysql.version}</version>
8686
</dependency>
8787
</dependencies>

‎usage/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
<artifactId>commons-daemon</artifactId>
6060
</dependency>
6161
<dependency>
62-
<groupId>mysql</groupId>
63-
<artifactId>mysql-connector-java</artifactId>
62+
<groupId>com.mysql</groupId>
63+
<artifactId>mysql-connector-j</artifactId>
6464
<scope>provided</scope>
6565
</dependency>
6666
<dependency>

‎usage/src/test/java/com/cloud/usage/UsageSanityCheckerIT.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.mockito.Mockito;
4242

4343
import com.cloud.utils.PropertiesUtil;
44+
import com.cloud.utils.db.TransactionLegacy;
4445

4546
@RunWith(Parameterized.class)
4647
public class UsageSanityCheckerIT{
@@ -106,7 +107,7 @@ public static Collection<Object[]> data() {
106107
protected Connection createConnection(String dbSchema) throws SQLException {
107108
String cloudDbUrl = "jdbc:mysql://"+properties.getProperty("db."+dbSchema+".host") +
108109
":" + properties.getProperty("db."+dbSchema+".port") + "/" +
109-
properties.getProperty("db."+dbSchema+".name");
110+
properties.getProperty("db."+dbSchema+".name") + "?" + TransactionLegacy.CONNECTION_PARAMS;
110111
return DriverManager.getConnection(cloudDbUrl, properties.getProperty("db."+dbSchema+".username"),
111112
properties.getProperty("db."+dbSchema+".password"));
112113
}

‎utils/pom.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@
124124
</dependency>
125125
<!-- Test dependency in mysql for db tests -->
126126
<dependency>
127-
<groupId>mysql</groupId>
128-
<artifactId>mysql-connector-java</artifactId>
127+
<groupId>com.mysql</groupId>
128+
<artifactId>mysql-connector-j</artifactId>
129+
<version>${cs.mysql.version}</version>
129130
<scope>test</scope>
130131
</dependency>
131132
<dependency>

0 commit comments

Comments
 (0)
Please sign in to comment.