Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: BLL command for volume snapshot create
......................................................................

gluster: BLL command for volume snapshot create

Introduced BLL command for volume snapshot create action

Change-Id: I2c27f9e73bac8d6de3022b0dd4e70aa0d8b1494b
Signed-off-by: Shubhendu Tripathi <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/PauseGlusterVolumeGeoRepSessionCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResumeGeoRepSessionCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateGlusterVolumeSnapshotParameters.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 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
14 files changed, 310 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/75/39875/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
new file mode 100644
index 0000000..080581b
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeSnapshotCommand.java
@@ -0,0 +1,230 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.ovirt.engine.core.bll.LockMessagesMatchUtil;
+import org.ovirt.engine.core.bll.utils.ClusterUtils;
+import org.ovirt.engine.core.bll.utils.GlusterUtil;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.action.VdcActionType;
+import org.ovirt.engine.core.common.action.VdcReturnValueBase;
+import 
org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeSnapshotParameters;
+import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters;
+import org.ovirt.engine.core.common.businessentities.VDS;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus;
+import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity;
+import org.ovirt.engine.core.common.constants.gluster.GlusterConstants;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.locks.LockingGroup;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import 
org.ovirt.engine.core.common.vdscommands.gluster.CreateGlusterVolumeSnapshotVDSParameters;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.utils.lock.EngineLock;
+import org.ovirt.engine.core.utils.lock.LockManagerFactory;
+import org.ovirt.engine.core.utils.transaction.TransactionMethod;
+import org.ovirt.engine.core.utils.transaction.TransactionSupport;
+
+public class CreateGlusterVolumeSnapshotCommand extends 
GlusterSnapshotCommandBase<CreateGlusterVolumeSnapshotParameters> {
+
+    private GlusterVolumeSnapshotEntity snapshot;
+    private boolean force;
+    private List<GlusterGeoRepSession> georepSessions;
+
+    public 
CreateGlusterVolumeSnapshotCommand(CreateGlusterVolumeSnapshotParameters 
params) {
+        super(params);
+        this.snapshot = params.getSnapshot();
+        this.force = params.getForce();
+
+        if (this.snapshot != null) {
+            setVdsGroupId(this.snapshot.getClusterId());
+            setGlusterVolumeId(snapshot.getVolumeId());
+            this.georepSessions = 
getDbFacade().getGlusterGeoRepDao().getGeoRepSessions(getGlusterVolumeId());
+        }
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE);
+        addCustomValue(GlusterConstants.VOLUME_SNAPSHOT_NAME, 
getParameters().getSnapshot().getSnapshotName());
+    }
+
+    private boolean pauseAndCreateSnapshotForGeoRepSessions() {
+        if (georepSessions != null && georepSessions.size() > 0) {
+            for (GlusterGeoRepSession session : georepSessions) {
+                if (session.getStatus() != GeoRepSessionStatus.PAUSED) {
+                    GlusterVolumeEntity slaveVolume =
+                            
getDbFacade().getGlusterVolumeDao().getById(session.getSlaveVolumeId());
+
+                    if (slaveVolume == null) {
+                        // Continue to other geo-rep sessions and pause them 
for snapshot purpose
+                        continue;
+                    }
+
+                    VDS slaveUpServer = 
ClusterUtils.getInstance().getRandomUpServer(slaveVolume.getClusterId());
+                    if (slaveUpServer == null) {
+                        
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED,
+                                "No up server found in slave cluster of 
geo-rep session");
+                        setSucceeded(false);
+                        return false;
+                    }
+
+                    // Pause the geo-rep session and create snapshot for 
remote volume
+                    VdcReturnValueBase sessionPauseRetVal = null;
+                    try (EngineLock lock = 
acquireEngineLock(slaveVolume.getId(), LockingGroup.GLUSTER_SNAPSHOT)) {
+                        sessionPauseRetVal =
+                                
runInternalAction(VdcActionType.PauseGlusterVolumeGeoRepSession,
+                                        new 
GlusterVolumeGeoRepSessionParameters(getGlusterVolumeId(), session.getId()));
+                    }
+                    if (sessionPauseRetVal != null && 
!sessionPauseRetVal.getSucceeded()) {
+                        
handleVdsErrors(AuditLogType.GLUSTER_VOLUME_GEO_REP_PAUSE_FAILED,
+                                sessionPauseRetVal.getExecuteFailedMessages());
+                        setSucceeded(false);
+                        return false;
+                    } else {
+                        // Create snapshot for slave volume
+                        VDSReturnValue snapCreationRetVal =
+                                
runVdsCommand(VDSCommandType.CreateGlusterVolumeSnapshot,
+                                        new 
CreateGlusterVolumeSnapshotVDSParameters(slaveUpServer.getId(),
+                                                session.getSlaveVolumeName(),
+                                                snapshot.getSnapshotName(),
+                                                snapshot.getDescription(),
+                                                force));
+                        if (!snapCreationRetVal.getSucceeded()) {
+                            
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED,
+                                    
snapCreationRetVal.getVdsError().getMessage());
+                            setSucceeded(false);
+                            return false;
+                        } else {
+                            // Persist the snapshot details
+                            GlusterVolumeSnapshotEntity slaveVolumeSnapshot = 
new GlusterVolumeSnapshotEntity();
+                            
slaveVolumeSnapshot.setClusterId(slaveVolume.getClusterId());
+                            
slaveVolumeSnapshot.setVolumeId(slaveVolume.getId());
+                            slaveVolumeSnapshot.setSnapshotId((Guid) 
snapCreationRetVal.getReturnValue());
+                            
slaveVolumeSnapshot.setSnapshotName(snapshot.getSnapshotName());
+                            
slaveVolumeSnapshot.setDescription(snapshot.getDescription());
+                            
slaveVolumeSnapshot.setStatus(GlusterSnapshotStatus.ACTIVATED);
+                            slaveVolumeSnapshot.setCreatedAt(new Date());
+                            
getDbFacade().getGlusterVolumeSnapshotDao().save(slaveVolumeSnapshot);
+                        }
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    protected void executeCommand() {
+        GlusterVolumeEntity volume = getGlusterVolume();
+
+        // Pause geo-rep sessions and create snapshot for slave volumes
+        Boolean tranRetVal = TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Boolean>() {
+            @Override
+            public Boolean runInTransaction() {
+                return pauseAndCreateSnapshotForGeoRepSessions();
+            }
+        });
+
+        if (!tranRetVal) {
+            return;
+        }
+
+        // Create snapshot for the master volume
+        VDSReturnValue retVal =
+                runVdsCommand(VDSCommandType.CreateGlusterVolumeSnapshot,
+                        new 
CreateGlusterVolumeSnapshotVDSParameters(upServer.getId(),
+                                volume.getName(),
+                                snapshot.getSnapshotName(),
+                                snapshot.getDescription(),
+                                force));
+
+        setSucceeded(retVal.getSucceeded());
+
+        if (!retVal.getSucceeded()) {
+            handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED, 
retVal.getVdsError().getMessage());
+        } else {
+            GlusterVolumeSnapshotEntity createdSnapshot = 
getParameters().getSnapshot();
+            createdSnapshot.setSnapshotId((Guid) retVal.getReturnValue());
+            createdSnapshot.setStatus(GlusterSnapshotStatus.ACTIVATED);
+            createdSnapshot.setCreatedAt(new Date());
+            getDbFacade().getGlusterVolumeSnapshotDao().save(createdSnapshot);
+        }
+
+        // Resume the snapshot sessions
+        List<GlusterGeoRepSession> updatedGeoRepSessions =
+                
getDbFacade().getGlusterGeoRepDao().getGeoRepSessions(volume.getId());
+        if (updatedGeoRepSessions != null && updatedGeoRepSessions.size() > 0) 
{
+            for (GlusterGeoRepSession session : updatedGeoRepSessions) {
+                if (session.getStatus() == GeoRepSessionStatus.PAUSED) {
+                    try (EngineLock lock = 
acquireGeoRepSessionLock(session.getId())) {
+                        VdcReturnValueBase sessionResumeRetVal =
+                                
runInternalAction(VdcActionType.ResumeGeoRepSession,
+                                        new 
GlusterVolumeGeoRepSessionParameters(volume.getId(), session.getId()));
+                        if (!sessionResumeRetVal.getSucceeded()) {
+                            
handleVdsErrors(AuditLogType.GLUSTER_VOLUME_GEO_REP_RESUME_FAILED,
+                                    
sessionResumeRetVal.getExecuteFailedMessages());
+                            setSucceeded(false);
+                            return;
+                        }
+                    }
+                }
+            }
+        }
+
+        setSucceeded(true);
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
+        GlusterVolumeEntity volume = getGlusterVolume();
+        if (volume.getStatus() == GlusterStatus.DOWN) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN);
+        }
+
+        if (!GlusterUtil.getInstance().isVolumeThinlyProvisioned(volume)) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED);
+        }
+
+        if 
(getDbFacade().getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), 
snapshot.getSnapshotName()) != null) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS);
+        }
+
+        for (GlusterGeoRepSession session : georepSessions) {
+            if (session.getSlaveNodeUuid() == null || 
session.getSlaveVolumeId() == null) {
+                // Slave cluster is not maintained by engine, so cannot pause 
geo-rep session and create snapshot for
+                // the volume
+                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOTE_CLUSTER_NOT_MAINTAINED_BY_ENGINE);
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        if (getSucceeded()) {
+            return AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATED;
+        } else {
+            return errorType == null ? 
AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED : errorType;
+        }
+    }
+
+    protected EngineLock acquireGeoRepSessionLock(Guid id) {
+        EngineLock lock = new 
EngineLock(Collections.singletonMap(id.toString(),
+                
LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER_GEOREP,
+                        
VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_LOCKED)), null);
+        LockManagerFactory.getLockManager().acquireLockWait(lock);
+        return lock;
+    }
+}
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/PauseGlusterVolumeGeoRepSessionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/PauseGlusterVolumeGeoRepSessionCommand.java
index f648079..1ab00a1 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/PauseGlusterVolumeGeoRepSessionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/PauseGlusterVolumeGeoRepSessionCommand.java
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.bll.gluster;
 
+import org.ovirt.engine.core.bll.context.CommandContext;
 import org.ovirt.engine.core.common.AuditLogType;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus;
@@ -15,6 +16,10 @@
         super(params);
     }
 
+    public 
PauseGlusterVolumeGeoRepSessionCommand(GlusterVolumeGeoRepSessionParameters 
params, CommandContext context) {
+        super(params, context);
+    }
+
     @Override
     protected void setActionMessageParameters() {
         super.setActionMessageParameters();
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResumeGeoRepSessionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResumeGeoRepSessionCommand.java
index 2f98984..7ea37d2 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResumeGeoRepSessionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResumeGeoRepSessionCommand.java
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.bll.gluster;
 
+import org.ovirt.engine.core.bll.context.CommandContext;
 import org.ovirt.engine.core.common.AuditLogType;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus;
@@ -17,6 +18,10 @@
         super(params);
     }
 
+    public ResumeGeoRepSessionCommand(GlusterVolumeGeoRepSessionParameters 
params, CommandContext context) {
+        super(params, context);
+    }
+
     @Override
     protected void setActionMessageParameters() {
         super.setActionMessageParameters();
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
index d0961ba..6a36cc2 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/GlusterUtil.java
@@ -259,4 +259,11 @@
         List<VdsNetworkInterface> interfaces = 
DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(vdsId);
         return (interfaces == null) ? new ArrayList<VdsNetworkInterface>() : 
interfaces;
     }
+
+    public boolean isVolumeThinlyProvisioned(GlusterVolumeEntity volume) {
+        // TODO: As part of disk provisioning feature in oVirt for gluster, a 
flag would be maintained
+        // as part Gluster Volume Entity which depicts if the volume bricks 
are thinly provisioned or not.
+        // The same flag would be used here to decide accordingly later.
+        return true;
+    }
 }
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 c5f2af0..8b864af 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
@@ -421,6 +421,9 @@
     SYNC_STORAGE_DEVICES_IN_HOST_FAILED(4127),
     GLUSTER_MASTER_VOLUME_STOP_FAILED_DURING_SNAPSHOT_RESTORE(4130, 
AuditLogSeverity.ERROR),
     GLUSTER_MASTER_VOLUME_SNAPSHOT_RESTORE_FAILED(4131, 
AuditLogSeverity.ERROR),
+    GLUSTER_VOLUME_SNAPSHOT_CREATED(4132),
+    GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED(4133, AuditLogSeverity.ERROR),
+
     USER_FORCE_SELECTED_SPM(159),
     USER_VDS_RESTART(41),
     USER_FAILED_VDS_RESTART(107, AuditLogSeverity.ERROR),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
index 5d40451..8c223c9 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java
@@ -98,6 +98,8 @@
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_DETECTED_FROM_CLI);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_REBALANCE_NOT_FOUND_FROM_CLI);
         AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI);
+        AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATED);
+        AddEventNotificationEntry(EventNotificationEntity.GlusterVolume, 
AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.GLUSTER_SERVER_ADD_FAILED);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.GLUSTER_SERVER_REMOVE);
         AddEventNotificationEntry(EventNotificationEntity.Host, 
AuditLogType.GLUSTER_SERVER_REMOVE_FAILED);
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 1a45d4d..6a98a77 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
@@ -319,6 +319,7 @@
     RestoreGlusterVolumeSnapshot(1438, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
     UpdateGlusterVolumeSnapshotConfig(1439, 
ActionGroup.MANIPULATE_GLUSTER_VOLUME, QuotaDependency.NONE),
     SyncStorageDevices(1440, ActionGroup.MANIPULATE_HOST, 
QuotaDependency.NONE),
+    CreateGlusterVolumeSnapshot(1441, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
 
     // Cluster Policy
     AddClusterPolicy(1450, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, 
QuotaDependency.NONE),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateGlusterVolumeSnapshotParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateGlusterVolumeSnapshotParameters.java
new file mode 100644
index 0000000..6f050f9
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateGlusterVolumeSnapshotParameters.java
@@ -0,0 +1,42 @@
+package org.ovirt.engine.core.common.action.gluster;
+
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity;
+
+public class CreateGlusterVolumeSnapshotParameters extends 
GlusterVolumeParameters {
+    private static final long serialVersionUID = 2015321730118872975L;
+
+    private GlusterVolumeSnapshotEntity snapshot;
+
+    private boolean force;
+
+    public CreateGlusterVolumeSnapshotParameters() {
+    }
+
+    public CreateGlusterVolumeSnapshotParameters(GlusterVolumeSnapshotEntity 
snapshot) {
+        super(snapshot.getVolumeId());
+        this.snapshot = snapshot;
+    }
+
+    public CreateGlusterVolumeSnapshotParameters(GlusterVolumeSnapshotEntity 
snapshot,
+            boolean force) {
+        super(snapshot.getVolumeId());
+        this.snapshot = snapshot;
+        this.force = force;
+    }
+
+    public GlusterVolumeSnapshotEntity getSnapshot() {
+        return this.snapshot;
+    }
+
+    public void setSnapshot(GlusterVolumeSnapshotEntity snapshot) {
+        this.snapshot = snapshot;
+    }
+
+    public boolean getForce() {
+        return this.force;
+    }
+
+    public void setForce(boolean force) {
+        this.force = force;
+    }
+}
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 f08f2fe..f5dd46d 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
@@ -958,6 +958,7 @@
     
ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_ALREADY_DEACTIVATED(ErrorType.CONFLICT),
     
GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL(ErrorType.INCOMPATIBLE_VERSION),
     
ACTION_TYPE_FAILED_STORAGE_PROVISIONING_NOT_SUPPORTED_BY_CLUSTER(ErrorType.NOT_SUPPORTED),
+    ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS(ErrorType.CONFLICT),
 
     // OpenStack Glance
     ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR(ErrorType.BAD_PARAMETERS),
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 c361745..830e81c 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1311,3 +1311,4 @@
 
 CPU_TYPE_UNSUPPORTED_FOR_THE_GUEST_OS=The guest OS doesn't support the 
following CPUs: ${unsupportedCpus}. Its possible to change the cluster cpu or 
set a different one per VM.
 BALLOON_REQUESTED_ON_NOT_SUPPORTED_ARCH=Cannot ${action} ${type}. Balloon is 
not supported on '${clusterArch}' architecture.
+ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS=Cannot ${action} ${type}. Snapshot 
${snapname} already exists.
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 e3e6fc8..98b7348 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -843,6 +843,9 @@
 SYNC_STORAGE_DEVICES_IN_HOST_FAILED=Failed to synced storage devices from host 
${VdsName}
 GLUSTER_MASTER_VOLUME_STOP_FAILED_DURING_SNAPSHOT_RESTORE=Could not stop 
master volume ${glusterVolumeName} during snapshot restore.
 GLUSTER_MASTER_VOLUME_SNAPSHOT_RESTORE_FAILED=Could not restore master volume 
${glusterVolumeName}.
+GLUSTER_VOLUME_SNAPSHOT_CREATED=Snapshot ${snapname} created for volume 
${glusterVolumeName}.
+GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED=Could not create ${snapname} for volume 
${glusterVolumeName}.
+
 VDS_UNTRUSTED=Host ${VdsName} was set to non-operational. Host is not trusted 
by the attestation service.
 USER_ADDED_NETWORK_QOS=Network QoS ${QosName} was added. (User: ${UserName})
 USER_FAILED_TO_ADD_NETWORK_QOS=Failed to add Network QoS ${QosName}. (User: 
${UserName})
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index c580a7f..5707e0d 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -2979,6 +2979,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Remove brick operation is 
running on the volume ${volumeName} in cluster ${vdsGroup}.")
     String 
ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REMOVE_BRICK_IN_PROGRESS();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Snapshot ${snapname} 
already exists.")
+    String ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS();
+
     @DefaultStringValue("Cannot ${action} ${type}. The Network Interface 
${IfaceName} has an invalid MAC address ${MacAddress}. MAC address must be in 
format \"HH:HH:HH:HH:HH:HH\" where H is a hexadecimal character (either a digit 
or A-F, case is insignificant).")
     String ACTION_TYPE_FAILED_NETWORK_INTERFACE_MAC_INVALID();
 
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
index 68718d1..05a80f0 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java
@@ -491,6 +491,10 @@
 
     String 
AuditLogType___GLUSTER_VOLUME_SNAPSHOT_CONFIG_UPDATE_FAILED_PARTIALLY();
 
+    String AuditLogType___GLUSTER_VOLUME_SNAPSHOT_CREATED();
+
+    String AuditLogType___GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED();
+
     String VdcActionType___ActivateVds();
 
     String VdcActionType___RecoveryStoragePool();
@@ -776,6 +780,8 @@
 
     String VdcActionType___StartRebalanceGlusterVolume();
 
+    String VdcActionType___CreateGlusterVolumeSnapshot();
+
     String VdcActionType___ReplaceGlusterVolumeBrick();
 
     String VdcActionType___GlusterHostAdd();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 03319d1..15ea453 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -1270,3 +1270,4 @@
 CPU_TYPE_UNSUPPORTED_FOR_THE_GUEST_OS=The guest OS doesn't support the 
following CPUs: ${unsupportedCpus}. Its possible to change the cluster cpu or 
set a different one per VM
 
 BALLOON_REQUESTED_ON_NOT_SUPPORTED_ARCH=Cannot ${action} ${type}. Balloon is 
not supported on '${clusterArch}' architecture.
+ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS=Cannot ${action} ${type}. Snapshot 
${snapname} already exists.


-- 
To view, visit https://gerrit.ovirt.org/39875
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c27f9e73bac8d6de3022b0dd4e70aa0d8b1494b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Shubhendu Tripathi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to