diff --git a/core/src/com/cloud/host/HostVO.java b/core/src/com/cloud/host/HostVO.java index c6331af3796..16961299d04 100644 --- a/core/src/com/cloud/host/HostVO.java +++ b/core/src/com/cloud/host/HostVO.java @@ -383,7 +383,8 @@ public class HostVO implements Host { this(id, name, type, privateIpAddress, privateNetmask, privateMacAddress, publicIpAddress, publicNetmask, publicMacAddress, storageIpAddress, storageNetmask, storageMacAddress, guid, status, version, iqn, disconnectedOn, dcId, podId, serverId, ping, null, null, null, 0, null); this.parent = parent; this.totalSize = totalSize; - this.fsType = fsType; + this.fsType = fsType; + this.hostAllocationState = Host.HostAllocationState.Enabled; } public HostVO(long id, @@ -440,7 +441,8 @@ public class HostVO implements Host { this.caps = caps; this.disconnectedOn = disconnectedOn; this.dom0MinMemory = dom0MinMemory; - this.storageUrl = url; + this.storageUrl = url; + this.hostAllocationState = Host.HostAllocationState.Enabled; } public void setPodId(Long podId) { diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index e073e131356..b17cf37a7e5 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -661,7 +661,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, } } if (allocationState == null) { - allocationState = Grouping.AllocationState.Disabled; + allocationState = Grouping.AllocationState.Enabled; } Discoverer discoverer = getMatchingDiscover(hypervisorType); @@ -818,7 +818,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, List hostTags = cmd.getHostTags(); String allocationState = cmd.getAllocationState(); if (allocationState == null) { - allocationState = Host.HostAllocationState.Disabled.toString(); + allocationState = Host.HostAllocationState.Enabled.toString(); } return discoverHostsFull(dcId, podId, clusterId, clusterName, url, @@ -2549,8 +2549,11 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, server.setHostAllocationState(hostAllocationState); } }catch(IllegalArgumentException ex){ - s_logger.error("Unable to resolve " + allocationState + " to a valid supported host allocation State"); + s_logger.error("Unable to resolve " + allocationState + " to a valid supported host allocation State, defaulting to 'Enabled'"); + server.setHostAllocationState(Host.HostAllocationState.Enabled); } + }else{ + server.setHostAllocationState(Host.HostAllocationState.Enabled); } updateHost(server, startup, type, _nodeId); diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index af126abcd68..6802d3a1896 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -735,7 +735,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura String allocationState = cmd.getAllocationState(); if(allocationState == null){ - allocationState = Grouping.AllocationState.Disabled.toString(); + allocationState = Grouping.AllocationState.Enabled.toString(); } return createPod(userId.longValue(), name, zoneId, gateway, cidr, startIp, endIp, allocationState); } @@ -1289,7 +1289,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura Boolean isBasic = false; String allocationState = cmd.getAllocationState(); if (allocationState == null) { - allocationState = Grouping.AllocationState.Disabled.toString(); + allocationState = Grouping.AllocationState.Enabled.toString(); } if (!(type.equalsIgnoreCase(NetworkType.Basic.toString())) && !(type.equalsIgnoreCase(NetworkType.Advanced.toString()))) { diff --git a/server/src/com/cloud/dc/ClusterVO.java b/server/src/com/cloud/dc/ClusterVO.java index 780e44d72be..14bddac39c4 100644 --- a/server/src/com/cloud/dc/ClusterVO.java +++ b/server/src/com/cloud/dc/ClusterVO.java @@ -66,6 +66,7 @@ public class ClusterVO implements Cluster { public ClusterVO() { clusterType = Cluster.ClusterType.CloudManaged; + allocationState = Grouping.AllocationState.Enabled; } public ClusterVO(long dataCenterId, long podId, String name) { @@ -73,6 +74,7 @@ public class ClusterVO implements Cluster { this.podId = podId; this.name = name; this.clusterType = Cluster.ClusterType.CloudManaged; + this.allocationState = Grouping.AllocationState.Enabled; } public long getId() { diff --git a/server/src/com/cloud/dc/DataCenterVO.java b/server/src/com/cloud/dc/DataCenterVO.java index 68b426e4a26..d71fa9d5bf1 100644 --- a/server/src/com/cloud/dc/DataCenterVO.java +++ b/server/src/com/cloud/dc/DataCenterVO.java @@ -32,6 +32,7 @@ import javax.persistence.TableGenerator; import javax.persistence.Transient; import com.cloud.network.Network.Provider; +import com.cloud.org.Grouping; import com.cloud.utils.NumbersUtil; @Entity @@ -165,7 +166,8 @@ public class DataCenterVO implements DataCenter { public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId, NetworkType zoneType) { this(name, description, dns1, dns2, dns3, dns4, vnet, guestCidr, domain, domainId, zoneType, false); - this.id = id; + this.id = id; + this.allocationState = Grouping.AllocationState.Enabled; } public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId, NetworkType zoneType, boolean securityGroupEnabled) { @@ -180,7 +182,7 @@ public class DataCenterVO implements DataCenter { this.domain = domain; this.domainId = domainId; this.networkType = zoneType; - + this.allocationState = Grouping.AllocationState.Enabled; this.securityGroupEnabled = securityGroupEnabled; if (zoneType == NetworkType.Advanced) { diff --git a/server/src/com/cloud/dc/HostPodVO.java b/server/src/com/cloud/dc/HostPodVO.java index 584758408d7..3c9ea73832f 100644 --- a/server/src/com/cloud/dc/HostPodVO.java +++ b/server/src/com/cloud/dc/HostPodVO.java @@ -27,6 +27,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.org.Grouping; import com.cloud.org.Grouping.AllocationState; import com.cloud.utils.NumbersUtil; @@ -66,6 +67,7 @@ public class HostPodVO implements Pod { this.cidrAddress = cidrAddress; this.cidrSize = cidrSize; this.description = description; + this.allocationState = Grouping.AllocationState.Enabled; } /*