Shahar Havivi has uploaded a new change for review.

Change subject: Engine: Add total time to migration
......................................................................

Engine: Add total time to migration

Engine is logging the actual time that last migration took, but not the
total time that all the migration process took (ie with retries).

Bug-Url: https://bugzilla.redhat.com/1054143
Change-Id: Ib87bb88de09a61b9c3e3d4565deb23c9cb07bbf3
Signed-off-by: Shahar Havivi <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MigrateVmParameters.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
3 files changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/35451/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 9542a99..63ab11c 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
@@ -3,7 +3,6 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-
 import org.apache.commons.lang.time.DurationFormatUtils;
 import org.ovirt.engine.core.bll.context.CommandContext;
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
@@ -473,10 +472,16 @@
         return destinationVdsId != null ? destinationVdsId : 
super.getCurrentVdsId();
     }
 
+    // Duration: time that took for the actual migration
     public String getDuration() {
         return DurationFormatUtils.formatDurationWords(new Date().getTime() - 
getParameters().getStartTime().getTime(), true, true);
     }
 
+    // TotalDuration: time that took migration including retries (can be 
identical to Duration)
+    public String getTotalDuration() {
+        return DurationFormatUtils.formatDurationWords(new Date().getTime() - 
getParameters().getTotalMigrationTime().getTime(), true, true);
+    }
+
     @Override
     protected String getLockMessage() {
         StringBuilder builder = new 
StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_BEING_MIGRATED.name());
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MigrateVmParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MigrateVmParameters.java
index 2e2bd87..13f97cc 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MigrateVmParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/MigrateVmParameters.java
@@ -2,7 +2,6 @@
 
 import java.util.ArrayList;
 import java.util.Date;
-
 import org.ovirt.engine.core.compat.Guid;
 
 /**
@@ -13,7 +12,10 @@
     private static final long serialVersionUID = -7523728706659584319L;
     protected boolean forceMigrationForNonMigratableVm;
     ArrayList<Guid> initialHosts;
+    // time that took the actual migration (from Engine point of view)
     protected Date startTime;
+    // Total time for migration (including retries)
+    protected Date totalMigrationTime;
     private Guid targetVdsGroupId;
 
     public MigrateVmParameters() {
@@ -60,6 +62,13 @@
 
     public void setStartTime(Date startTime) {
         this.startTime = startTime;
+        if (this.totalMigrationTime == null) {
+            this.totalMigrationTime = this.startTime;
+        }
+    }
+
+    public Date getTotalMigrationTime() {
+        return startTime;
     }
 
     public Guid getTargetVdsGroupId() {
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index eb6cc9e..cf5b9f4 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -248,7 +248,7 @@
 USER_SUSPEND_VM_OK=VM ${VmName} on Host ${VdsName} is suspended.
 VM_FAILURE=VM ${VmName} cannot be found on Host ${VdsName}.
 VM_MIGRATION_ABORT=Migration failed: ${MigrationError} (VM: ${VmName}, Source: 
${VdsName}, Destination: ${DestinationVdsName}).
-VM_MIGRATION_DONE=Migration completed (VM: ${VmName}, Source: ${VdsName}, 
Destination: ${DestinationVdsName}, Duration: ${Duration}).
+VM_MIGRATION_DONE=Migration completed (VM: ${VmName}, Source: ${VdsName}, 
Destination: ${DestinationVdsName}, Duration: ${Duration}, Total: 
${TotalDuration}).
 VM_MIGRATION_FAILED=Migration failed${DueToMigrationError} (VM: ${VmName}, 
Source: ${VdsName}, Destination: ${DestinationVdsName}).
 VM_MIGRATION_FAILED_NO_VDS_TO_RUN_ON=Migration failed, No available host found 
(VM: ${VmName}, Source: ${VdsName}).
 VM_MIGRATION_FAILED_DURING_MOVE_TO_MAINTENANCE=Migration 
failed${DueToMigrationError} while Host is in 'preparing for maintenance' 
state.\n  Consider manual intervention\: stopping/migrating Vms as Host's state 
will not\n  turn to maintenance while VMs are still running on it.(VM: 
${VmName}, Source: ${VdsName}, Destination: ${DestinationVdsName}).


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

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

Reply via email to