Shubhendu Tripathi has uploaded a new change for review.

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

gluster: BLL command for scheduling volume snapshot

Introduced BLL command for gluster volume snapshots scheduling

Change-Id: I4326ebb0c146eadceb6ae30cce73ece132749dc5
Signed-off-by: Shubhendu Tripathi <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSnapshotScheduleJob.java
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RescheduleGlusterVolumeSnapshotCommand.java
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommand.java
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.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/action/VdcActionType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/ScheduleGlusterVolumeSnapshotParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M 
frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
10 files changed, 424 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/39876/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSnapshotScheduleJob.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSnapshotScheduleJob.java
new file mode 100644
index 0000000..df55b4b
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterSnapshotScheduleJob.java
@@ -0,0 +1,81 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+
+import org.ovirt.engine.core.bll.Backend;
+import org.ovirt.engine.core.bll.interfaces.BackendInternal;
+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.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.compat.Guid;
+import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+import 
org.ovirt.engine.core.dal.dbbroker.auditloghandling.gluster.GlusterAuditLogUtil;
+import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao;
+import org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GlusterSnapshotScheduleJob implements Serializable {
+    private static final long serialVersionUID = 2355384696827317365L;
+
+    private final static Logger log = 
LoggerFactory.getLogger(GlusterSnapshotScheduleJob.class);
+    private GlusterAuditLogUtil logUtil = getLogUtil();
+
+    public GlusterSnapshotScheduleJob() {
+    }
+
+    @OnTimerMethodAnnotation("onTimer")
+    public void onTimer(String serverId, String volumeId, String 
snapshotNamePrefix, String description, boolean force) {
+        final GlusterVolumeEntity volume = getGlusterVolumeDao().getById(new 
Guid(volumeId));
+        if (volume == null) {
+            log.error("Error while creating volume snapshot. Volume is null.");
+            return;
+        }
+
+        GlusterVolumeSnapshotEntity snapshot = new 
GlusterVolumeSnapshotEntity();
+        snapshot.setClusterId(volume.getClusterId());
+        snapshot.setVolumeId(volume.getId());
+        DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
+        final String snapshotName = snapshotNamePrefix + "-snap-" + 
df.format(new Date());
+        snapshot.setSnapshotName(snapshotName);
+        snapshot.setDescription(description);
+
+        VdcReturnValueBase returnValue = 
getBackend().runInternalAction(VdcActionType.CreateGlusterVolumeSnapshot,
+                new CreateGlusterVolumeSnapshotParameters(snapshot, force));
+        if (!returnValue.getSucceeded()) {
+            log.error("Error while creating snapshot for volume '{}': {}",
+                    volume.getName(),
+                    returnValue.getExecuteFailedMessages().toString());
+            logUtil.logAuditMessage(volume.getClusterId(),
+                    volume,
+                    null,
+                    AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED,
+                    new HashMap<String, String>() {
+                        {
+                            put(GlusterConstants.VOLUME_SNAPSHOT_NAME, 
snapshotName);
+                            put(GlusterConstants.VOLUME_NAME, 
volume.getName());
+                        }
+                    });
+        }
+    }
+
+    protected GlusterVolumeDao getGlusterVolumeDao() {
+        return DbFacade.getInstance().getGlusterVolumeDao();
+    }
+
+    protected BackendInternal getBackend() {
+        return Backend.getInstance();
+    }
+
+    protected GlusterAuditLogUtil getLogUtil() {
+        return GlusterAuditLogUtil.getInstance();
+    }
+}
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RescheduleGlusterVolumeSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RescheduleGlusterVolumeSnapshotCommand.java
new file mode 100644
index 0000000..928a942
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RescheduleGlusterVolumeSnapshotCommand.java
@@ -0,0 +1,74 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.sql.Time;
+
+import org.ovirt.engine.core.common.AuditLogType;
+import 
org.ovirt.engine.core.common.action.gluster.ScheduleGlusterVolumeSnapshotParameters;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.utils.timer.DBSchedulerUtilQuartzImpl;
+import org.ovirt.engine.core.utils.timer.SchedulerUtil;
+
+public class RescheduleGlusterVolumeSnapshotCommand extends 
ScheduleGlusterVolumeSnapshotCommandBase<ScheduleGlusterVolumeSnapshotParameters>
 {
+    public 
RescheduleGlusterVolumeSnapshotCommand(ScheduleGlusterVolumeSnapshotParameters 
params) {
+        super(params);
+    }
+
+    @Override
+    protected void executeCommand() {
+        Guid volumeId = getGlusterVolumeId();
+
+        GlusterVolumeSnapshotSchedule fetchedSchedule = 
getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId);
+        String jobId = fetchedSchedule.getJobId();
+        SchedulerUtil scheduler = DBSchedulerUtilQuartzImpl.getInstance();
+
+        // delete the existing job
+        scheduler.deleteJob(jobId);
+
+        GlusterVolumeSnapshotSchedule schedule = getSchedule();
+        if (schedule.getRecurrence() != null) {
+            // Keep a copy of the execution time before conversion to engine 
time zone
+            Time originalExecutionTime = schedule.getExecutionTime();
+
+            String newJobId = scheduleJob();
+
+            if (newJobId != null) {
+                setSucceeded(true);
+                schedule.setJobId(newJobId);
+                // reverting to original execution time in UI populated time 
zone
+                schedule.setExecutionTime(originalExecutionTime);
+                
getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, 
schedule);
+            } else {
+                setSucceeded(false);
+            }
+        } else {
+            getGlusterVolumeSnapshotScheduleDao().removeByVolumeId(volumeId);
+            setSucceeded(true);
+        }
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
+        GlusterVolumeSnapshotSchedule fetchedSchedule =
+                
getGlusterVolumeSnapshotScheduleDao().getByVolumeId(getGlusterVolumeId());
+        if (fetchedSchedule == null) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_NOT_SCHEDULED);
+        }
+
+        return true;
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        if (getSucceeded()) {
+            return AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESCHEDULED;
+        } else {
+            return errorType == null ? 
AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED : errorType;
+        }
+    }
+}
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommand.java
new file mode 100644
index 0000000..a886c91
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommand.java
@@ -0,0 +1,57 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.sql.Time;
+
+import org.ovirt.engine.core.common.AuditLogType;
+import 
org.ovirt.engine.core.common.action.gluster.ScheduleGlusterVolumeSnapshotParameters;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+
+public class ScheduleGlusterVolumeSnapshotCommand extends 
ScheduleGlusterVolumeSnapshotCommandBase<ScheduleGlusterVolumeSnapshotParameters>
 {
+    public 
ScheduleGlusterVolumeSnapshotCommand(ScheduleGlusterVolumeSnapshotParameters 
params) {
+        super(params);
+    }
+
+    @Override
+    protected void executeCommand() {
+        // Keep a copy of the execution time before conversion to engine time 
zone during scheduling
+        Time originalExecutionTime = getSchedule().getExecutionTime();
+
+        // schedule the snapshot creation task
+        String jobId = scheduleJob();
+
+        if (jobId != null) {
+            setSucceeded(true);
+            getSchedule().setJobId(jobId);
+            // reverting to original execution time in UI populated time zone
+            getSchedule().setExecutionTime(originalExecutionTime);
+            getGlusterVolumeSnapshotScheduleDao().save(getSchedule());
+        } else {
+            setSucceeded(false);
+        }
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
+        GlusterVolumeSnapshotSchedule fetchedSchedule =
+                
getGlusterVolumeSnapshotScheduleDao().getByVolumeId(getGlusterVolumeId());
+        if (fetchedSchedule != null) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_ALREADY_SCHEDULED);
+        }
+
+        return true;
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        if (getSucceeded()) {
+            return AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULED;
+        } else {
+            return errorType == null ? 
AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED : errorType;
+        }
+    }
+}
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java
new file mode 100644
index 0000000..0cf784b
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java
@@ -0,0 +1,111 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.sql.Time;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.ovirt.engine.core.bll.utils.GlusterUtil;
+import 
org.ovirt.engine.core.common.action.gluster.ScheduleGlusterVolumeSnapshotParameters;
+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.GlusterVolumeSnapshotSchedule;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+import org.ovirt.engine.core.dao.gluster.GlusterVolumeSnapshotScheduleDao;
+import org.ovirt.engine.core.utils.timer.DBSchedulerUtilQuartzImpl;
+
+public abstract class ScheduleGlusterVolumeSnapshotCommandBase<T extends 
ScheduleGlusterVolumeSnapshotParameters> extends GlusterSnapshotCommandBase<T> {
+    private GlusterVolumeSnapshotSchedule schedule;
+    private boolean force;
+
+    public ScheduleGlusterVolumeSnapshotCommandBase(T params) {
+        super(params);
+        this.schedule = getParameters().getSchedule();
+        this.force = getParameters().getForce();
+
+        if (this.schedule != null) {
+            setVdsGroupId(schedule.getClusterId());
+            setGlusterVolumeId(schedule.getVolumeId());
+        }
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE);
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (!super.canDoAction()) {
+            return false;
+        }
+
+        GlusterVolumeEntity volume = getGlusterVolume();
+        if (volume != null && 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);
+        }
+
+        return true;
+    }
+
+    protected String scheduleJob() {
+        // convert the execution time to engine time zone
+        if (schedule.getExecutionTime() != null) {
+            Time convertedTime =
+                    GlusterUtil.getInstance()
+                            .convertTime(schedule.getExecutionTime(), 
schedule.getTimeZone());
+            schedule.setExecutionTime(convertedTime);
+        }
+
+        // convert the start date and end by date to the given timezone
+        Date convertedStartDate = convertDate(schedule.getStartDate(), 
schedule.getTimeZone());
+        Date convertedEndByDate = convertDate(schedule.getEndByDate(), 
schedule.getTimeZone());
+
+        String cronExpression = 
GlusterUtil.getInstance().getCronExpression(schedule);
+        if (cronExpression == null)
+            return null;
+
+        return DBSchedulerUtilQuartzImpl.getInstance().scheduleACronJob(new 
GlusterSnapshotScheduleJob(),
+                "onTimer",
+                new Class[] { String.class, String.class, String.class, 
String.class, Boolean.class },
+                new Object[] { upServer.getId().toString(), 
getGlusterVolumeId().toString(),
+                        schedule.getSnapshotNamePrefix(),
+                        schedule.getSnapshotDescription(), force },
+                cronExpression, convertedStartDate, convertedEndByDate);
+    }
+
+    protected GlusterVolumeSnapshotScheduleDao 
getGlusterVolumeSnapshotScheduleDao() {
+        return DbFacade.getInstance().getGlusterVolumeSnapshotScheduleDao();
+    }
+
+    protected GlusterVolumeSnapshotSchedule getSchedule() {
+        return schedule;
+    }
+
+    protected boolean getForce() {
+        return force;
+    }
+
+    private Date convertDate(Date inDate, String tZone) {
+        if (inDate == null) {
+            return null;
+        }
+
+        DateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
+        String formattedStartDate = format.format(inDate);
+
+        format.setTimeZone(TimeZone.getTimeZone(tZone));
+        try {
+            return format.parse(formattedStartDate);
+        } catch (Exception ex) {
+            log.error("Error while converting the date to engine time zone");
+            return null;
+        }
+    }
+}
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 6a36cc2..a31319a 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
@@ -4,12 +4,16 @@
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.sql.Time;
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TimeZone;
 
 import javax.naming.AuthenticationException;
 
@@ -20,6 +24,8 @@
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterServer;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerInfo;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule;
 import 
org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
@@ -71,7 +77,8 @@
      * @throws AuthenticationException
      *             If SSH authentication with given root password fails
      */
-    public Set<String> getPeers(String server, String username, String 
password) throws AuthenticationException, IOException {
+    public Set<String> getPeers(String server, String username, String 
password) throws AuthenticationException,
+            IOException {
 
         try (final SSHClient client = getSSHClient()) {
             connect(client, server);
@@ -216,7 +223,8 @@
     public EngineLock acquireGlusterLockWait(Guid clusterId) {
         Map<String, Pair<String, String>> exclusiveLocks = new HashMap<String, 
Pair<String, String>>();
         exclusiveLocks.put(clusterId.toString(),
-                LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER, 
VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_OPERATION_INPROGRESS));
+                LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER,
+                        
VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_OPERATION_INPROGRESS));
         EngineLock lock = new EngineLock(exclusiveLocks, null);
         LockManagerFactory.getLockManager().acquireLockWait(lock);
         return lock;
@@ -266,4 +274,48 @@
         // The same flag would be used here to decide accordingly later.
         return true;
     }
+
+    public String getCronExpression(GlusterVolumeSnapshotSchedule schedule) {
+        String retStr = "";
+
+        switch (schedule.getRecurrence()) {
+        case INTERVAL:
+            int interval = schedule.getInterval();
+            retStr = String.format("0 */%s * * * ? *", interval);
+            break;
+        case HOURLY:
+            retStr = "0 0 0/1 1/1 * ? *";
+            break;
+        case DAILY:
+            Time execTime = schedule.getExecutionTime();
+            retStr = String.format("0 %s %s * * ? *", execTime.getMinutes(), 
execTime.getHours());
+            break;
+        case WEEKLY:
+            String days = schedule.getDays();
+            Time execTime1 = schedule.getExecutionTime();
+            retStr = String.format("0 %s %s ? * %s *", execTime1.getMinutes(), 
execTime1.getHours(), days);
+            break;
+        case MONTHLY:
+            String days1 = schedule.getDays();
+            Time execTime2 = schedule.getExecutionTime();
+            retStr = String.format("0 %s %s %s * ? *", execTime2.getMinutes(), 
execTime2.getHours(), days1);
+            break;
+        case UNKNOWN:
+            return null;
+        }
+
+        return retStr;
+    }
+
+    public Time convertTime(Time inTime, String fromTimeZone) {
+        Calendar calFrom = new 
GregorianCalendar(TimeZone.getTimeZone(fromTimeZone));
+        calFrom.set(Calendar.HOUR, inTime.getHours());
+        calFrom.set(Calendar.MINUTE, inTime.getMinutes());
+        calFrom.set(Calendar.SECOND, inTime.getSeconds());
+
+        Calendar calTo = new GregorianCalendar();
+        calTo.setTimeInMillis(calFrom.getTimeInMillis());
+
+        return new Time(calTo.get(Calendar.HOUR_OF_DAY), 
calTo.get(Calendar.MINUTE), calTo.get(Calendar.SECOND));
+    }
 }
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 8b864af..71e711b 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
@@ -423,6 +423,10 @@
     GLUSTER_MASTER_VOLUME_SNAPSHOT_RESTORE_FAILED(4131, 
AuditLogSeverity.ERROR),
     GLUSTER_VOLUME_SNAPSHOT_CREATED(4132),
     GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED(4133, AuditLogSeverity.ERROR),
+    GLUSTER_VOLUME_SNAPSHOT_SCHEDULED(4134),
+    GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED(4135, AuditLogSeverity.ERROR),
+    GLUSTER_VOLUME_SNAPSHOT_RESCHEDULED(4136),
+    GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED(4137, AuditLogSeverity.ERROR),
 
     USER_FORCE_SELECTED_SPM(159),
     USER_VDS_RESTART(41),
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 6a98a77..df64fff 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
@@ -320,6 +320,8 @@
     UpdateGlusterVolumeSnapshotConfig(1439, 
ActionGroup.MANIPULATE_GLUSTER_VOLUME, QuotaDependency.NONE),
     SyncStorageDevices(1440, ActionGroup.MANIPULATE_HOST, 
QuotaDependency.NONE),
     CreateGlusterVolumeSnapshot(1441, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
+    ScheduleGlusterVolumeSnapshot(1442, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
+    RescheduleGlusterVolumeSnapshot(1443, 
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/ScheduleGlusterVolumeSnapshotParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/ScheduleGlusterVolumeSnapshotParameters.java
new file mode 100644
index 0000000..7c9b3c3
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/ScheduleGlusterVolumeSnapshotParameters.java
@@ -0,0 +1,37 @@
+package org.ovirt.engine.core.common.action.gluster;
+
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotSchedule;
+
+public class ScheduleGlusterVolumeSnapshotParameters extends 
GlusterVolumeParameters {
+    private static final long serialVersionUID = 1L;
+
+    private GlusterVolumeSnapshotSchedule schedule;
+
+    private boolean force;
+
+    public ScheduleGlusterVolumeSnapshotParameters() {
+    }
+
+    public 
ScheduleGlusterVolumeSnapshotParameters(GlusterVolumeSnapshotSchedule schedule,
+            boolean force) {
+        super(schedule.getVolumeId());
+        this.schedule = schedule;
+        this.force = force;
+    }
+
+    public GlusterVolumeSnapshotSchedule getSchedule() {
+        return this.schedule;
+    }
+
+    public void setSchedule(GlusterVolumeSnapshotSchedule schedule) {
+        this.schedule = schedule;
+    }
+
+    public boolean getForce() {
+        return this.force;
+    }
+
+    public void setForce(boolean value) {
+        this.force = value;
+    }
+}
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 f5dd46d..f9e9f00 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
@@ -959,6 +959,8 @@
     
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),
+    
ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_ALREADY_SCHEDULED(ErrorType.CONFLICT),
+    
ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_NOT_SCHEDULED(ErrorType.CONFLICT),
 
     // OpenStack Glance
     ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR(ErrorType.BAD_PARAMETERS),
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
 
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
index d82f7b7..c0c81a7 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml
@@ -351,6 +351,8 @@
         <include 
name="common/businessentities/gluster/GlusterVolumeSnapshotEntity.java"/>
         <include 
name="common/businessentities/gluster/GlusterSnapshotStatus.java"/>
         <include 
name="common/businessentities/gluster/GlusterVolumeSnapshotConfig.java"/>
+        <include 
name="common/businessentities/gluster/GlusterVolumeSnapshotSchedule.java"/>
+        <include 
name="common/businessentities/gluster/GlusterVolumeSnapshotScheduleRecurrence.java"/>
         <!-- Scheduling -->
                <include name="common/scheduling/*.java"/>
                <include name="common/scheduling/parameters/*.java"/>


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

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