Arik Hadas has uploaded a new change for review.

Change subject: core: Refactor MigrateVmCommand#getAuditLogTypeValue
......................................................................

core: Refactor MigrateVmCommand#getAuditLogTypeValue

- Remove the usage of local field "startMessage" that was used only once
- Move the comment which explains the logic of this method outside of
  the method to increase its readability

Change-Id: Ic6f16b4dcf51de74898291b52d18a9d0eddac1c4
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
1 file changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/10113/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
index 8600273..7768c24 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
@@ -136,17 +136,20 @@
         ExecutionHandler.setAsyncJob(getExecutionContext(), true);
     }
 
+    /**
+     * command succeeded and VM is up => migration done
+     * command succeeded and VM is not up => migration started
+     * command failed and rerun flag is set => rerun migration was initiated
+     * command failed and rerun flag is not set => migration failed
+     */
     @Override
     public AuditLogType getAuditLogTypeValue() {
-        AuditLogType startMessage = isInternalExecution() ? 
AuditLogType.VM_MIGRATION_START_SYSTEM_INITIATED
-                : AuditLogType.VM_MIGRATION_START;
-        // all good, succeeded and the vm is up
-        // succeeded false, rerun
-        // succeeded false, rerun false = migration failed
         return getSucceeded() ?
                 getActionReturnValue() == VMStatus.Up ?
                         AuditLogType.VM_MIGRATION_DONE
-                        : startMessage
+                        : isInternalExecution() ?
+                                
AuditLogType.VM_MIGRATION_START_SYSTEM_INITIATED
+                                : AuditLogType.VM_MIGRATION_START
                 : _isRerun ?
                         AuditLogType.VM_MIGRATION_TRYING_RERUN
                         : getVds().getstatus() == 
VDSStatus.PreparingForMaintenance ?


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6f16b4dcf51de74898291b52d18a9d0eddac1c4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to