public class HostImpl extends Object implements Host
| Constructor and Description |
|---|
HostImpl(HostEntity hostEntity,
com.google.gson.Gson gson,
HostDAO hostDAO,
HostStateDAO hostStateDAO) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDesiredConfig(long clusterId,
boolean selected,
String user,
Config config)
Adds a desired configuration to the host instance.
|
void |
calculateHostStatus(Long clusterId) |
int |
compareTo(Object o) |
HostResponse |
convertToResponse() |
boolean |
equals(Object o) |
AgentVersion |
getAgentVersion()
Version of the Ambari Agent running on the host
|
AgentVersion |
getAgentVersion(HostStateEntity hostStateEntity)
Gets version of the ambari agent running on the host.
|
List<HostVersionEntity> |
getAllHostVersions()
Get all of the HostVersionEntity objects for the host.
|
long |
getAvailableMemBytes()
Get the Amount of available memory for the Host.
|
int |
getCpuCount() |
Integer |
getCurrentPingPort() |
Map<String,DesiredConfig> |
getDesiredConfigs(long clusterId)
Gets all the selected configurations for the host.
|
Map<String,HostConfig> |
getDesiredHostConfigs(Cluster cluster,
Map<String,DesiredConfig> clusterDesiredConfigs)
Get the desired configurations for the host including overrides
|
List<DiskInfo> |
getDisksInfo()
Get information on disks available on the host.
|
HostHealthStatus |
getHealthStatus() |
HostHealthStatus |
getHealthStatus(HostStateEntity hostStateEntity)
Gets the health status from host attributes
|
Map<String,String> |
getHostAttributes()
Get additional host attributes
For example, public/hostname/IP for AWS
|
Map<String,String> |
getHostAttributes(HostEntity hostEntity)
Gets host attributes from host entity
|
HostEntity |
getHostEntity() |
Long |
getHostId() |
String |
getHostName() |
HostStateEntity |
getHostStateEntity() |
String |
getIPv4()
IPv4 assigned to the Host
|
String |
getIPv6()
IPv6 assigned to the Host
|
AgentEnv |
getLastAgentEnv()
Gets the latest agent environment that arrived in a heartbeat.
|
long |
getLastAgentStartTime()
Time the Ambari Agent was started.
|
long |
getLastHeartbeatTime()
Last time the Ambari Server received a heartbeat from the Host
( Unix timestamp )
|
long |
getLastRegistrationTime()
Last time the host registered with the Ambari Server
( Unix timestamp )
|
MaintenanceState |
getMaintenanceState(long clusterId) |
String |
getOsArch()
Get the OS Architecture.
|
String |
getOsFamily()
Get the os Family:
redhat6: for centos6, rhel6, oraclelinux6 ..
|
String |
getOsFamily(Map<String,String> hostAttributes)
Gets the os family from host attributes
|
String |
getOSFamilyFromHostAttributes(Map<String,String> hostAttributes) |
String |
getOsInfo()
Get the General OS information.
|
String |
getOsType()
Get the OS Type: RHEL6/CentOS6/...
|
int |
getPhCpuCount() |
String |
getPrefix()
Get the prefix path of all logs
|
String |
getPublicHostName()
Sets the public-facing host name.
|
String |
getRackInfo() |
RecoveryReport |
getRecoveryReport()
Get detailed recovery report for the host
|
HostState |
getState()
Get Current Host State
|
String |
getStatus()
Get Current Host Status
|
long |
getTimeInState()
Get time spent in the current state i.e.
|
long |
getTotalMemBytes()
Get the Amount of physical memory for the Host.
|
void |
handleEvent(HostEvent event)
Send an event to the Host's StateMachine
|
boolean |
hasComponentsAdvertisingVersions(StackId stackId)
Gets whether this host has components which advertise their version.
|
int |
hashCode() |
void |
importHostInfo(HostInfo hostInfo) |
boolean |
isRepositoryVersionCorrect(RepositoryVersionEntity repositoryVersion)
Gets whether all host components whose desired repository version matches
the repository version specified have reported the correct version and are
no longer upgrading.
|
void |
setAgentVersion(AgentVersion agentVersion) |
void |
setAvailableMemBytes(long availableMemBytes)
Set the Amount of available memory for the Host.
|
void |
setCpuCount(int cpuCount) |
void |
setCurrentPingPort(Integer currentPingPort) |
void |
setDisksInfo(List<DiskInfo> disksInfo) |
void |
setHealthStatus(HostHealthStatus healthStatus) |
void |
setHostAttributes(Map<String,String> hostAttributes) |
void |
setIPv4(String ip) |
void |
setIPv6(String ip) |
void |
setLastAgentEnv(AgentEnv env)
Sets the latest agent environment that arrived in a heartbeat.
|
void |
setLastAgentStartTime(long lastAgentStartTime) |
void |
setLastHeartbeatTime(long lastHeartbeatTime) |
void |
setLastRegistrationTime(long lastRegistrationTime) |
void |
setMaintenanceState(long clusterId,
MaintenanceState state)
Sets the maintenance state for the host.
|
void |
setOsArch(String osArch) |
void |
setOsInfo(String osInfo) |
void |
setOsType(String osType) |
void |
setPhCpuCount(int phCpuCount) |
void |
setPrefix(String prefix)
Set the prefix path of all logs of the host
|
void |
setPublicHostName(String hostName)
Gets the public-facing host name.
|
void |
setRackInfo(String rackInfo) |
void |
setRecoveryReport(RecoveryReport recoveryReport)
Set detailed recovery report for the host
|
void |
setState(HostState state)
Set the State of the Host
|
void |
setStateMachineState(HostState state)
Set state of host's state machine.
|
void |
setStatus(String status)
Set the Status of the Host
|
void |
setTimeInState(long timeInState) |
void |
setTotalMemBytes(long totalMemBytes)
Set the Amount of physical memory for the Host.
|
void |
updateHost(HostRegistrationRequestEvent e) |
void |
updateHostTimestamps(HostRegistrationRequestEvent e) |
@Inject public HostImpl(HostEntity hostEntity, com.google.gson.Gson gson, HostDAO hostDAO, HostStateDAO hostStateDAO)
public int compareTo(Object o)
compareTo in interface Comparablepublic void importHostInfo(HostInfo hostInfo)
importHostInfo in interface HosthostInfo - the host informationpublic void setLastAgentEnv(AgentEnv env)
HostsetLastAgentEnv in interface Hostpublic AgentEnv getLastAgentEnv()
HostgetLastAgentEnv in interface Hostpublic void setState(HostState state)
Hostpublic void setStateMachineState(HostState state)
HostsetStateMachineState in interface Hostpublic void handleEvent(HostEvent event) throws InvalidStateTransitionException
HosthandleEvent in interface Hostevent - HostEventInvalidStateTransitionExceptionpublic String getHostName()
getHostName in interface Hostpublic Integer getCurrentPingPort()
getCurrentPingPort in interface Hostpublic void setCurrentPingPort(Integer currentPingPort)
setCurrentPingPort in interface HostcurrentPingPort - the currentPingPort to setpublic void setPublicHostName(String hostName)
HostsetPublicHostName in interface Hostpublic String getPublicHostName()
HostgetPublicHostName in interface Hostpublic void setIPv4(String ip)
public void setIPv6(String ip)
public int getCpuCount()
getCpuCount in interface Hostpublic void setCpuCount(int cpuCount)
setCpuCount in interface HostcpuCount - the cpuCount to setpublic int getPhCpuCount()
getPhCpuCount in interface Hostpublic void setPhCpuCount(int phCpuCount)
setPhCpuCount in interface HostphCpuCount - the physical cpu cores to setpublic long getTotalMemBytes()
HostgetTotalMemBytes in interface Hostpublic void setTotalMemBytes(long totalMemBytes)
HostsetTotalMemBytes in interface HosttotalMemBytes - the totalMemBytes to setpublic long getAvailableMemBytes()
HostgetAvailableMemBytes in interface Hostpublic void setAvailableMemBytes(long availableMemBytes)
HostsetAvailableMemBytes in interface HostavailableMemBytes - the availableMemBytes to setpublic String getOsArch()
Hostpublic void setOsArch(String osArch)
public String getOsInfo()
Hostpublic void setOsInfo(String osInfo)
public String getOsType()
Hostpublic void setOsType(String osType)
public String getOsFamily()
HostgetOsFamily in interface Hostpublic String getOsFamily(Map<String,String> hostAttributes)
HostgetOsFamily in interface HosthostAttributes - host attributespublic String getOSFamilyFromHostAttributes(Map<String,String> hostAttributes)
getOSFamilyFromHostAttributes in interface Hostpublic List<DiskInfo> getDisksInfo()
HostgetDisksInfo in interface Hostpublic void setDisksInfo(List<DiskInfo> disksInfo)
setDisksInfo in interface HostdisksInfo - the disksInfo to setpublic RecoveryReport getRecoveryReport()
HostgetRecoveryReport in interface Hostpublic void setRecoveryReport(RecoveryReport recoveryReport)
HostsetRecoveryReport in interface Hostpublic HostHealthStatus getHealthStatus()
getHealthStatus in interface Hostpublic HostHealthStatus getHealthStatus(HostStateEntity hostStateEntity)
HostgetHealthStatus in interface HosthostStateEntity - host attributespublic void setHealthStatus(HostHealthStatus healthStatus)
setHealthStatus in interface HosthealthStatus - the healthStatus to setpublic String getPrefix()
Hostpublic void setPrefix(String prefix)
Hostpublic Map<String,String> getHostAttributes()
HostgetHostAttributes in interface Hostpublic Map<String,String> getHostAttributes(HostEntity hostEntity)
HostgetHostAttributes in interface HosthostEntity - host entitypublic void setHostAttributes(Map<String,String> hostAttributes)
setHostAttributes in interface HosthostAttributes - the hostAttributes to setpublic String getRackInfo()
getRackInfo in interface Hostpublic void setRackInfo(String rackInfo)
setRackInfo in interface HostrackInfo - the rackInfo to setpublic long getLastRegistrationTime()
HostgetLastRegistrationTime in interface Hostpublic void setLastRegistrationTime(long lastRegistrationTime)
setLastRegistrationTime in interface HostlastRegistrationTime - the lastRegistrationTime to setpublic long getLastHeartbeatTime()
HostgetLastHeartbeatTime in interface Hostpublic void setLastHeartbeatTime(long lastHeartbeatTime)
setLastHeartbeatTime in interface HostlastHeartbeatTime - the lastHeartbeatTime to setpublic long getLastAgentStartTime()
HostgetLastAgentStartTime in interface Hostpublic void setLastAgentStartTime(long lastAgentStartTime)
setLastAgentStartTime in interface HostlastAgentStartTime - the lastAgentStartTime to setpublic AgentVersion getAgentVersion()
HostgetAgentVersion in interface Hostpublic AgentVersion getAgentVersion(HostStateEntity hostStateEntity)
HostgetAgentVersion in interface HosthostStateEntity - host state entitypublic void setAgentVersion(AgentVersion agentVersion)
setAgentVersion in interface HostagentVersion - the agentVersion to setpublic long getTimeInState()
HostgetTimeInState in interface Hostpublic void setTimeInState(long timeInState)
setTimeInState in interface HosttimeInState - the timeInState to setpublic void setStatus(String status)
Hostpublic HostResponse convertToResponse()
convertToResponse in interface Hostpublic boolean addDesiredConfig(long clusterId,
boolean selected,
String user,
Config config)
HostaddDesiredConfig in interface HostclusterId - the cluster id that the config applies toselected - true if the configuration is selected. Applies
only to remove the override, otherwise this value should always be true.user - the user making the change for audit purposesconfig - the configuration objecttrue if the config was added, or false
if the config is already set as the currentpublic Map<String,DesiredConfig> getDesiredConfigs(long clusterId)
HostDesiredConfig instances.getDesiredConfigs in interface Hostpublic Map<String,HostConfig> getDesiredHostConfigs(Cluster cluster, Map<String,DesiredConfig> clusterDesiredConfigs) throws org.apache.ambari.server.AmbariException
getDesiredHostConfigs in interface HostclusterDesiredConfigs - the desired configurations for the cluster. Obtaining these can be
expensive and since this method operates on hosts, it could be
called 1,000's of times when generating host responses. Therefore,
the caller should build these once and pass them in. If
null, then this method will retrieve them at runtime,
incurring a performance penality.org.apache.ambari.server.AmbariExceptionpublic void setMaintenanceState(long clusterId,
MaintenanceState state)
HostsetMaintenanceState in interface HostclusterId - the cluster idstate - the statepublic MaintenanceState getMaintenanceState(long clusterId)
getMaintenanceState in interface HostclusterId - the cluster idpublic List<HostVersionEntity> getAllHostVersions()
getAllHostVersions in interface Hostpublic HostEntity getHostEntity()
getHostEntity in interface Hostpublic HostStateEntity getHostStateEntity()
public boolean hasComponentsAdvertisingVersions(StackId stackId) throws org.apache.ambari.server.AmbariException
hasComponentsAdvertisingVersions in interface HoststackId - the version of the stack to use when checking version
advertise-ability.true if at least 1 component on this host advertises its
version.org.apache.ambari.server.AmbariException - if there is a problem retrieving the component from the stack.ComponentInfo.isVersionAdvertised()public void calculateHostStatus(Long clusterId) throws org.apache.ambari.server.AmbariException
calculateHostStatus in interface Hostorg.apache.ambari.server.AmbariExceptionpublic void updateHost(HostRegistrationRequestEvent e)
public void updateHostTimestamps(HostRegistrationRequestEvent e)
public boolean isRepositoryVersionCorrect(RepositoryVersionEntity repositoryVersion) throws org.apache.ambari.server.AmbariException
isRepositoryVersionCorrect in interface HostrepositoryVersion - the repository version to check for (not null).true if all components on this host have checked in with
the correct version if their desired repository matches the one
specified.org.apache.ambari.server.AmbariExceptionCopyright © 2022 Apache Software Foundation. All rights reserved.