Skip to content

Commit 9308f02

Browse files
review comments
1 parent fa48e90 commit 9308f02

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

api/src/main/java/com/cloud/host/Host.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public static String[] toStrings(Host.Type... types) {
6161
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
6262
String HOST_SSH_POST = "host.ssh.port";
6363

64+
int DEFAULT_SSH_PORT = 22;
65+
6466
/**
6567
* @return name of the machine.
6668
*/

api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class AddHostCmd extends BaseCmd {
6060
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The Pod ID for the host")
6161
private Long podId;
6262

63-
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL, optionally add ssh port for KVM hosts," +
63+
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL, optionally add ssh port (format: 'host:port') for KVM hosts," +
6464
" otherwise falls back to the port defined at the config 'kvm.host.discovery.ssh.port'")
6565
private String url;
6666

engine/components-api/src/main/java/com/cloud/agent/AgentManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public interface AgentManager {
5555
"For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", false);
5656

5757
ConfigKey<Integer> KVMHostDiscoverySshPort = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class,
58-
"kvm.host.discovery.ssh.port", "22", "SSH port used for KVM host discovery and any other operations on host (using SSH)." +
58+
"kvm.host.discovery.ssh.port", String.valueOf(Host.DEFAULT_SSH_PORT), "SSH port used for KVM host discovery and any other operations on host (using SSH)." +
5959
" Please note that this is applicable when port is not defined through host url while adding the KVM host.", true, ConfigKey.Scope.Cluster);
6060

6161
enum TapAgentsAction {

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,6 +2099,10 @@ public int getHostSshPort(HostVO host) {
20992099
return KVMHostDiscoverySshPort.value();
21002100
}
21012101

2102+
if (host.getHypervisorType() != HypervisorType.KVM) {
2103+
return Host.DEFAULT_SSH_PORT;
2104+
}
2105+
21022106
_hostDao.loadDetails(host);
21032107
String hostPort = host.getDetail(Host.HOST_SSH_POST);
21042108
int sshPort;

0 commit comments

Comments
 (0)