mirror of https://github.com/apache/cloudstack.git
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>
This commit is contained in:
parent
ba581efacb
commit
319a7bf05c
|
|
@ -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.");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue