mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-1395 Upgrade script for cpu and ram overcommit.
It sets the overcommit values of all the clusters to 1.
This commit is contained in:
parent
7a3a1c792a
commit
355589c1f0
|
|
@ -76,8 +76,45 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
}
|
||||
}
|
||||
}
|
||||
updateCluster_details(conn);
|
||||
}
|
||||
|
||||
//update the cluster_details table with default overcommit ratios.
|
||||
private void updateCluster_details(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt1 = null;
|
||||
PreparedStatement pstmt2 =null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try {
|
||||
pstmt = conn.prepareStatement("select id from `cloud`.`cluster`");
|
||||
pstmt1=conn.prepareStatement("INSERT INTO `cloud`.`cluster_details` (cluster_id, name, value) VALUES(?, 'cpuOvercommitRatio', '1')");
|
||||
pstmt2=conn.prepareStatement("INSERT INTO `cloud`.`cluster_details` (cluster_id, name, value) VALUES(?, 'memoryOvercommitRatio', '1')");
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
long id = rs.getLong(1);
|
||||
//update cluster_details table with the default overcommit ratios.
|
||||
pstmt1.setLong(1,id);
|
||||
pstmt1.execute();
|
||||
pstmt2.setLong(1,id);
|
||||
pstmt2.execute();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to update cluster_details with default overcommit ratios.", e);
|
||||
} finally {
|
||||
try {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
if (pstmt != null) {
|
||||
pstmt.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public File[] getCleanupScripts() {
|
||||
String script = Script.findScript("", "db/schema-410to420-cleanup.sql");
|
||||
|
|
|
|||
Loading…
Reference in New Issue