Daniel Erez has uploaded a new change for review.

Change subject: core: introduce RemoveSnapshotImagesCommand
......................................................................

core: introduce RemoveSnapshotImagesCommand

* A new command (and task handler) for removing specific images
  from snapshots.
* The command accepts as an argument a list of multiple images
  (of the same disk) to remove.
* The command utilizes SEAT infrastructure for removing multiple images
  from a disk consecutively (as merging multiple snapshots of a specific
  disk must be done separably - to avoid volume chain breakage).

Change-Id: Ia714a4390d1d9b672005be30f58b7fa98b9a31cd
Feature-Page: http://www.ovirt.org/Features/Snapshots_Overview
Signed-off-by: Daniel Erez <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImageTaskHandler.java
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImagesCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveSnapshotImagesParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
9 files changed, 532 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/26327/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImageTaskHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImageTaskHandler.java
new file mode 100644
index 0000000..5eac7b9
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImageTaskHandler.java
@@ -0,0 +1,138 @@
+package org.ovirt.engine.core.bll;
+
+import org.ovirt.engine.core.bll.context.CommandContext;
+import org.ovirt.engine.core.bll.job.ExecutionHandler;
+import org.ovirt.engine.core.bll.tasks.SPMAsyncTaskHandler;
+import org.ovirt.engine.core.bll.tasks.TaskHandlerCommand;
+import org.ovirt.engine.core.common.action.ImagesContainterParametersBase;
+import org.ovirt.engine.core.common.action.RemoveSnapshotImagesParameters;
+import org.ovirt.engine.core.common.action.VdcActionType;
+import org.ovirt.engine.core.common.action.VdcReturnValueBase;
+import org.ovirt.engine.core.common.asynctasks.AsyncTaskType;
+import org.ovirt.engine.core.common.businessentities.DiskImage;
+import org.ovirt.engine.core.common.businessentities.ImageStatus;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+import org.ovirt.engine.core.utils.log.Log;
+import org.ovirt.engine.core.utils.log.LogFactory;
+
+import java.util.List;
+
+public class RemoveSnapshotImageTaskHandler implements SPMAsyncTaskHandler {
+    private static final Log log = 
LogFactory.getLog(RemoveSnapshotImageTaskHandler.class);
+
+    private final TaskHandlerCommand<? extends RemoveSnapshotImagesParameters> 
enclosingCommand;
+    private final Guid imageId;
+    private final Guid vmId;
+
+    public RemoveSnapshotImageTaskHandler(
+            TaskHandlerCommand<? extends RemoveSnapshotImagesParameters> 
enclosingCommand, Guid imageId, Guid vmId) {
+        this.enclosingCommand = enclosingCommand;
+        this.imageId = imageId;
+        this.vmId = vmId;
+    }
+
+    @Override
+    public void execute() {
+        if (enclosingCommand.getParameters().getExecutionIndex() == 0) {
+            // lock all disk images in advance
+            updateImagesStatus(ImageStatus.LOCKED);
+        }
+
+        VdcReturnValueBase vdcReturnValue = 
Backend.getInstance().runInternalAction(
+                VdcActionType.RemoveSnapshotSingleDisk,
+                buildRemoveSnapshotSingleDiskParameters(),
+                getCommandContext());
+
+        if (vdcReturnValue != null && 
vdcReturnValue.getInternalVdsmTaskIdList() != null) {
+            enclosingCommand.getReturnValue()
+                    .getVdsmTaskIdList()
+                    .addAll(vdcReturnValue.getInternalVdsmTaskIdList());
+        }
+        else {
+            log.errorFormat("Failed RemoveSnapshotSingleDisk (Image {0} , VM 
{1})", imageId, vmId);
+        }
+
+        ExecutionHandler.setAsyncJob(enclosingCommand.getExecutionContext(), 
true);
+        enclosingCommand.getReturnValue().setSucceeded(true);
+    }
+
+    private ImagesContainterParametersBase 
buildRemoveSnapshotSingleDiskParameters() {
+        ImagesContainterParametersBase parameters = new 
ImagesContainterParametersBase(
+                imageId, vmId);
+
+        DiskImage dest = 
DbFacade.getInstance().getDiskImageDao().getAllSnapshotsForParent(imageId).get(0);
+
+        parameters.setDestinationImageId(dest.getImageId());
+        
parameters.setEntityInfo(enclosingCommand.getParameters().getEntityInfo());
+        parameters.setParentParameters(enclosingCommand.getParameters());
+        parameters.setParentCommand(enclosingCommand.getActionType());
+        
parameters.setSessionId(enclosingCommand.getParameters().getSessionId());
+        return parameters;
+    }
+
+    private CommandContext getCommandContext() {
+        CommandContext commandContext =
+                
ExecutionHandler.createDefaultContexForTasks(enclosingCommand.getExecutionContext());
+        
commandContext.getExecutionContext().setShouldEndJob(isLastTaskHandler());
+
+        return commandContext;
+    }
+
+    private boolean isLastTaskHandler() {
+        RemoveSnapshotImagesParameters parameters = 
enclosingCommand.getParameters();
+        return parameters.getExecutionIndex() == parameters.getImages().size() 
- 1;
+    }
+
+    @Override
+    public void endSuccessfully() {
+        if (isLastTaskHandler()) {
+            // Unlock on job finish
+            updateImagesStatus(ImageStatus.OK);
+        }
+        endRemoveSnapshotSingleDisk();
+        enclosingCommand.taskEndSuccessfully();
+        enclosingCommand.getReturnValue().setSucceeded(true);
+    }
+
+    @Override
+    public void endWithFailure() {
+        // Unlock all images since failure aborts the entire job
+        updateImagesStatus(ImageStatus.OK);
+        endRemoveSnapshotSingleDisk();
+        enclosingCommand.preventRollback();
+        enclosingCommand.getReturnValue().setSucceeded(true);
+    }
+
+    private void endRemoveSnapshotSingleDisk() {
+        VdcReturnValueBase vdcReturnValue = Backend.getInstance().endAction(
+                VdcActionType.RemoveSnapshotSingleDisk,
+                buildRemoveSnapshotSingleDiskParameters(),
+                getCommandContext());
+        
enclosingCommand.getReturnValue().setSucceeded(vdcReturnValue.getSucceeded());
+    }
+
+    private void updateImagesStatus(ImageStatus imageStatus) {
+        Guid imageGroupId = 
DbFacade.getInstance().getDiskImageDao().getSnapshotById(imageId).getId();
+        List<DiskImage> images = 
DbFacade.getInstance().getDiskImageDao().getAllSnapshotsForImageGroup(imageGroupId);
+        for (DiskImage image : images) {
+            ImagesHandler.updateImageStatus(image.getImageId(), imageStatus);
+        }
+    }
+
+    @Override
+    public AsyncTaskType getTaskType() {
+        // No implementation - handled by the command
+        return null;
+    }
+
+    @Override
+    public AsyncTaskType getRevertTaskType() {
+        // No implementation - there is no live-merge
+        return null;
+    }
+
+    @Override
+    public void compensate() {
+    }
+}
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImagesCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImagesCommand.java
new file mode 100644
index 0000000..5a5ab4d
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotImagesCommand.java
@@ -0,0 +1,349 @@
+package org.ovirt.engine.core.bll;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator;
+import org.ovirt.engine.core.bll.storage.StoragePoolValidator;
+import org.ovirt.engine.core.bll.tasks.SPMAsyncTaskHandler;
+import org.ovirt.engine.core.bll.tasks.TaskHandlerCommand;
+import org.ovirt.engine.core.bll.utils.PermissionSubject;
+import org.ovirt.engine.core.bll.validator.DiskImagesValidator;
+import org.ovirt.engine.core.bll.validator.StorageDomainValidator;
+import org.ovirt.engine.core.bll.validator.VmValidator;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.VdcObjectType;
+import org.ovirt.engine.core.common.action.RemoveSnapshotImagesParameters;
+import org.ovirt.engine.core.common.action.VdcActionType;
+import org.ovirt.engine.core.common.asynctasks.AsyncTaskCreationInfo;
+import org.ovirt.engine.core.common.businessentities.DiskImage;
+import org.ovirt.engine.core.common.businessentities.Snapshot;
+import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.locks.LockingGroup;
+import org.ovirt.engine.core.common.utils.Pair;
+import org.ovirt.engine.core.compat.Guid;
+
+public class RemoveSnapshotImagesCommand<T extends 
RemoveSnapshotImagesParameters> extends BaseImagesCommand<T>
+        implements TaskHandlerCommand<RemoveSnapshotImagesParameters> {
+
+    public RemoveSnapshotImagesCommand(T parameters) {
+        super(parameters);
+    }
+
+    @Override
+    protected void init(T parameters) {
+        super.init(parameters);
+
+        // Images must be specified in parameters and belong to a single Disk;
+        // Otherwise, we'll fail on canDoAction.
+        DiskImage representativeImage = getParameters().getImages().get(0);
+        if (representativeImage == null) {
+            return;
+        }
+
+        setImage(representativeImage);
+        setStorageDomainId(representativeImage.getStorageIds().get(0));
+
+        List<VM> listVms = 
getVmDAO().getVmsListForDisk(representativeImage.getId(), false);
+        if (!listVms.isEmpty()) {
+            VM vm = listVms.get(0);
+            setVm(vm);
+        }
+
+        addAuditLogCustomValues();
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        DiskImagesValidator diskImagesValidator = 
createDiskImageValidator(getParameters().getImages());
+        if (!validate(diskImagesValidator.diskImagesNotExist())) {
+            return false;
+        }
+
+        if (getVm() == null) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND);
+        }
+
+        if (!canRunActionOnNonManagedVm()) {
+            return false;
+        }
+
+        VmValidator vmValidator = createVmValidator(getVm());
+        if (!validate(new StoragePoolValidator(getStoragePool()).isUp()) ||
+                !validateVmNotDuringSnapshot() ||
+                !validateVmNotInPreview() ||
+                !validateSnapshotExists() ||
+                !validate(vmValidator.vmDown()) ||
+                
!validate(vmValidator.vmNotHavingDeviceSnapshotsAttachedToOtherVms(false)) ||
+                !validateStorageDomainActive()) {
+            return false;
+        }
+
+        // Check images
+        if (!validateImages()) {
+            return false;
+        }
+
+        // check that we are not deleting the template
+        if (!validateImagesNotInTemplate()) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE);
+        }
+
+        // check that we are not deleting the vm working snapshot
+        if (!validateImagesNotActive()) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE);
+        }
+
+        if (!validateStorageDomainAvailableSpace()) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE);
+        addCanDoActionMessage(VdcBllMessages.VAR__TYPE__DISK__SNAPSHOT);
+    }
+
+    @Override
+    protected List<SPMAsyncTaskHandler> initTaskHandlers() {
+        List<SPMAsyncTaskHandler> taskHandlers = new ArrayList<>();
+
+        for (DiskImage image : getParameters().getImages()) {
+            taskHandlers.add(new RemoveSnapshotImageTaskHandler(this, 
image.getImageId(), getVmId()));
+        }
+
+        return taskHandlers;
+    }
+
+    @Override
+    protected void executeCommand() {
+        setSucceeded(true);
+    }
+
+    protected void updateSnapshotVmConfiguration() {
+        DiskImage image = 
getParameters().getImages().get(getParameters().getExecutionIndex());
+        Snapshot snapshotWithoutImage = 
prepareSnapshotConfigWithoutImageSingleImage(getSnapshotId(), 
image.getImageId());
+        getSnapshotDao().update(snapshotWithoutImage);
+    }
+
+    @Override
+    public void taskEndSuccessfully() {
+        lockVmSnapshotsWithWait(getVm());
+        updateSnapshotVmConfiguration();
+        if (getSnapshotsEngineLock() != null) {
+            getLockManager().releaseLock(getSnapshotsEngineLock());
+        }
+    }
+
+    @Override
+    protected void endSuccessfully() {
+        setSucceeded(true);
+    }
+
+    @Override
+    protected void endWithFailure() {
+        setSucceeded(true);
+    }
+
+    @Override
+    public Map<String, String> getJobMessageProperties() {
+        if (jobProperties == null) {
+            jobProperties = super.getJobMessageProperties();
+            jobProperties.put("snapshots", 
StringUtils.join(getSnapshotsNames(), ", "));
+        }
+        return jobProperties;
+    }
+
+    private void addAuditLogCustomValues() {
+        this.addCustomValue("DiskAlias", getDiskImage().getDiskAlias());
+        this.addCustomValue("Snapshots", StringUtils.join(getSnapshotsNames(), 
", "));
+    }
+
+    private List<String> getSnapshotsNames() {
+        List<String> snapshotsNames = new LinkedList<>();
+        for (DiskImage image : getParameters().getImages()) {
+            Snapshot snapshot = getSnapshotDao().get(image.getSnapshotId());
+            if (snapshot != null) {
+                snapshotsNames.add(snapshot.getDescription());
+            }
+        }
+        return snapshotsNames;
+    }
+
+    protected boolean canRunActionOnNonManagedVm() {
+        ValidationResult nonManagedVmValidationResult = 
VmHandler.canRunActionOnNonManagedVm(getVm(), this.getActionType());
+        if (!nonManagedVmValidationResult.isValid()) {
+            return failCanDoAction(nonManagedVmValidationResult.getMessage());
+        }
+        return true;
+    }
+
+    protected DiskImagesValidator createDiskImageValidator(List<DiskImage> 
disksList) {
+        return new DiskImagesValidator(disksList);
+    }
+
+    protected VmValidator createVmValidator(VM vm) {
+        return new VmValidator(vm);
+    }
+
+    protected SnapshotsValidator createSnapshotValidator() {
+        return new SnapshotsValidator();
+    }
+
+    protected StorageDomainValidator createStorageDomainValidator() {
+        return new StorageDomainValidator(getStorageDomain());
+    }
+
+    protected boolean validateVmNotDuringSnapshot() {
+        return 
validate(createSnapshotValidator().vmNotDuringSnapshot(getVmId()));
+    }
+
+    protected boolean validateVmNotInPreview() {
+        return validate(createSnapshotValidator().vmNotInPreview(getVmId()));
+    }
+
+    protected boolean validateSnapshotExists() {
+        return validate(createSnapshotValidator().snapshotExists(getVmId(), 
getSnapshotId()));
+    }
+
+    protected boolean validateImages() {
+        List<DiskImage> images = 
getDiskImageDao().getAllSnapshotsForImageGroup(getDiskImage().getId());
+        DiskImagesValidator diskImagesValidator = new 
DiskImagesValidator(images);
+
+        return validate(diskImagesValidator.diskImagesNotLocked()) &&
+                validate(diskImagesValidator.diskImagesNotIllegal());
+    }
+
+    protected boolean validateImagesNotInTemplate() {
+        for (DiskImage image : getParameters().getImages()) {
+            if (getVmTemplateDAO().get(image.getImageId()) != null) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    protected boolean validateImagesNotActive() {
+        for (DiskImage image : getParameters().getImages()) {
+            if (getDiskImageDao().get(image.getImageId()) != null) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    protected boolean validateStorageDomainActive() {
+        StorageDomainValidator validator = createStorageDomainValidator();
+        if (!validate(validator.isDomainExistAndActive())) {
+            return false;
+        }
+        return true;
+    }
+
+    protected boolean validateStorageDomainAvailableSpace() {
+        StorageDomainValidator validator = createStorageDomainValidator();
+
+        long sizeRequested = 0L;
+        for (DiskImage image : getParameters().getImages()) {
+            sizeRequested += (long) image.getActualSize();
+        }
+
+        if (!validate(validator.isDomainHasSpaceForRequest(sizeRequested, 
false))) {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public List<PermissionSubject> getPermissionCheckSubjects() {
+        List<PermissionSubject> permissionList = new ArrayList<>();
+        permissionList.add(new PermissionSubject(getVmId(),
+                VdcObjectType.VM,
+                getActionType().getActionGroup()));
+        return permissionList;
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        switch (getActionState()) {
+            case EXECUTE:
+                if (isFirstTaskHandler() && getSucceeded()) {
+                    return AuditLogType.USER_REMOVE_DISK_SNAPSHOT;
+                }
+                if (!getParameters().getTaskGroupSuccess()) {
+                    return AuditLogType.USER_FAILED_REMOVE_DISK_SNAPSHOT;
+                }
+                break;
+
+            case END_SUCCESS:
+                return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS;
+
+            case END_FAILURE:
+                return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE;
+        }
+        return AuditLogType.UNASSIGNED;
+    }
+
+    @Override
+    protected Map<String, Pair<String, String>> getExclusiveLocks() {
+        return Collections.singletonMap(getVmId().toString(),
+                LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, 
VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_LOCKED));
+    }
+
+    @Override
+    public Guid createTask(Guid taskId, AsyncTaskCreationInfo 
asyncTaskCreationInfo, VdcActionType parentCommand) {
+        return super.createTask(taskId, asyncTaskCreationInfo, parentCommand);
+    }
+
+    @Override
+    public Guid createTask(
+            Guid taskId,
+            AsyncTaskCreationInfo asyncTaskCreationInfo,
+            VdcActionType parentCommand,
+            VdcObjectType entityType,
+            Guid... entityIds) {
+        return super.createTask(taskId, asyncTaskCreationInfo, parentCommand, 
entityType, entityIds);
+    }
+
+    @Override
+    public ArrayList<Guid> getTaskIdList() {
+        return super.getTaskIdList();
+    }
+
+    @Override
+    public VdcActionType getActionType() {
+        return super.getActionType();
+    }
+
+    @Override
+    public void preventRollback() {
+        getParameters().setExecutionIndex(0);
+    }
+
+    @Override
+    public Guid persistAsyncTaskPlaceHolder() {
+        return super.persistAsyncTaskPlaceHolder(getActionType());
+    }
+
+    @Override
+    public Guid persistAsyncTaskPlaceHolder(String taskKey) {
+        return super.persistAsyncTaskPlaceHolder(getActionType(), taskKey);
+    }
+
+    protected Guid getSnapshotId() {
+        return getImage() != null ? getImage().getSnapshotId() : null;
+    }
+
+    private boolean isFirstTaskHandler() {
+        return getParameters().getExecutionIndex() == 0;
+    }
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index 47a709e..2aa6004 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -416,6 +416,10 @@
     USER_EXTEND_DISK_SIZE_FAILURE(370, AuditLogSeverity.ERROR),
     USER_EXTEND_DISK_SIZE_SUCCESS(371),
     USER_EXTEND_DISK_SIZE_UPDATE_VM_FAILURE(372),
+    USER_REMOVE_DISK_SNAPSHOT(373),
+    USER_FAILED_REMOVE_DISK_SNAPSHOT(374, AuditLogSeverity.ERROR),
+    USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS(375),
+    USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE(376, AuditLogSeverity.ERROR),
 
     USER_EJECT_VM_DISK(528),
     USER_EJECT_VM_FLOPPY(529),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveSnapshotImagesParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveSnapshotImagesParameters.java
new file mode 100644
index 0000000..a21dd42
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RemoveSnapshotImagesParameters.java
@@ -0,0 +1,33 @@
+package org.ovirt.engine.core.common.action;
+
+import org.ovirt.engine.core.common.businessentities.DiskImage;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+
+public class RemoveSnapshotImagesParameters extends 
ImagesActionsParametersBase implements Serializable {
+
+    private static final long serialVersionUID = -629355522841577585L;
+
+    private List<DiskImage> images;
+
+    public RemoveSnapshotImagesParameters(DiskImage image) {
+        this(Arrays.asList(image));
+    }
+
+    public RemoveSnapshotImagesParameters(List<DiskImage> images) {
+        this.images = images;
+    }
+
+    public RemoveSnapshotImagesParameters() {
+    }
+
+    public List<DiskImage> getImages() {
+        return images;
+    }
+
+    public void setImages(List<DiskImage> images) {
+        this.images = images;
+    }
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
index 2bd8d96..669ca75 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
@@ -138,6 +138,7 @@
     GetDiskAlignment(232, QuotaDependency.NONE),
     RemoveVmHibernationVolumes(233, QuotaDependency.NONE),
     RemoveMemoryVolumes(234, QuotaDependency.NONE),
+    RemoveSnapshotImages(235, ActionGroup.MANIPULATE_VM_SNAPSHOTS, 
QuotaDependency.NONE),
     // VmPoolCommands
     AddVmPool(301, QuotaDependency.NONE),
     AddVmPoolWithVms(304, ActionGroup.CREATE_VM_POOL, QuotaDependency.BOTH),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 9ef0f6c..68f3fe0 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -36,6 +36,7 @@
     VAR__TYPE__SUBNET,
     VAR__TYPE__AFFINITY_GROUP,
     VAR__TYPE__ISCSI_BOND,
+    VAR__TYPE__DISK__SNAPSHOT,
 
     // Gluster types
     VAR__TYPE__GLUSTER_VOLUME,
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 176433d..9395035 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -285,6 +285,7 @@
 VAR__TYPE__SUBNET=$type subnet
 VAR__TYPE__AFFINITY_GROUP=$type Affinity Group
 VAR__TYPE__ISCSI_BOND=$type iSCSI Bond
+VAR__TYPE__DISK__SNAPSHOT="$type Disk Snapshot
 VAR__ACTION__RUN=$action run
 VAR__ACTION__REMOVE=$action remove
 VAR__ACTION__ADD=$action add
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 54bc7ff..fb6a943 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -52,6 +52,10 @@
 USER_REMOVE_SNAPSHOT=Snapshot '${SnapshotName}' deletion for VM '${VmName}' 
was initiated by ${UserName}.
 USER_REMOVE_SNAPSHOT_FINISHED_SUCCESS=Snapshot '${SnapshotName}' deletion for 
VM '${VmName}' has been completed.
 USER_REMOVE_SNAPSHOT_FINISHED_FAILURE=Failed to delete snapshot 
'${SnapshotName}' for VM '${VmName}'.
+USER_REMOVE_DISK_SNAPSHOT=Disk '${DiskAlias}' from Snapshot(s) '${Snapshots}' 
of VM '${VmName}' deletion was initiated by ${UserName}.
+USER_FAILED_REMOVE_DISK_SNAPSHOT=Failed to delete Disk '${DiskAlias}' from 
Snapshot(s) ${Snapshots} of VM ${VmName} (User: ${UserName}).
+USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS=Disk '${DiskAlias}' from 
Snapshot(s) '${Snapshots}' of VM '${VmName}' deletion has been completed.
+USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE=Failed to complete deletion of Disk 
'${DiskAlias}' from snapshot(s) '${Snapshots}' of VM '${VmName}'.
 USER_DETACH_USER_FROM_POOL=User ${AdUserName} was detached from VM Pool 
${VmPoolName} by ${UserName}.
 USER_DETACH_USER_FROM_POOL_FAILED=Failed to detach User ${AdUserName} from VM 
Pool ${VmPoolName} (User: ${UserName}).
 USER_DETACH_USER_FROM_VM=User ${AdUserName} was detached from VM ${VmName} by 
${UserName}.
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 c6b96a9..7389cfb 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -111,6 +111,7 @@
 job.ImportRepoImage=Importing Disk ${RepoImageName} to domain ${Storage}
 job.ExportRepoImage=Exporting Disk ${DiskAlias} from domain ${Storage}
 job.SshSoftFencing=Executing SSH Soft Fencing on host ${VDS}
+job.RemoveSnapshotImages=Removing Disks from Snapshot(s) ${Snapshots} of VM 
${VM}
 
 # Step types
 step.VALIDATING=Validating


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia714a4390d1d9b672005be30f58b7fa98b9a31cd
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