-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support for custom SSH port for KVM hosts from the host url on add host and the configuration #12571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Support for custom SSH port for KVM hosts from the host url on add host and the configuration #12571
Changes from all commits
9692e29
2e49b0c
5f4bc91
5347dce
fa48e90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
| import javax.inject.Inject; | ||
| import javax.naming.ConfigurationException; | ||
|
|
||
| import com.cloud.utils.StringUtils; | ||
| import org.apache.cloudstack.agent.lb.IndirectAgentLB; | ||
| import org.apache.cloudstack.ca.CAManager; | ||
| import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; | ||
|
|
@@ -55,7 +56,6 @@ | |
| import org.apache.commons.collections.MapUtils; | ||
| import org.apache.commons.lang3.BooleanUtils; | ||
| import org.apache.commons.lang3.ObjectUtils; | ||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.apache.logging.log4j.ThreadContext; | ||
|
|
||
| import com.cloud.agent.AgentManager; | ||
|
|
@@ -1977,7 +1977,7 @@ public ConfigKey<?>[] getConfigKeys() { | |
| return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize, | ||
| DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait, | ||
| GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections, | ||
| RemoteAgentNewConnectionsMonitorInterval }; | ||
| RemoteAgentNewConnectionsMonitorInterval, KVMHostDiscoverySshPort }; | ||
| } | ||
|
|
||
| protected class SetHostParamsListener implements Listener { | ||
|
|
@@ -2093,6 +2093,24 @@ public void propagateChangeToAgents(Map<String, String> params) { | |
| } | ||
| } | ||
|
|
||
| @Override | ||
| public int getHostSshPort(HostVO host) { | ||
| if (host == null) { | ||
| return KVMHostDiscoverySshPort.value(); | ||
| } | ||
|
|
||
| _hostDao.loadDetails(host); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be any check for the host hypervisor type? I think this should be only for KVM |
||
| String hostPort = host.getDetail(Host.HOST_SSH_POST); | ||
| int sshPort; | ||
| if (StringUtils.isBlank(hostPort)) { | ||
| sshPort = KVMHostDiscoverySshPort.valueIn(host.getClusterId()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to double check, in case the setting does not have a value on the cluster, will this method return the global set value, or the default value? It should honor the global value, only in case it is not set either, then use default value (22) |
||
| } else { | ||
| sshPort = Integer.parseInt(hostPort); | ||
| } | ||
|
|
||
| return sshPort; | ||
| } | ||
|
|
||
| private GlobalLock getHostJoinLock(Long hostId) { | ||
| return GlobalLock.getInternLock(String.format("%s-%s", "Host-Join", hostId)); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.