cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: updated refs/heads/4.2 to 319a7bf
Date Tue, 20 Aug 2013 10:32:32 GMT
Updated Branches:
  refs/heads/4.2 ba581efac -> 319a7bf05


CLOUDSTACK-4408 [Upgrade 3.0.7 to 4.2] Zone with clusters of multiple hypervisors including
VMware should be processed for legacy zone.

Currently zones with multiple clusters from more than 1 hypervisor including VMware, are being
ignored while processing them during upgrade.
If a zone has all non-VMware clusters then ignoring the zone is correct.
But if a zone has atleast 1 VMware cluster then make sure the zone processed further to mark
it as legacy or associate the zone with appropriate VMware DC.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/319a7bf0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/319a7bf0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/319a7bf0

Branch: refs/heads/4.2
Commit: 319a7bf05caca175d67b910be79a7c9ead21a198
Parents: ba581ef
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Tue Aug 20 10:31:35 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Tue Aug 20 10:31:35 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade412to420.java  | 44 +++++++++-----------
 1 file changed, 20 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/319a7bf0/engine/schema/src/com/cloud/upgrade/dao/Upgrade412to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade412to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade412to420.java
index 3630c00..614cf14 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade412to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade412to420.java
@@ -907,7 +907,6 @@ public class Upgrade412to420 implements DbUpgrade {
         Long vmwareDcId = 1L;
         Long zoneId;
         Long clusterId;
-        String clusterHypervisorType;
         boolean legacyZone;
         boolean ignoreZone;
         Long count;
@@ -929,7 +928,7 @@ public class Upgrade412to420 implements DbUpgrade {
 
             while (rs.next()) {
                 zoneId = rs.getLong("id");
-                clustersQuery = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster`
where removed is NULL AND data_center_id=?");
+                clustersQuery = conn.prepareStatement("select id from `cloud`.`cluster` where
removed is NULL AND data_center_id=? AND hypervisor_type='VMware'");
                 clustersQuery.setLong(1, zoneId);
                 legacyZone = false;
                 ignoreZone = true;
@@ -943,39 +942,36 @@ public class Upgrade412to420 implements DbUpgrade {
                     dcOfPreviousCluster = null;
                     dcOfCurrentCluster = null;
                     do {
-                        clusterHypervisorType = clusters.getString("hypervisor_type");
                         clusterId = clusters.getLong("id");
-                        if (clusterHypervisorType.equalsIgnoreCase("VMware")) {
-                            ignoreZone = false;
-                            clusterDetailsQuery = conn.prepareStatement("select value from
`cloud`.`cluster_details` where name='url' and cluster_id=?");
-                            clusterDetailsQuery.setLong(1, clusterId);
-                            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 (count > 0) {
-                                if (!dcOfPreviousCluster.equalsIgnoreCase(dcOfCurrentCluster))
{
-                                    legacyZone = true;
-                                    s_logger.debug("Marking the zone " + zoneId + " as legacy
zone.");
-                                }
+                        ignoreZone = false;
+                        clusterDetailsQuery = conn.prepareStatement("select value from `cloud`.`cluster_details`
where name='url' and cluster_id=?");
+                        clusterDetailsQuery.setLong(1, clusterId);
+                        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 (count > 0) {
+                            if (!dcOfPreviousCluster.equalsIgnoreCase(dcOfCurrentCluster))
{
+                                legacyZone = true;
+                                s_logger.debug("Marking the zone " + zoneId + " as legacy
zone.");
                             }
-                        } else {
-                            s_logger.debug("Ignoring zone " + zoneId + " with hypervisor
type " + clusterHypervisorType);
-                            break;
                         }
                         count++;
                     } while (clusters.next());
+
+                    // Ignore the zone without even one VMware cluster.
                     if (ignoreZone) {
-                        continue; // Ignore the zone with hypervisors other than VMware
+                        continue;
                     }
                 }
                 if (legacyZone) {
                     listOfLegacyZones.add(zoneId);
                 } else {
+                    // Associate DC with the zone.
                     assert(clusterDetails != null) : "Couldn't retrieve details of cluster!";
                     s_logger.debug("Discovered non-legacy zone " + zoneId + ". Processing
the zone to associate with VMware datacenter.");
 


Mime
View raw message