Daniel Erez has uploaded a new change for review.

Change subject: core: add snapshots names to merge_snapshots exection message
......................................................................

core: add snapshots names to merge_snapshots exection message

* Added source/destination snapshots' descriptions into
  MERGE_SNAPSHOT execution message.
* Modified RemoveSnapshotSingleDiskCommand -> getJobMessageProperties
  accordingly.

Change-Id: I5933904ef5cf67502607091df270009b20ac6df2
Signed-off-by: Daniel Erez <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotSingleDiskCommand.java
M 
backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
2 files changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/26324/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotSingleDiskCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotSingleDiskCommand.java
index 658a3a1..58806b5 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotSingleDiskCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotSingleDiskCommand.java
@@ -1,12 +1,13 @@
 package org.ovirt.engine.core.bll;
 
-import java.util.Collections;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.ImagesContainterParametersBase;
 import org.ovirt.engine.core.common.asynctasks.AsyncTaskType;
 import org.ovirt.engine.core.common.businessentities.DiskImage;
+import org.ovirt.engine.core.common.businessentities.Snapshot;
 import org.ovirt.engine.core.common.job.StepEnum;
 import 
org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters;
 import 
org.ovirt.engine.core.common.vdscommands.MergeSnapshotsVDSCommandParameters;
@@ -58,7 +59,15 @@
 
     @Override
     public Map<String, String> getJobMessageProperties() {
-        return 
Collections.singletonMap(VdcObjectType.Disk.name().toLowerCase(), 
getDiskImage().getDiskAlias());
+        if (jobProperties == null) {
+            jobProperties = super.getJobMessageProperties();
+            jobProperties.put(VdcObjectType.Disk.name().toLowerCase(), 
getDiskImage().getDiskAlias());
+            jobProperties.put("sourcesnapshot",
+                    
getSnapshotDescriptionById(getDiskImage().getVmSnapshotId()));
+            jobProperties.put("destinationsnapshot",
+                    
getSnapshotDescriptionById(getDestinationDiskImage().getVmSnapshotId()));
+        }
+        return jobProperties;
     }
 
     @Override
@@ -114,4 +123,9 @@
         // some and some?).
         setSucceeded(true);
     }
+
+    private String getSnapshotDescriptionById(Guid snapshotId) {
+        Snapshot snapshot = getSnapshotDao().get(snapshotId);
+        return snapshot != null ? snapshot.getDescription() : 
StringUtils.EMPTY;
+    }
 }
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
index 4c2e1b8..c6b96a9 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -123,7 +123,7 @@
 step.CREATE_VOLUME=Creating Volume
 step.DELETE_VOLUME=Deleting Volume
 step.DELETE_IMAGE=Deleting Image
-step.MERGE_SNAPSHOTS=Merging snapshots of disk ${Disk}
+step.MERGE_SNAPSHOTS=Merging snapshots (${SourceSnapshot} into 
${DestinationSnapshot}) of disk ${Disk}
 step.ADD_VM_TO_POOL=Creating VM ${VM} for VM Pool
 step.MIGRATE_VM=Migrating VM ${VM} from Host ${VDS}
 step.CREATING_SNAPSHOTS=Creating snapshots for VM ${VM}


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

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

Reply via email to