You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/08/22 08:51:13 UTC
[1/3] git commit: updated refs/heads/master to db38412
Repository: cloudstack
Updated Branches:
refs/heads/master d3e45515e -> db384127a
CLOUDSTACK-9459: the try's catch block was shortening the preparedstatement life
resulting in bad resultset when used outside of try catch.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a2fcc65d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a2fcc65d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a2fcc65d
Branch: refs/heads/master
Commit: a2fcc65d9050b9cd6915e36e5274379aa3298957
Parents: 227ff38
Author: Abhinandan Prateek <ab...@shapeblue.com>
Authored: Tue Aug 16 14:04:43 2016 +0530
Committer: Abhinandan Prateek <ab...@shapeblue.com>
Committed: Tue Aug 16 14:19:07 2016 +0530
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade410to420.java | 83 ++++++++++----------
1 file changed, 42 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fcc65d/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 7d67d2e..6e88110 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -706,11 +706,11 @@ public class Upgrade410to420 implements DbUpgrade {
String vc = "";
String dcName = "";
- try(PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`data_center` where removed is NULL");) {
+ try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`data_center` where removed is NULL");) {
try (ResultSet rs = pstmt.executeQuery();) {
while (rs.next()) {
zoneId = rs.getLong("id");
- try(PreparedStatement clustersQuery = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster` where removed is NULL AND data_center_id=?");) {
+ try (PreparedStatement clustersQuery = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster` where removed is NULL AND data_center_id=?");) {
clustersQuery.setLong(1, zoneId);
legacyZone = false;
ignoreZone = true;
@@ -719,53 +719,54 @@ public class Upgrade410to420 implements DbUpgrade {
// Legacy zone term is meant only for VMware
// Legacy zone is a zone with atleast 2 clusters & with multiple DCs or VCs
clusters = clustersQuery.executeQuery();
- }catch (SQLException e) {
- throw new CloudRuntimeException("persistLegacyZones:Exception:"+e.getMessage(), e);
- }
- if (!clusters.next()) {
- continue; // Ignore the zone without any clusters
- } else {
- dcOfPreviousCluster = null;
- dcOfCurrentCluster = null;
- do {
- clusterHypervisorType = clusters.getString("hypervisor_type");
- clusterId = clusters.getLong("id");
- if (clusterHypervisorType.equalsIgnoreCase("VMware")) {
- ignoreZone = false;
- try (PreparedStatement clusterDetailsQuery = conn.prepareStatement("select value from `cloud`.`cluster_details` where name='url' and cluster_id=?");) {
- clusterDetailsQuery.setLong(1, clusterId);
- try (ResultSet clusterDetails = clusterDetailsQuery.executeQuery();) {
- clusterDetails.next();
- url = clusterDetails.getString("value");
- tokens = url.split("/"); // url format - http://vcenter/dc/cluster
- vc = tokens[2];
- dcName = tokens[3];
- dcOfPreviousCluster = dcOfCurrentCluster;
- dcOfCurrentCluster = dcName + "@" + vc;
- if (!dcList.contains(dcOfCurrentCluster)) {
- dcList.add(dcOfCurrentCluster);
- }
- if (count > 0) {
- if (!dcOfPreviousCluster.equalsIgnoreCase(dcOfCurrentCluster)) {
- legacyZone = true;
- s_logger.debug("Marking the zone " + zoneId + " as legacy zone.");
+ if (!clusters.next()) {
+ continue; // Ignore the zone without any clusters
+ } else {
+ dcOfPreviousCluster = null;
+ dcOfCurrentCluster = null;
+ do {
+ clusterHypervisorType = clusters.getString("hypervisor_type");
+ clusterId = clusters.getLong("id");
+ if (clusterHypervisorType.equalsIgnoreCase("VMware")) {
+ ignoreZone = false;
+ try (PreparedStatement clusterDetailsQuery = conn
+ .prepareStatement("select value from `cloud`.`cluster_details` where name='url' and cluster_id=?");) {
+ clusterDetailsQuery.setLong(1, clusterId);
+ try (ResultSet clusterDetails = clusterDetailsQuery.executeQuery();) {
+ clusterDetails.next();
+ url = clusterDetails.getString("value");
+ tokens = url.split("/"); // url format - http://vcenter/dc/cluster
+ vc = tokens[2];
+ dcName = tokens[3];
+ dcOfPreviousCluster = dcOfCurrentCluster;
+ dcOfCurrentCluster = dcName + "@" + vc;
+ if (!dcList.contains(dcOfCurrentCluster)) {
+ dcList.add(dcOfCurrentCluster);
+ }
+ if (count > 0) {
+ if (!dcOfPreviousCluster.equalsIgnoreCase(dcOfCurrentCluster)) {
+ legacyZone = true;
+ s_logger.debug("Marking the zone " + zoneId + " as legacy zone.");
+ }
}
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable add zones to cloud.legacyzones table.", e);
}
} catch (SQLException e) {
throw new CloudRuntimeException("Unable add zones to cloud.legacyzones table.", e);
}
- } catch (SQLException e) {
- throw new CloudRuntimeException("Unable add zones to cloud.legacyzones table.", e);
+ } else {
+ s_logger.debug("Ignoring zone " + zoneId + " with hypervisor type " + clusterHypervisorType);
+ break;
}
- } else {
- s_logger.debug("Ignoring zone " + zoneId + " with hypervisor type " + clusterHypervisorType);
- break;
+ count++;
+ } while (clusters.next());
+ if (ignoreZone) {
+ continue; // Ignore the zone with hypervisors other than VMware
}
- count++;
- } while (clusters.next());
- if (ignoreZone) {
- continue; // Ignore the zone with hypervisors other than VMware
}
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("persistLegacyZones:Exception:" + e.getMessage(), e);
}
if (legacyZone) {
listOfLegacyZones.add(zoneId);
[3/3] git commit: updated refs/heads/master to db38412
Posted by bh...@apache.org.
Merge branch '4.9'
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/db384127
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/db384127
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/db384127
Branch: refs/heads/master
Commit: db384127a767d69c3dddbcd404d8a09552e9c522
Parents: d3e4551 b7f1ba9
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Aug 22 14:20:57 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Aug 22 14:20:57 2016 +0530
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade410to420.java | 83 ++++++++++----------
1 file changed, 42 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: updated refs/heads/master to db38412
Posted by bh...@apache.org.
Merge pull request #1641 from shapeblue/upgrade_fix
CLOUDSTACK-9459: the try's catch block was shortening the preparedstatement's lifethe try's catch block was shortening the preparedstatement's life resulting in bad resultset when used outside of try catch.
* pr/1641:
CLOUDSTACK-9459: the try's catch block was shortening the preparedstatement life resulting in bad resultset when used outside of try catch.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b7f1ba94
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b7f1ba94
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b7f1ba94
Branch: refs/heads/master
Commit: b7f1ba944b4fb6844ac76295a52280539bb038a5
Parents: bdc409c a2fcc65
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Aug 22 14:16:26 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Aug 22 14:16:26 2016 +0530
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade410to420.java | 83 ++++++++++----------
1 file changed, 42 insertions(+), 41 deletions(-)
----------------------------------------------------------------------