Skip to content

Commit 72831ec

Browse files
committed
CLOUDSTACK-8433: remove awsapi db usage and add upgrade cleanup path
- Removes awsapi db properties usage across codebase - Removes references from spring xmls, test cases and TransactionLegacy - Adds sql command to drop database cloudbridge in schema-451to460-cleanup.sql Signed-off-by: Rohit Yadav <[email protected]>
1 parent e0eea01 commit 72831ec

File tree

19 files changed

+3
-170
lines changed

19 files changed

+3
-170
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ build.number
3737
cloud.log.*.*
3838
unittest
3939
deps/cloud.userlibraries
40-
deps/awsapi-lib/
4140
.DS_Store
4241
.idea
4342
*.iml
@@ -61,14 +60,12 @@ tools/cli/build/
6160
#.*
6261

6362
target-eclipse
64-
awsapi/modules/*
6563
!.gitignore
6664
.classpath
6765
.settings.xml
6866
.settings/
6967
db.properties.override
7068
replace.properties.override
71-
awsapi/overlays/
7269
tools/marvin/marvin/cloudstackAPI/*
7370
*.egg-info/
7471
docs/tmp

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,4 @@ The following provides more details on the included cryptographic software:
148148
* CloudStack has a system requirement of MySQL, and uses native database encryption functionality.
149149
* CloudStack makes use of the Bouncy Castle general-purpose encryption library.
150150
* CloudStack can optionally interacts with and controls OpenSwan-based VPNs.
151-
* CloudStack has a dependency on Apache WSS4J as part of the AWSAPI implementation.
152151
* CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation.

engine/storage/snapshot/test/resources/db.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ db.usage.maxIdle=30
5555
db.usage.maxWait=10000
5656
db.usage.autoReconnect=true
5757

58-
# awsapi database settings
59-
db.awsapi.name=cloudbridge
60-
6158
# Simulator database settings
6259
db.simulator.username=cloud
6360
db.simulator.password=cloud

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

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public class TransactionLegacy implements Closeable {
7777

7878
public static final short CLOUD_DB = 0;
7979
public static final short USAGE_DB = 1;
80-
public static final short AWSAPI_DB = 2;
8180
public static final short SIMULATOR_DB = 3;
8281

8382
public static final short CONNECTED_DB = -1;
@@ -229,19 +228,6 @@ public static Connection getStandaloneUsageConnection() {
229228
}
230229
}
231230

232-
public static Connection getStandaloneAwsapiConnection() {
233-
try {
234-
Connection conn = s_awsapiDS.getConnection();
235-
if (s_connLogger.isTraceEnabled()) {
236-
s_connLogger.trace("Retrieving a standalone connection for usage: dbconn" + System.identityHashCode(conn));
237-
}
238-
return conn;
239-
} catch (SQLException e) {
240-
s_logger.warn("Unexpected exception: ", e);
241-
return null;
242-
}
243-
}
244-
245231
public static Connection getStandaloneSimulatorConnection() {
246232
try {
247233
Connection conn = s_simulatorDS.getConnection();
@@ -571,15 +557,6 @@ public Connection getConnection() throws SQLException {
571557
throw new CloudRuntimeException("Database is not initialized, process is dying?");
572558
}
573559
break;
574-
case AWSAPI_DB:
575-
if (s_awsapiDS != null) {
576-
_conn = s_awsapiDS.getConnection();
577-
} else {
578-
s_logger.warn("A static-initialized variable becomes null, process is dying?");
579-
throw new CloudRuntimeException("Database is not initialized, process is dying?");
580-
}
581-
break;
582-
583560
case SIMULATOR_DB:
584561
if (s_simulatorDS != null) {
585562
_conn = s_simulatorDS.getConnection();
@@ -1014,7 +991,6 @@ public String toString() {
1014991

1015992
private static DataSource s_ds;
1016993
private static DataSource s_usageDS;
1017-
private static DataSource s_awsapiDS;
1018994
private static DataSource s_simulatorDS;
1019995
private static boolean s_dbHAEnabled;
1020996

@@ -1136,20 +1112,6 @@ public static void initDataSource(Properties dbProps) {
11361112
// Data Source for usage server
11371113
s_usageDS = new PoolingDataSource(usagePoolableConnectionFactory.getPool());
11381114

1139-
// Configure awsapi db
1140-
final String awsapiDbName = dbProps.getProperty("db.awsapi.name");
1141-
final GenericObjectPool awsapiConnectionPool =
1142-
new GenericObjectPool(null, usageMaxActive, GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION, usageMaxWait, usageMaxIdle);
1143-
final ConnectionFactory awsapiConnectionFactory =
1144-
new DriverManagerConnectionFactory("jdbc:mysql://" + cloudHost + (s_dbHAEnabled ? "," + cloudSlaves : "") + ":" + cloudPort + "/" + awsapiDbName +
1145-
"?autoReconnect=" + cloudAutoReconnect + (s_dbHAEnabled ? "&" + cloudDbHAParams : "") +
1146-
(s_dbHAEnabled ? "&loadBalanceStrategy=" + loadBalanceStrategy : ""), cloudUsername, cloudPassword);
1147-
final PoolableConnectionFactory awsapiPoolableConnectionFactory =
1148-
new PoolableConnectionFactory(awsapiConnectionFactory, awsapiConnectionPool, new StackKeyedObjectPoolFactory(), null, false, false);
1149-
1150-
// Data Source for awsapi
1151-
s_awsapiDS = new PoolingDataSource(awsapiPoolableConnectionFactory.getPool());
1152-
11531115
try {
11541116
// Configure the simulator db
11551117
final int simulatorMaxActive = Integer.parseInt(dbProps.getProperty("db.simulator.maxActive"));

framework/db/test/com/cloud/utils/db/TestTransaction.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -127,30 +127,4 @@ public void doInTransactionWithoutResult(TransactionStatus status) throws FileNo
127127
verify(conn, times(0)).rollback();
128128
verify(conn, times(1)).close();
129129
}
130-
131-
@Test
132-
public void testOtherdatabaseRollback() throws Exception {
133-
after();
134-
setup(TransactionLegacy.AWSAPI_DB);
135-
136-
try {
137-
Transaction.execute(new TransactionCallbackNoReturn() {
138-
@Override
139-
public void doInTransactionWithoutResult(TransactionStatus status) {
140-
assertEquals(TransactionLegacy.AWSAPI_DB, TransactionLegacy.currentTxn().getDatabaseId().shortValue());
141-
142-
throw new RuntimeException("Panic!");
143-
}
144-
});
145-
fail();
146-
} catch (RuntimeException e) {
147-
assertEquals("Panic!", e.getMessage());
148-
}
149-
150-
verify(conn).setAutoCommit(false);
151-
verify(conn, times(0)).commit();
152-
verify(conn, times(1)).rollback();
153-
verify(conn, times(1)).close();
154-
}
155-
156130
}

framework/db/test/db.properties

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ db.usage.maxIdle=30
5858
db.usage.maxWait=10000
5959
db.usage.autoReconnect=true
6060

61-
# awsapi database settings
62-
db.awsapi.username=cloud
63-
db.awsapi.password=cloud
64-
db.awsapi.host=localhost
65-
db.awsapi.port=3306
66-
db.awsapi.name=cloudbridge
67-
6861
# Simulator database settings
6962
db.simulator.username=cloud
7063
db.simulator.password=cloud

framework/jobs/test/resources/db.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ db.usage.maxIdle=30
5151
db.usage.maxWait=10000
5252
db.usage.autoReconnect=true
5353

54-
# awsapi database settings
55-
db.awsapi.name=cloudbridge
56-
5754
# Simulator database settings
5855
db.simulator.username=cloud
5956
db.simulator.password=cloud

plugins/network-elements/dns-notifier/resources/components-example.xml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -188,31 +188,4 @@ under the License.
188188
<dao name="Site2SiteVpnGatewayDao" class="com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl" singleton="false"/>
189189
<dao name="Site2SiteVpnConnectionDao" class="com.cloud.network.dao.Site2SiteVpnConnectionDaoImpl" singleton="false"/>
190190
</configuration-server>
191-
192-
<awsapi-ec2server class="com.cloud.bridge.service.EC2MainServlet">
193-
<dao name="CloudStackConfigurationDao" class="com.cloud.bridge.persist.dao.CloudStackConfigurationDaoImpl" singleton="false"/>
194-
<dao name="UserCredentialsDao" class="com.cloud.bridge.persist.dao.UserCredentialsDaoImpl" singleton="false"/>
195-
<dao name="CloudStackSvcOfferingDao" class="com.cloud.bridge.persist.dao.CloudStackSvcOfferingDaoImpl" singleton="false"/>
196-
<dao name="OfferingDao" class="com.cloud.bridge.persist.dao.OfferingDaoImpl" singleton="false"/>
197-
<dao name="CloudStackAccountDao" class="com.cloud.bridge.persist.dao.CloudStackAccountDaoImpl" singleton="false"/>
198-
</awsapi-ec2server>
199-
200-
<awsapi-s3server class="com.cloud.bridge.service.S3RestServlet">
201-
<dao name="CloudStackConfigurationDao" class="com.cloud.bridge.persist.dao.CloudStackConfigurationDaoImpl" singleton="false"/>
202-
<dao name="MHostDao" class="com.cloud.bridge.persist.dao.MHostDaoImpl" singleton="false"/>
203-
<dao name="SHostDao" class="com.cloud.bridge.persist.dao.SHostDaoImpl" singleton="false"/>
204-
<dao name="UserCredentialsDao" class="com.cloud.bridge.persist.dao.UserCredentialsDaoImpl" singleton="false"/>
205-
<dao name="BucketPolicyDao" class="com.cloud.bridge.persist.dao.BucketPolicyDaoImpl" singleton="false"/>
206-
<dao name="MHostMountDao" class="com.cloud.bridge.persist.dao.MHostMountDaoImpl" singleton="false"/>
207-
<dao name="SAclDao" class="com.cloud.bridge.persist.dao.SAclDaoImpl" singleton="false"/>
208-
<dao name="SBucketDao" class="com.cloud.bridge.persist.dao.SBucketDaoImpl" singleton="false"/>
209-
<dao name="SMetaDao" class="com.cloud.bridge.persist.dao.SMetaDaoImpl" singleton="false"/>
210-
<dao name="SObjectDao" class="com.cloud.bridge.persist.dao.SObjectDaoImpl" singleton="false"/>
211-
<dao name="SObjectItemDao" class="com.cloud.bridge.persist.dao.SObjectItemDaoImpl" singleton="false"/>
212-
<dao name="MultiPartPartsDao" class="com.cloud.bridge.persist.dao.MultiPartPartsDaoImpl" singleton="false"/>
213-
<dao name="MultiPartUploadsDao" class="com.cloud.bridge.persist.dao.MultiPartUploadsDaoImpl" singleton="false"/>
214-
<dao name="MultipartMetaDao" class="com.cloud.bridge.persist.dao.MultipartMetaDaoImpl" singleton="false"/>
215-
<dao name="UserCredentialsDao" class="com.cloud.bridge.persist.dao.UserCredentialsDaoImpl" singleton="false"/>
216-
</awsapi-s3server>
217-
218191
</components.xml>

plugins/network-elements/globodns/test/resources/db.properties

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ db.usage.maxIdle=30
5656
db.usage.maxWait=10000
5757
db.usage.autoReconnect=true
5858

59-
# awsapi database settings
60-
db.awsapi.username=cloud
61-
db.awsapi.password=cloud
62-
db.awsapi.host=localhost
63-
db.awsapi.port=3306
64-
db.awsapi.name=cloudbridge
65-
6659
# Simulator database settings
6760
db.simulator.username=cloud
6861
db.simulator.password=cloud

plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/TestDbSetup.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ public static void updateSqlPort(int port, String propertyFileOverride) throws E
9494
config.setProperty("db.usage.username", System.getProperty("user.name"));
9595
config.setProperty("db.usage.password", "");
9696

97-
config.setProperty("db.awsapi.port", "" + port);
98-
config.setProperty("db.awsapi.username", System.getProperty("user.name"));
99-
config.setProperty("db.awsapi.password", "");
100-
10197
config.setProperty("db.simulator.port", "" + port);
10298
config.setProperty("db.simulator.username", System.getProperty("user.name"));
10399
config.setProperty("db.simulator.password", "");

0 commit comments

Comments
 (0)