Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: Propagate the scheduler error to UI
......................................................................

gluster: Propagate the scheduler error to UI

Earlier the scheduler execption scenarios were just
logged and UI used to show Internal Error. Corrected
to porpagate the errors to UI properly.

Change-Id: I2630cb8701d394da8a658c3ba677616f026625a2
Bug-Url: https://bugzilla.redhat.com/1224691
Signed-off-by: Shubhendu Tripathi <shtri...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RescheduleGlusterVolumeSnapshotCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java
M 
backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilBaseImpl.java
6 files changed, 15 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/78/42278/1

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
index 54f5d28..05ecdf7 100644
--- 
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
@@ -32,16 +32,16 @@
             // Keep a copy of the execution time before conversion to engine 
time zone
             Time originalExecutionTime = schedule.getExecutionTime();
 
-            String newJobId = scheduleJob();
-
-            if (newJobId != null) {
+            try {
+                String newJobId = scheduleJob();
                 setSucceeded(true);
                 schedule.setJobId(newJobId);
                 // reverting to original execution time in UI populated time 
zone
                 schedule.setExecutionTime(originalExecutionTime);
                 
getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, 
schedule);
-            } else {
+            } catch (Exception ex) {
                 setSucceeded(false);
+                
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED, 
ex.getMessage());
             }
         } else {
             getGlusterVolumeSnapshotScheduleDao().removeByVolumeId(volumeId);
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
index a886c91..41c2551 100644
--- 
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
@@ -18,16 +18,16 @@
         Time originalExecutionTime = getSchedule().getExecutionTime();
 
         // schedule the snapshot creation task
-        String jobId = scheduleJob();
-
-        if (jobId != null) {
+        try {
+            String jobId = scheduleJob();
             setSucceeded(true);
             getSchedule().setJobId(jobId);
             // reverting to original execution time in UI populated time zone
             getSchedule().setExecutionTime(originalExecutionTime);
             getGlusterVolumeSnapshotScheduleDao().save(getSchedule());
-        } else {
+        } catch (Exception ex) {
             setSucceeded(false);
+            
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, 
ex.getMessage());
         }
     }
 
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
index 080e382..a7bdbf0 100644
--- 
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
@@ -79,7 +79,7 @@
 
         String cronExpression = 
GlusterUtil.getInstance().getCronExpression(schedule);
         if (cronExpression == null)
-            return null;
+            throw new RuntimeException("Unable to form cron expression for 
schedule. Invalid scheduling details.");
 
         return DBSchedulerUtilQuartzImpl.getInstance().scheduleACronJob(new 
GlusterSnapshotScheduleJob(),
                 "onTimer",
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 a316af4..1c5e364 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -863,6 +863,10 @@
 GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED=Could not create snapshot for volume 
${glusterVolumeName} of cluster ${vdsGroupName}.
 CREATE_GLUSTER_BRICK=Brick ${brickName} created successfully on host 
${vdsName} of cluster ${vdsGroupName}.
 CREATE_GLUSTER_BRICK_FAILED=Failed to create brick ${brickName} on host 
${vdsName} of cluster ${vdsGroupName}.
+GLUSTER_VOLUME_SNAPSHOT_SCHEDULED=Snapshots scheduled on volume 
${glusterVolumeName} of cluster ${vdsGroupName}.
+GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED=Failed to schedule snapshots on the 
volume ${glusterVolumeName} of cluster ${vdsGroupName}.
+GLUSTER_VOLUME_SNAPSHOT_RESCHEDULED=Rescheduled snapshots on volume 
${glusterVolumeName} of cluster ${vdsGroupName}.
+GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED=Failed to reschedule snapshots on 
volume ${glusterVolumeName} of cluster ${vdsGroupName}.
 GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_DELETED=Snapshot schedule deleted for volume 
${glusterVolumeName} of ${vdsGroupName}.
 GLUSTER_VOLUME_SNAPSHOT_DETECTED_NEW=Found new gluster volume snapshot 
${snapname} for volume ${glusterVolumeName} on cluster ${VdsGroupName}, and 
added it to engine DB."
 GLUSTER_VOLUME_SNAPSHOT_DELETED_FROM_CLI=Detected deletion of gluster volume 
snapshot ${snapname} for volume ${glusterVolumeName} on cluster 
${VdsGroupName}, and deleting it from engine DB."
diff --git 
a/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java
 
b/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java
index f950178..b184e30 100644
--- 
a/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java
+++ 
b/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java
@@ -182,7 +182,7 @@
             Date startAt,
             Date endBy) {
         if (!validate(instance, inputTypes)) {
-            return null;
+            throw new RuntimeException("Failed to validate input parameters 
for scheduling. Only primitives or String values are allowed.");
         }
         return super.scheduleACronJob(instance, methodName, inputTypes, 
inputParams, cronExpression, startAt, endBy);
     }
diff --git 
a/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilBaseImpl.java
 
b/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilBaseImpl.java
index 1940fc8..3b45050 100644
--- 
a/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilBaseImpl.java
+++ 
b/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilBaseImpl.java
@@ -272,7 +272,7 @@
         } catch (Exception se) {
             log.error("failed to schedule job: {}", se.getMessage());
             log.debug("Exception", se);
-            return null;
+            throw new RuntimeException(se);
         }
         return job.getKey().getName();
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2630cb8701d394da8a658c3ba677616f026625a2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to