Alon Bar-Lev has uploaded a new change for review.

Change subject: host-deploy: utilize engine correlation id
......................................................................

host-deploy: utilize engine correlation id

1. Apply correlation id to events.

2. Add correlation id to deploy log file name.

3. Add correlation id eye catcher to otopi environment, it is ignored by
   otopi and ovirt-host-deploy, but usable for debugging.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=902949
Change-Id: I5dba5b6d1319f0b4caa6f0d3e77683a098df31e5
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
3 files changed, 23 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/11287/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
index 2fe1622..765c1a8 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
@@ -132,6 +132,7 @@
 
                 T parameters = getParameters();
                 installer = new VdsDeploy(getVds());
+                installer.setCorrelationId(getCorrelationId());
                 installer.setReboot(parameters.isRebootAfterInstallation());
                 switch (getVds().getvds_type()) {
                 case VDS:
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
index 1190832..5526bf2 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallerMessages.java
@@ -12,6 +12,7 @@
 
 public class InstallerMessages {
     private VDS _vds;
+    private String _correlationId;
     private int _sequence = 0;
 
     public enum Severity {
@@ -24,9 +25,14 @@
         _vds = vds;
     }
 
+    public void setCorrelationId(String correlationId) {
+        _correlationId = correlationId;
+    }
+
     public void post(Severity severity, String text) {
         AuditLogType logType;
         AuditLogableBase logable = new AuditLogableBase(_vds.getId());
+        logable.setCorrelationId(_correlationId);
         logable.AddCustomValue("Message", text);
         switch (severity) {
         case INFO:
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
index e020052..ae3adcf 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
@@ -86,6 +86,7 @@
     private VDS _vds;
     private boolean _isNode = false;
     private boolean _reboot = false;
+    private String _correlationId = null;
     private Exception _failException = null;
     private boolean _resultError = false;
     private boolean _goingToReboot = false;
@@ -290,6 +291,13 @@
      * tick.
      */
     private final Callable[] _customizationDialog = new Callable[] {
+        new Callable<Object>() { public Object call() throws Exception {
+            _parser.cliEnvironmentSet(
+                "OVIRT_ENGINE_CORRELATION_ID",
+                _correlationId
+            );
+            return null;
+        }},
         new Callable<Object>() { public Object call() throws Exception {
             if (
                 (Boolean)_parser.cliEnvironmentGet(
@@ -560,13 +568,14 @@
             File logFile = new File(
                 LocalConfig.getInstance().getLogDir(),
                 String.format(
-                    "%1$s%2$sovirt-%3$s-%4$s.log",
+                    "%1$s%2$sovirt-%3$s-%4$s-%5$s.log",
                     "host-deploy",
                     File.separator,
                     new SimpleDateFormat("yyyyMMddHHmmss").format(
                         Calendar.getInstance().getTime()
                     ),
-                    _vds.gethost_name()
+                    _vds.gethost_name(),
+                    _correlationId
                 )
             );
             _messages.post(
@@ -820,6 +829,11 @@
         _reboot = reboot;
     }
 
+    public void setCorrelationId(String correlationId) {
+        _correlationId = correlationId;
+        _messages.setCorrelationId(_correlationId);
+    }
+
     /**
      * Set user.
      * @param user user.


--
To view, visit http://gerrit.ovirt.org/11287
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5dba5b6d1319f0b4caa6f0d3e77683a098df31e5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to