Hello mooli tayer,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/19166
to review the following change.
Change subject: engine: application touches a file to detect un orderly shutdown
......................................................................
engine: application touches a file to detect un orderly shutdown
Used to diagnose unexpected engine stop by the notification service.
Previously we used the pid file, buy this solution becomes irrelevant
for systemd.
Change-Id: Ic8de64637299e7932a5a2761c7bb495373c418aa
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=743660
Signed-off-by: Mooli Tayer <[email protected]>
---
M
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java
M
backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java
M packaging/services/ovirt-engine/ovirt-engine.conf.in
M packaging/services/ovirt-engine/ovirt-engine.py
4 files changed, 37 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/19166/1
diff --git
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java
index d03521b..b8107a6 100644
---
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java
+++
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java
@@ -209,4 +209,8 @@
public String getPKIEngineStoreAlias() {
return getProperty("ENGINE_PKI_ENGINE_STORE_ALIAS");
}
+
+ public File getEngineUpMark(){
+ return getFile("ENGINE_UP_MARK");
+ }
}
diff --git
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java
index 602fd83..6f9e16f 100644
---
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java
+++
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/EngineMonitorService.java
@@ -1,6 +1,5 @@
package org.ovirt.engine.core.notifier;
-import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
@@ -287,8 +286,9 @@
}
} else {
// reports an error for non responsive server
- if(new File(pidFile).exists()) {
- // assumed crash, since the pid file is still there
+ EngineLocalConfig config = EngineLocalConfig.getInstance();
+ if(config.getEngineUpMark().exists()) {
+ // assumed crash, since engine up file is still there
insertEventIntoAuditLogSafe(AuditLogType.VDC_STOP,
AuditLogSeverity.ERROR,
ENGINE_NOT_RESPONDING_ERROR,
diff --git a/packaging/services/ovirt-engine/ovirt-engine.conf.in
b/packaging/services/ovirt-engine/ovirt-engine.conf.in
index 1131a17..b0510c6 100644
--- a/packaging/services/ovirt-engine/ovirt-engine.conf.in
+++ b/packaging/services/ovirt-engine/ovirt-engine.conf.in
@@ -38,6 +38,12 @@
ENGINE_SPICE_HTML5_DIR="/usr/share/spice-html5"
#
+# A file created on init and removed on orderly shutdown
+# Used to diagnose unexpected engine stop by the notification service.
+#
+ENGINE_UP_MARK="${ENGINE_VAR}/engine.up"
+
+#
# Intervals for stoping the engine:
#
ENGINE_STOP_TIME=10
diff --git a/packaging/services/ovirt-engine/ovirt-engine.py
b/packaging/services/ovirt-engine/ovirt-engine.py
index 1c2a053..d7eafdc 100755
--- a/packaging/services/ovirt-engine/ovirt-engine.py
+++ b/packaging/services/ovirt-engine/ovirt-engine.py
@@ -447,17 +447,30 @@
return (consoleLog, consoleLog)
def daemonContext(self):
- self.daemonAsExternalProcess(
- executable=self._executable,
- args=self._engineArgs,
- env=self._engineEnv,
- stopTime=self._config.getinteger(
- 'ENGINE_STOP_TIME'
- ),
- stopInterval=self._config.getinteger(
- 'ENGINE_STOP_INTERVAL'
- ),
- )
+ try:
+ #
+ # create mark file to be used by notifier service
+ #
+ with open(self._config.get('ENGINE_UP_MARK'), 'w') as f:
+ f.write('%s\n' % os.getpid())
+
+ self.daemonAsExternalProcess(
+ executable=self._executable,
+ args=self._engineArgs,
+ env=self._engineEnv,
+ stopTime=self._config.getinteger(
+ 'ENGINE_STOP_TIME'
+ ),
+ stopInterval=self._config.getinteger(
+ 'ENGINE_STOP_INTERVAL'
+ ),
+ )
+
+ raise self.TerminateException()
+
+ except self.TerminateException:
+ if os.path.exists(self._config.get('ENGINE_UP_MARK')):
+ os.remove(self._config.get('ENGINE_UP_MARK'))
def daemonCleanup(self):
self._tempDir.destroy()
--
To view, visit http://gerrit.ovirt.org/19166
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8de64637299e7932a5a2761c7bb495373c418aa
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: mooli tayer <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches