Libor Spevak has uploaded a new change for review. Change subject: engine,webadmin: Provide snapshot name to audit log ......................................................................
engine,webadmin: Provide snapshot name to audit log VM snapshot name not provided in the event log when a snapshot is previewed problem fixed. Change-Id: I6988302018ff04966f973f3950c12cad6072ab82 Signed-off-by: Libor Spevak <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties 2 files changed, 19 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/13431/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java index 3bab2e9..01599db 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java @@ -51,15 +51,15 @@ public TryBackToAllSnapshotsOfVmCommand(T parameters) { super(parameters); parameters.setEntityId(getVmId()); + initializeSnapshotName(); } @Override public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); - Snapshot snapshot = getSnapshotDao().get(getParameters().getDstSnapshotId()); - if (snapshot != null) { - jobProperties.put(VdcObjectType.Snapshot.name().toLowerCase(), snapshot.getDescription()); + if (getSnapshotName() != null) { + jobProperties.put(VdcObjectType.Snapshot.name().toLowerCase(), getSnapshotName()); } } return jobProperties; @@ -118,6 +118,7 @@ .getInstance() .getDiskImageDao() .getAllSnapshotsForVmSnapshot(getParameters().getDstSnapshotId()); + TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { @@ -262,4 +263,15 @@ protected Map<String, Pair<String, String>> getExclusiveLocks() { return Collections.singletonMap(getVmId().toString(), LockMessagesMatchUtil.VM); } + + /** + * Setup preview snapshot name for audit log messages. + */ + private void initializeSnapshotName() { + final Snapshot snapshot = getSnapshotDao().get(getParameters().getDstSnapshotId()); + if (snapshot != null) { + setSnapshotName(snapshot.getDescription()); + } + } + } 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 0aff7b0..f997356 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -127,7 +127,7 @@ USER_COPIED_TEMPLATE_FINISHED_SUCCESS=Template ${VmTemplateName} copy to Domain ${StorageDomainName} has been completed. USER_COPIED_TEMPLATE_FINISHED_FAILURE=Failed to complete copy of Template ${VmTemplateName} to Domain ${StorageDomainName}. USER_FAILED_COPY_TEMPLATE=Failed to initiate copy of Template ${VmTemplateName} to Domain ${StorageDomainName} (User: ${UserName}). -USER_FAILED_TRY_BACK_TO_SNAPSHOT=Failed to preview Snapshot for VM ${VmName} (User: ${UserName}). +USER_FAILED_TRY_BACK_TO_SNAPSHOT=Failed to preview Snapshot ${SnapshotName} for VM ${VmName} (User: ${UserName}). USER_FAILED_UPDATE_VDS=Failed to update Host ${VdsName} (User: ${UserName}). USER_FAILED_UPDATE_VM=Failed to update VM ${VmName} (User: ${UserName}). USER_FAILED_UPDATE_VM_TEMPLATE=Failed to update Template ${VmTemplateName} (User: ${UserName}). @@ -158,9 +158,9 @@ USER_STOP_VM=VM ${VmName} powered off by ${UserName} (Host: ${VdsName}). USER_STOP_SUSPENDED_VM=Suspended VM ${VmName} powered off by ${UserName}. USER_STOP_SUSPENDED_VM_FAILED=Failed to power off suspended VM ${VmName} (User: ${UserName}). -USER_TRY_BACK_TO_SNAPSHOT=Snapshot-Preview for VM ${VmName} was initiated by ${UserName}. -USER_TRY_BACK_TO_SNAPSHOT_FINISH_SUCCESS=Snapshot-Preview for VM ${VmName} has been completed. -USER_TRY_BACK_TO_SNAPSHOT_FINISH_FAILURE=Failed to complete Snapshot-Preview for VM ${VmName}. +USER_TRY_BACK_TO_SNAPSHOT=Snapshot-Preview ${SnapshotName} for VM ${VmName} was initiated by ${UserName}. +USER_TRY_BACK_TO_SNAPSHOT_FINISH_SUCCESS=Snapshot-Preview ${SnapshotName} for VM ${VmName} has been completed. +USER_TRY_BACK_TO_SNAPSHOT_FINISH_FAILURE=Failed to complete Snapshot-Preview ${SnapshotName} for VM ${VmName}. USER_UPDATE_BOOKMARK=Bookmark ${BookmarkName} was updated by ${UserName}. USER_UPDATE_BOOKMARK_FAILED=Failed to update bookmark: ${BookmarkName} (User: ${UserName}) -- To view, visit http://gerrit.ovirt.org/13431 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6988302018ff04966f973f3950c12cad6072ab82 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Libor Spevak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
