-
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
9308f02
c5b915d
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,25 @@ public void propagateChangeToAgents(Map<String, String> params) { | |
| } | ||
| } | ||
|
|
||
| @Override | ||
| public int getHostSshPort(HostVO host) { | ||
| if (host == null) { | ||
| return KVMHostDiscoverySshPort.value(); | ||
| } | ||
|
|
||
| if (host.getHypervisorType() != HypervisorType.KVM) { | ||
| return Host.DEFAULT_SSH_PORT; | ||
| } | ||
|
|
||
| _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
Contributor
Author
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. this method is called for KVM hypervisor only now, anyways added check to return default ssh port as 22 for other hypervisors.
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. Great, thanks |
||
| String hostPort = host.getDetail(Host.HOST_SSH_PORT); | ||
| if (StringUtils.isBlank(hostPort)) { | ||
| return KVMHostDiscoverySshPort.valueIn(host.getClusterId()); | ||
| } | ||
|
|
||
| return Integer.parseInt(hostPort); | ||
| } | ||
|
|
||
| private GlobalLock getHostJoinLock(Long hostId) { | ||
| return GlobalLock.getInternLock(String.format("%s-%s", "Host-Join", hostId)); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.