diff --git a/conf/globalConfig/consoleConfig.xml b/conf/globalConfig/consoleConfig.xml
index a694afd51ea..9aaaed9ecd3 100755
--- a/conf/globalConfig/consoleConfig.xml
+++ b/conf/globalConfig/consoleConfig.xml
@@ -36,7 +36,7 @@
console
vnc.allow.ports
tcp or udp ports allowed by vnc, udp port start with 'u' like 'u67', port range can be like this: 1100:1200, multiple port or port range can be separated by ”,“
- 4900,4901
+ {consoleProxyPort},4901
java.lang.String
diff --git a/conf/globalConfig/kvm.xml b/conf/globalConfig/kvm.xml
index 3a63008594f..dd23f6cfef7 100755
--- a/conf/globalConfig/kvm.xml
+++ b/conf/globalConfig/kvm.xml
@@ -174,7 +174,7 @@
kvm
kvmagent.allow.ports
tcp or udp ports allowed by kvmagent, udp port start with 'u' like 'u67', port range can be like this: 1100:1200, multiple port or port range can be separated by ”,“
- 22,7070,16509,49152:49261,2049,20000:30000,u4789,u8472,7069,9100,9103,9092
+ 22,{KvmAgent.port},16509,49152:49261,2049,20000:30000,u4789,u8472,{KvmAgent.prometheusPort},{KvmAgent.nodeExportPort},{KvmAgent.collectdExposePort},{kvmhost.pushgateway.webListenPort}
java.lang.String
diff --git a/conf/springConfigXml/ConsoleManager.xml b/conf/springConfigXml/ConsoleManager.xml
index efc4edcaf17..8258f97d4ad 100755
--- a/conf/springConfigXml/ConsoleManager.xml
+++ b/conf/springConfigXml/ConsoleManager.xml
@@ -43,7 +43,5 @@
-
-
diff --git a/console/src/main/java/org/zstack/console/ConsoleGlobalProperty.java b/console/src/main/java/org/zstack/console/ConsoleGlobalProperty.java
index 8dc256f8861..cabdbf07171 100644
--- a/console/src/main/java/org/zstack/console/ConsoleGlobalProperty.java
+++ b/console/src/main/java/org/zstack/console/ConsoleGlobalProperty.java
@@ -13,4 +13,6 @@ public class ConsoleGlobalProperty {
public static String AGENT_PACKAGE_NAME;
@GlobalProperty(name="MN.network.", defaultValue = "")
public static List MN_NETWORKS;
+ @GlobalProperty(name="ConsoleProxy.agentPort", defaultValue = "7758")
+ public static int AGENT_PORT;
}
diff --git a/console/src/main/java/org/zstack/console/ManagementServerConsoleProxyBackend.java b/console/src/main/java/org/zstack/console/ManagementServerConsoleProxyBackend.java
index 2c4a34c1ef2..b62238fb3ed 100755
--- a/console/src/main/java/org/zstack/console/ManagementServerConsoleProxyBackend.java
+++ b/console/src/main/java/org/zstack/console/ManagementServerConsoleProxyBackend.java
@@ -57,7 +57,6 @@
*/
public class ManagementServerConsoleProxyBackend extends AbstractConsoleProxyBackend {
private static final CLogger logger = Utils.getLogger(ManagementServerConsoleProxyBackend.class);
- private int agentPort = 7758;
private String agentPackageName = ConsoleGlobalProperty.AGENT_PACKAGE_NAME;
private boolean connected = false;
@@ -91,7 +90,7 @@ protected int setConsoleProxyPort(int Port) {
}
protected ConsoleProxy getConsoleProxy(VmInstanceInventory vm, ConsoleProxyVO vo) {
- return new ConsoleProxyBase(vo, getAgentPort());
+ return new ConsoleProxyBase(vo, ConsoleGlobalProperty.AGENT_PORT);
}
@Override
@@ -104,7 +103,7 @@ protected ConsoleProxy getConsoleProxy(SessionInventory session, VmInstanceInven
inv.setAgentType(getConsoleBackendType());
inv.setToken(session.getUuid() + "_" + vm.getUuid());
inv.setVmInstanceUuid(vm.getUuid());
- return new ConsoleProxyBase(inv, getAgentPort());
+ return new ConsoleProxyBase(inv, ConsoleGlobalProperty.AGENT_PORT);
}
private void setupPublicKey() {
@@ -169,8 +168,8 @@ public void run() {
builder.append(String.format(";sudo iptables -w -I INPUT -m set --match-set ZS-MN src -p tcp -m comment --comment %s -m tcp --dport %s -j ACCEPT",
ConsoleConstants.VNC_IPTABLES_COMMENTS, dport));
}
- builder.append(String.format(";sudo iptables -w -I INPUT -m set --match-set ZS-MN src -p tcp -m comment --comment %s -m tcp ! -s 127.0.0.1 --dport %s -j REJECT",
- ConsoleConstants.VNC_IPTABLES_COMMENTS, agentPort));
+ builder.append(String.format(";sudo iptables -I INPUT -m set --match-set ZS-MN src -p tcp -m comment --comment %s -m tcp ! -s 127.0.0.1 --dport %s -j REJECT",
+ ConsoleConstants.VNC_IPTABLES_COMMENTS, ConsoleGlobalProperty.AGENT_PORT));
} else {
builder.append(String.format("sudo iptables-save | grep '%s' | while read LINE;do drule=${LINE//\\\"/};sudo iptables -w ${drule/-A/-D};done",
ConsoleConstants.VNC_IPTABLES_COMMENTS));
@@ -178,8 +177,8 @@ public void run() {
builder.append(String.format(";sudo iptables -w -I INPUT -p tcp -m comment --comment %s -m tcp --dport %s -j ACCEPT",
ConsoleConstants.VNC_IPTABLES_COMMENTS, dport));
}
- builder.append(String.format(";sudo iptables -w -I INPUT -p tcp -m comment --comment %s -m tcp ! -s 127.0.0.1 --dport %s -j REJECT",
- ConsoleConstants.VNC_IPTABLES_COMMENTS, agentPort));
+ builder.append(String.format(";sudo iptables -I INPUT -p tcp -m comment --comment %s -m tcp ! -s 127.0.0.1 --dport %s -j REJECT",
+ ConsoleConstants.VNC_IPTABLES_COMMENTS, ConsoleGlobalProperty.AGENT_PORT));
}
ShellUtils.run(builder.toString());
@@ -208,15 +207,29 @@ public void run() {
runner.installChecker(checker);
runner.setUsername("root");
runner.setPrivateKey(privKey);
- runner.setAgentPort(7758);
+ runner.setAgentPort(ConsoleGlobalProperty.AGENT_PORT);
runner.setTargetIp(Platform.getManagementServerIp());
runner.setTargetUuid(Platform.getManagementServerId());
runner.setPlayBookName(ANSIBLE_PLAYBOOK_NAME);
runner.setFullDeploy(fullDeploy);
+<<<<<<< HEAD
ConsoleProxyDeployArguments deployArguments = new ConsoleProxyDeployArguments();
deployArguments.setHttpConsoleProxyPort(String.valueOf(CoreGlobalProperty.HTTP_CONSOLE_PROXY_PORT));
runner.setDeployArguments(deployArguments);
+=======
+ runner.putArgument("pkg_consoleproxy", agentPackageName);
+ runner.putArgument("http_console_proxy_port", CoreGlobalProperty.HTTP_CONSOLE_PROXY_PORT);
+ runner.putArgument("console_proxy_agent_port", ConsoleGlobalProperty.AGENT_PORT);
+ if (CoreGlobalProperty.SYNC_NODE_TIME) {
+ if (CoreGlobalProperty.CHRONY_SERVERS == null || CoreGlobalProperty.CHRONY_SERVERS.isEmpty()) {
+ completion.fail(operr("chrony server not configured!"));
+ chain.next();
+ return;
+ }
+ runner.putArgument("chrony_servers", String.join(",", CoreGlobalProperty.CHRONY_SERVERS));
+ }
+>>>>>>> 79bcc5c08d ([BugFix: ZSTACK-25869]internal-port)
runner.run(new ReturnValueCompletion(completion, chain) {
@Override
public void success(Boolean deployed) {
@@ -298,7 +311,7 @@ private void handleLocalMessage(Message msg) {
private void handle(PingConsoleProxyAgentMsg msg) {
ConsoleProxyCommands.PingCmd cmd = new ConsoleProxyCommands.PingCmd();
- String url = URLBuilder.buildHttpUrl("127.0.0.1", agentPort, ConsoleConstants.CONSOLE_PROXY_PING_PATH);
+ String url = URLBuilder.buildHttpUrl("127.0.0.1", ConsoleGlobalProperty.AGENT_PORT, ConsoleConstants.CONSOLE_PROXY_PING_PATH);
ConsoleProxyAgentVO vo = dbf.findByUuid(Platform.getManagementServerId(), ConsoleProxyAgentVO.class);
boolean success;
@@ -574,13 +587,4 @@ public boolean start() {
tracker.track(Platform.getManagementServerId());
return super.start();
}
-
-
- public int getAgentPort() {
- return agentPort;
- }
-
- public void setAgentPort(int agentPort) {
- this.agentPort = agentPort;
- }
}
diff --git a/core/src/main/java/org/zstack/core/config/GlobalConfig.java b/core/src/main/java/org/zstack/core/config/GlobalConfig.java
index 3dd22b96279..a416c01a5bf 100755
--- a/core/src/main/java/org/zstack/core/config/GlobalConfig.java
+++ b/core/src/main/java/org/zstack/core/config/GlobalConfig.java
@@ -337,6 +337,7 @@ public void run(Map tokens, Object data) {
private void update(String newValue, boolean localUpdate) {
// substitute system properties in newValue
newValue = StringTemplate.substitute(newValue, propertiesMap);
+ newValue = StringTemplate.substitute(newValue, Platform.getGlobalProperties());
validate(newValue);
diff --git a/core/src/main/java/org/zstack/core/config/GlobalConfigFacadeImpl.java b/core/src/main/java/org/zstack/core/config/GlobalConfigFacadeImpl.java
index 3b9e489eaf7..e9072b058a9 100755
--- a/core/src/main/java/org/zstack/core/config/GlobalConfigFacadeImpl.java
+++ b/core/src/main/java/org/zstack/core/config/GlobalConfigFacadeImpl.java
@@ -1,6 +1,7 @@
package org.zstack.core.config;
import org.springframework.beans.factory.annotation.Autowired;
+import org.zstack.core.Platform;
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.cloudbus.MessageSafe;
import org.zstack.core.componentloader.PluginRegistry;
@@ -224,6 +225,7 @@ private void loadConfigFromJava() {
}
// substitute system properties in defaultValue
String defaultValue = StringTemplate.substitute(d.defaultValue(), propertiesMap);
+ defaultValue = StringTemplate.substitute(defaultValue, Platform.getGlobalProperties());
GlobalConfig c = new GlobalConfig();
c.setCategory(config.getCategory());
@@ -512,11 +514,13 @@ private void parseConfig(File file) throws JAXBException {
throw new IllegalArgumentException(String.format("GlobalConfig[category:%s, name:%s] must have a default value", c.getCategory(), c.getName()));
} else {
c.setDefaultValue(StringTemplate.substitute(c.getDefaultValue(), propertiesMap));
+ c.setDefaultValue(StringTemplate.substitute(c.getDefaultValue(), Platform.getGlobalProperties()));
}
if (c.getValue() == null) {
c.setValue(c.getDefaultValue());
} else {
c.setValue(StringTemplate.substitute(c.getValue(), propertiesMap));
+ c.setValue(StringTemplate.substitute(c.getValue(), Platform.getGlobalProperties()));
}
GlobalConfig config = GlobalConfig.valueOf(c);
if (configsFromXml.containsKey(config.getIdentity())) {
diff --git a/plugin/kvm/src/main/java/org/zstack/kvm/KVMGlobalProperty.java b/plugin/kvm/src/main/java/org/zstack/kvm/KVMGlobalProperty.java
index 37605df2f16..55e01de4880 100755
--- a/plugin/kvm/src/main/java/org/zstack/kvm/KVMGlobalProperty.java
+++ b/plugin/kvm/src/main/java/org/zstack/kvm/KVMGlobalProperty.java
@@ -29,7 +29,18 @@ public class KVMGlobalProperty {
public static String TAKEVOERFLAGPATH;
@GlobalProperty(name="MN.network.", defaultValue = "")
public static List MN_NETWORKS;
+<<<<<<< HEAD
@GlobalProperty(name = "host.skip.packages", defaultValue = "qemu, qemu-kvm, qemu-kvm-ev, qemu-img, qemu-img-ev")
public static String SKIP_PACKAGES;
+=======
+ @GlobalProperty(name="KvmAgent.prometheusPort", defaultValue = "7069")
+ public static int PROMETHEUS_PORT;
+ @GlobalProperty(name="KvmAgent.collectdExposePort", defaultValue = "9103")
+ public static int COLLECTD_EXPOSE_PORT;
+ @GlobalProperty(name="KvmAgent.nodeExportPort", defaultValue = "9100")
+ public static int NODE_EXPORT_PORT;
+ @GlobalProperty(name="KvmAgent.collectdAcceptPort", defaultValue = "25826")
+ public static int COLLECTD_ACCEPT_PORT;
+>>>>>>> 79bcc5c08d ([BugFix: ZSTACK-25869]internal-port)
}
diff --git a/plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java b/plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
index d75b6ee336c..37d96d0cc72 100755
--- a/plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
+++ b/plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
@@ -4122,8 +4122,14 @@ public void run(final FlowTrigger trigger, Map data) {
ub.path(new StringBind(KVMConstant.KVM_ANSIBLE_LOG_PATH_FROMAT).bind("uuid", self.getUuid()).toString());
String postUrl = ub.build().toString();
+<<<<<<< HEAD
deployArguments.setPostUrl(postUrl);
runner.setDeployArguments(deployArguments);
+=======
+ runner.putArgument("post_url", postUrl);
+ runner.putArgument("kvmagent_prometheus_port", String.valueOf(KVMGlobalProperty.PROMETHEUS_PORT));
+ runner.putArgument("kvmagent_port", String.valueOf(KVMGlobalProperty.AGENT_PORT));
+>>>>>>> 79bcc5c08d ([BugFix: ZSTACK-25869]internal-port)
runner.run(new ReturnValueCompletion(trigger) {
@Override
public void success(Boolean run) {
diff --git a/plugin/loadBalancer/src/main/java/org/zstack/network/service/lb/LoadBalancerConstants.java b/plugin/loadBalancer/src/main/java/org/zstack/network/service/lb/LoadBalancerConstants.java
index 72a36ecfa25..1d306de27b0 100755
--- a/plugin/loadBalancer/src/main/java/org/zstack/network/service/lb/LoadBalancerConstants.java
+++ b/plugin/loadBalancer/src/main/java/org/zstack/network/service/lb/LoadBalancerConstants.java
@@ -1,5 +1,6 @@
package org.zstack.network.service.lb;
+import org.zstack.core.Platform;
import org.zstack.header.network.service.NetworkServiceType;
import org.zstack.header.vm.VmInstanceConstant;
@@ -64,7 +65,7 @@ public static enum HealthCheckStatusCode {
public static final int DNS_PORT = 53;
public static final int SSH_PORT = 22;
- public static final int ZVR_PORT = 7272;
+ public static final int ZVR_PORT = Integer.parseInt(Platform.getGlobalProperties().get("VirtualRouter.agentPort"));
/*max concurrent connect no more than MAX_CONNECTION_LIMIT per listener*/
public static final long MAX_CONNECTION_LIMIT = 10000000;