Shubhendu Tripathi has uploaded a new change for review.
Change subject: gluster: Corrected volume snapshot scheduling issues
......................................................................
gluster: Corrected volume snapshot scheduling issues
Corrected the below issues with gluster volume snapshot
scheduling screen -
1. If an error during scheduling, after closing
the error dialog the screen used to wait.
Corrected the same.
2. Removed un-necessary check for start at field
3. Timezone listing is made more meaningful withi
GMT difference
4. GMT is default selected in time zones list now
Change-Id: I2e5708a3b225dbc4731e99805cff401562906971
Bug-Url: https://bugzilla.redhat.com/1219151
Bug-Url: https://bugzilla.redhat.com/1218874
Signed-off-by: Shubhendu Tripathi <[email protected]>
---
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ScheduleGlusterVolumeSnapshotCommandBase.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotModel.java
M
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotCreatePopupView.java
4 files changed, 38 insertions(+), 26 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/40954/1
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 7515916..56f3016 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
@@ -53,23 +53,14 @@
}
// Validate the scheduling dates (start and end by dates)
- Date currentDate = new Date();
Date convertedStartDate = convertDate(schedule.getStartDate(),
schedule.getTimeZone());
Date convertedEndByDate = convertDate(schedule.getEndByDate(),
schedule.getTimeZone());
if (schedule.getRecurrence() != null
- && schedule.getRecurrence() !=
GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN) {
- if (convertedStartDate != null &&
convertedStartDate.compareTo(currentDate) < 0) {
- return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_START_DATE_BEFORE_CURRENT_DATE);
- }
- if (schedule.getEndByDate() != null) {
- if (convertedEndByDate.compareTo(currentDate) < 0) {
- return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_END_BY_DATE_BEFORE_CURRENT_DATE);
- }
- if (convertedStartDate != null &&
convertedEndByDate.compareTo(convertedStartDate) <= 0) {
- return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_END_BY_DATE_BEFORE_START_DATE);
- }
- }
+ && schedule.getRecurrence() !=
GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN
+ && schedule.getEndByDate() != null && convertedStartDate !=
null
+ && convertedEndByDate.compareTo(convertedStartDate) <= 0) {
+ return
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_END_BY_DATE_BEFORE_START_DATE);
}
return true;
diff --git
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java
index 89eee2a..e9167e9 100644
---
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java
+++
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java
@@ -5,7 +5,9 @@
import java.util.Collections;
import java.util.Date;
import java.util.List;
+import java.util.Map;
+import org.ovirt.engine.core.common.TimeZoneType;
import org.ovirt.engine.core.common.action.VdcActionParametersBase;
import org.ovirt.engine.core.common.action.VdcActionType;
import org.ovirt.engine.core.common.action.VdcReturnValueBase;
@@ -24,6 +26,7 @@
import org.ovirt.engine.ui.frontend.Frontend;
import org.ovirt.engine.ui.frontend.INewAsyncCallback;
import org.ovirt.engine.ui.uicommonweb.Linq;
+import org.ovirt.engine.ui.uicommonweb.Linq.IPredicate;
import org.ovirt.engine.ui.uicommonweb.UICommand;
import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider;
import org.ovirt.engine.ui.uicommonweb.help.HelpTag;
@@ -523,7 +526,7 @@
Date startAt = snapshotModel.getStartAt().getEntity();
schedule.setStartDate(startAt);
- schedule.setTimeZone(snapshotModel.getTimeZones().getSelectedItem());
+
schedule.setTimeZone(snapshotModel.getTimeZones().getSelectedItem().getKey());
if (snapshotModel.getEndByOptions().getSelectedItem() ==
EndDateOptions.NoEndDate) {
schedule.setEndByDate(null);
@@ -549,7 +552,7 @@
public void executed(FrontendActionAsyncResult result) {
GlusterVolumeSnapshotListModel localModel =
(GlusterVolumeSnapshotListModel)
result.getState();
- localModel.stopProgress();
+ snapshotModel.stopProgress();
localModel.postSnapshotAction(result.getReturnValue());
}
},
@@ -576,7 +579,7 @@
public void executed(FrontendActionAsyncResult result) {
GlusterVolumeSnapshotListModel localModel =
(GlusterVolumeSnapshotListModel)
result.getState();
- localModel.stopProgress();
+ snapshotModel.stopProgress();
localModel.postSnapshotAction(result.getReturnValue());
}
},
@@ -615,7 +618,7 @@
.unableToFetchVolumeSnapshotSchedule());
return;
}
- GlusterVolumeSnapshotSchedule schedule =
(GlusterVolumeSnapshotSchedule) returnValue;
+ final GlusterVolumeSnapshotSchedule schedule =
(GlusterVolumeSnapshotSchedule) returnValue;
snapshotModel.getSnapshotName().setEntity(schedule.getSnapshotNamePrefix());
snapshotModel.getDescription().setEntity(schedule.getSnapshotDescription());
snapshotModel.getRecurrence().setSelectedItem(schedule.getRecurrence());
@@ -627,7 +630,14 @@
}
if (schedule.getRecurrence() !=
GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN) {
-
snapshotModel.getTimeZones().setSelectedItem(schedule.getTimeZone());
+ Map<String, String> timeZones =
TimeZoneType.GENERAL_TIMEZONE.getTimeZoneList();
+
snapshotModel.getTimeZones().setSelectedItem(Linq.firstOrDefault(timeZones.entrySet(),
+ new IPredicate<Map.Entry<String, String>>() {
+ @Override
+ public boolean match(Map.Entry<String, String>
item) {
+ return
item.getKey().startsWith(schedule.getTimeZone()); //$NON-NLS-1$
+ }
+ }));
}
switch (schedule.getRecurrence()) {
case INTERVAL:
diff --git
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotModel.java
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotModel.java
index 367d567..38bec1c 100644
---
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotModel.java
+++
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotModel.java
@@ -4,11 +4,13 @@
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import java.util.Set;
+import java.util.Map;
import org.ovirt.engine.core.common.TimeZoneType;
import
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotScheduleRecurrence;
import org.ovirt.engine.core.compat.DayOfWeek;
+import org.ovirt.engine.ui.uicommonweb.Linq;
+import org.ovirt.engine.ui.uicommonweb.Linq.IPredicate;
import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
import org.ovirt.engine.ui.uicommonweb.models.ListModel;
import org.ovirt.engine.ui.uicommonweb.models.Model;
@@ -30,7 +32,7 @@
private EntityModel<Date> endDate;
private boolean generalTabVisible;
private boolean scheduleTabVisible;
- private ListModel<String> timeZones;
+ private ListModel<Map.Entry<String, String>> timeZones;
private EntityModel<Date> startAt;
private EntityModel<Date> executionTime;
private ListModel<List<DayOfWeek>> daysOfWeek;
@@ -51,7 +53,7 @@
setRecurrence(new
ListModel<GlusterVolumeSnapshotScheduleRecurrence>());
setInterval(new ListModel<String>());
setEndByOptions(new ListModel<EndDateOptions>());
- setTimeZones(new ListModel<String>());
+ setTimeZones(new ListModel<Map.Entry<String, String>>());
setDaysOfMonth(new ListModel<String>());
setStartAt(new EntityModel<Date>(new Date()));
setEndDate(new EntityModel<Date>(new Date()));
@@ -85,8 +87,15 @@
}
private void initTimeZones() {
- Set<String> timeZoneTypes =
TimeZoneType.GENERAL_TIMEZONE.getTimeZoneList().keySet();
- getTimeZones().setItems(timeZoneTypes);
+ Map<String, String> timeZones =
TimeZoneType.GENERAL_TIMEZONE.getTimeZoneList();
+ getTimeZones().setItems(timeZones.entrySet());
+
getTimeZones().setSelectedItem(Linq.firstOrDefault(timeZones.entrySet(),
+ new IPredicate<Map.Entry<String, String>>() {
+ @Override
+ public boolean match(Map.Entry<String, String> item) {
+ return item.getValue().startsWith("(GMT) Greenwich");
//$NON-NLS-1$
+ }
+ }));
}
public EntityModel<String> getDataCenter() {
@@ -177,11 +186,11 @@
this.scheduleTabVisible = scheduleTabVisible;
}
- public ListModel<String> getTimeZones() {
+ public ListModel<Map.Entry<String, String>> getTimeZones() {
return timeZones;
}
- public void setTimeZones(ListModel<String> timeZones) {
+ public void setTimeZones(ListModel<Map.Entry<String, String>> timeZones) {
this.timeZones = timeZones;
}
diff --git
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotCreatePopupView.java
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotCreatePopupView.java
index 8d3febb..b64c872 100644
---
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotCreatePopupView.java
+++
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GlusterVolumeSnapshotCreatePopupView.java
@@ -1,5 +1,7 @@
package org.ovirt.engine.ui.webadmin.section.main.view.popup.gluster;
+import java.util.Map;
+
import
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotScheduleRecurrence;
import org.ovirt.engine.core.compat.DayOfWeek;
import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
@@ -91,7 +93,7 @@
@UiField
@Path(value = "timeZones.selectedItem")
@WithElementId
- ListModelListBoxEditor<String> timeZoneEditor;
+ ListModelListBoxEditor<Map.Entry<String, String>> timeZoneEditor;
@UiField(provided = true)
@Path(value = "daysOfTheWeek.selectedItem")
--
To view, visit https://gerrit.ovirt.org/40954
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e5708a3b225dbc4731e99805cff401562906971
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