cluster guid is set up when old host reconnect happens after upgrade, prohibit adding host to the cluster before guid is etup

This commit is contained in:
anthony 2011-04-21 16:01:04 -07:00
parent 71f968a3e1
commit b219d3e83e
1 changed files with 15 additions and 0 deletions

View File

@ -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<HostVO> 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);