mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4668: Upgrade to 4.2 fails with NullPointerException when hypervisor_type is null for a cluster entry
Changes: - Care for null value during comparing the hypervisor_type - Do not consider removed clusters - Method rename according to coding conventions
This commit is contained in:
parent
d28cca7bf0
commit
f4e4be01ff
|
|
@ -83,7 +83,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
createPlaceHolderNics(conn);
|
||||
updateRemoteAccessVpn(conn);
|
||||
updateSystemVmTemplates(conn);
|
||||
updateCluster_details(conn);
|
||||
updateOverCommitRatioClusterDetails(conn);
|
||||
updatePrimaryStore(conn);
|
||||
addEgressFwRulesForSRXGuestNw(conn);
|
||||
upgradeEIPNetworkOfferings(conn);
|
||||
|
|
@ -898,7 +898,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
}
|
||||
|
||||
//update the cluster_details table with default overcommit ratios.
|
||||
private void updateCluster_details(Connection conn) {
|
||||
private void updateOverCommitRatioClusterDetails(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt1 = null;
|
||||
PreparedStatement pstmt2 =null;
|
||||
|
|
@ -907,7 +907,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
ResultSet rscpu_global = null;
|
||||
ResultSet rsmem_global = null;
|
||||
try {
|
||||
pstmt = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster`");
|
||||
pstmt = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster` WHERE removed IS NULL");
|
||||
pstmt1=conn.prepareStatement("INSERT INTO `cloud`.`cluster_details` (cluster_id, name, value) VALUES(?, 'cpuOvercommitRatio', ?)");
|
||||
pstmt2=conn.prepareStatement("INSERT INTO `cloud`.`cluster_details` (cluster_id, name, value) VALUES(?, 'memoryOvercommitRatio', ?)");
|
||||
pstmt3=conn.prepareStatement("select value from `cloud`.`configuration` where name=?");
|
||||
|
|
@ -926,7 +926,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
while (rs1.next()) {
|
||||
long id = rs1.getLong(1);
|
||||
String hypervisor_type = rs1.getString(2);
|
||||
if (hypervisor_type.equalsIgnoreCase(HypervisorType.VMware.toString())) {
|
||||
if (HypervisorType.VMware.toString().equalsIgnoreCase(hypervisor_type)) {
|
||||
pstmt1.setLong(1,id);
|
||||
pstmt1.setString(2,global_cpu_overprovisioning_factor);
|
||||
pstmt1.execute();
|
||||
|
|
|
|||
Loading…
Reference in New Issue