This is an automated email from the ASF dual-hosted git repository.
rafael pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new 143fe53 Allow enable the Java remote Debug for CloudStack Agent
(#2897)
143fe53 is described below
commit 143fe5375cdacdef18e02b1ade1254c72e790d9a
Author: Gabriel Beims Bräscher <[email protected]>
AuthorDate: Tue Oct 16 15:57:13 2018 -0300
Allow enable the Java remote Debug for CloudStack Agent (#2897)
The idea is to create a property in /etc/defaults/cloudstack-agent that
can be enabled/disabled (uncommented/commented) to control the enabling
of Java remote debug in CloudStack's JVM.
---
packaging/systemd/cloudstack-agent.default | 4 ++++
packaging/systemd/cloudstack-agent.service | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/packaging/systemd/cloudstack-agent.default
b/packaging/systemd/cloudstack-agent.default
index 41fa85b..519f44a 100644
--- a/packaging/systemd/cloudstack-agent.default
+++ b/packaging/systemd/cloudstack-agent.default
@@ -20,3 +20,7 @@ JAVA_HEAP_INITIAL=256m
JAVA_HEAP_MAX=2048m
JAVA_CLASS=com.cloud.agent.AgentShell
JAVA_TMPDIR=/usr/share/cloudstack-agent/tmp
+
+#You can uncomment this if you want to enable Java remote debugging.
+#Feel free to change the parameters at your will. The 'address' field defines
the port to be used.
+#JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
diff --git a/packaging/systemd/cloudstack-agent.service
b/packaging/systemd/cloudstack-agent.service
index 9cde22d..8acab59 100644
--- a/packaging/systemd/cloudstack-agent.service
+++ b/packaging/systemd/cloudstack-agent.service
@@ -28,7 +28,7 @@ ExecStart=/bin/sh -ec '\
export ACP=`ls /usr/share/cloudstack-agent/lib/*.jar
/usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null|tr "\\n" ":"`; \
export
CLASSPATH="$ACP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts"; \
mkdir -m 0755 -p ${JAVA_TMPDIR}; \
- ${JAVA} -Djava.io.tmpdir="${JAVA_TMPDIR}" -Xms${JAVA_HEAP_INITIAL}
-Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
+ ${JAVA} -Djava.io.tmpdir="${JAVA_TMPDIR}" -Xms${JAVA_HEAP_INITIAL}
-Xmx${JAVA_HEAP_MAX} $JAVA_DEBUG -cp "$CLASSPATH" $JAVA_CLASS'
Restart=always
RestartSec=10s