From b219d3e83ec7725f9d36ffc01d4d320a39760299 Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 21 Apr 2011 16:01:04 -0700 Subject: [PATCH] cluster guid is set up when old host reconnect happens after upgrade, prohibit adding host to the cluster before guid is etup --- .../com/cloud/agent/manager/AgentManagerImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 5ad49b5542a..cdc3fbe2c3a 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -73,6 +73,7 @@ import com.cloud.agent.manager.allocator.PodAllocator; import com.cloud.agent.transport.Request; import com.cloud.agent.transport.Response; import com.cloud.alert.AlertManager; +import com.cloud.api.ApiConstants; import com.cloud.api.commands.AddClusterCmd; import com.cloud.api.commands.AddHostCmd; import com.cloud.api.commands.AddSecondaryStorageCmd; @@ -792,6 +793,20 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, clusterName = "Standalone-" + url; } + if ( clusterId != null ) { + ClusterVO cluster = _clusterDao.findById(clusterId); + if ( cluster == null ) { + throw new InvalidParameterValueException("can not fine cluster for clusterId " + clusterId); + } else { + if ( cluster.getGuid() == null ) { + List hosts = _hostDao.listByCluster(clusterId); + if ( ! hosts.isEmpty() ) { + throw new CloudRuntimeException("Guid is not updated for cluster " + clusterId + " need to wait hosts in this cluster up"); + } + } + } + } + if (cmd.getHypervisor().equalsIgnoreCase(Hypervisor.HypervisorType.BareMetal.toString())) { if (memCapacity == null) { memCapacity = Long.valueOf(0);