winterhazel commented on code in PR #12571:
URL: https://github.com/apache/cloudstack/pull/12571#discussion_r2793777942
##########
api/src/main/java/com/cloud/host/Host.java:
##########
@@ -59,6 +59,9 @@ public static String[] toStrings(Host.Type... types) {
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
String HOST_OVFTOOL_VERSION = "host.ovftool.version";
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
+ String HOST_SSH_POST = "host.ssh.port";
Review Comment:
```suggestion
String HOST_SSH_PORT = "host.ssh.port";
```
##########
engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java:
##########
@@ -2093,6 +2093,28 @@ 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);
+ String hostPort = host.getDetail(Host.HOST_SSH_POST);
+ int sshPort;
+ if (StringUtils.isBlank(hostPort)) {
+ sshPort = KVMHostDiscoverySshPort.valueIn(host.getClusterId());
+ } else {
+ sshPort = Integer.parseInt(hostPort);
+ }
+
+ return sshPort;
Review Comment:
```suggestion
if (StringUtils.isBlank(hostPort)) {
return KVMHostDiscoverySshPort.valueIn(host.getClusterId());
}
return Integer.parseInt(hostPort);
```
Just some small refactoring
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]