Hello anmolbabu,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/39668
to review the following change.
Change subject: engine : Set geo-rep config Bll command
......................................................................
engine : Set geo-rep config Bll command
This patch adds bll command to set geo-rep config.
Change-Id: I4d98636a688f9565dff0c86c8820839cb99b1a38
Signed-off-by: Anmol Babu <[email protected]>
---
A
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
A
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResetDefaultGeoRepConfigCommand.java
A
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SetGeoRepConfigCommand.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/GlusterVolumeGeoRepSessionConfigParameters.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionConfiguration.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
M
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.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/test/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoTest.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
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/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
M packaging/dbscripts/create_views.sql
M packaging/dbscripts/gluster_georep_sp.sql
A packaging/dbscripts/upgrade/03_05_1320_add_gluster_config_master_table.sql
A packaging/dbscripts/upgrade/03_05_1330_insert_config_description.sql
A
packaging/dbscripts/upgrade/03_05_1340_gluster_geo_rep_alter_config_value_column.sql
23 files changed, 343 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/39668/1
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
new file mode 100644
index 0000000..0cd831d
--- /dev/null
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeGeoRepConfigListQuery.java
@@ -0,0 +1,16 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import org.ovirt.engine.core.common.queries.IdQueryParameters;
+
+public class GetGlusterVolumeGeoRepConfigListQuery<P extends
IdQueryParameters> extends GlusterQueriesCommandBase<P> {
+
+ public GetGlusterVolumeGeoRepConfigListQuery(P parameters) {
+ super(parameters);
+ }
+
+ @Override
+ protected void executeQueryCommand() {
+
getQueryReturnValue().setReturnValue(getGeoRepDao().getGeoRepSessionConfig(getParameters().getId()));
+ }
+
+}
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResetDefaultGeoRepConfigCommand.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResetDefaultGeoRepConfigCommand.java
new file mode 100644
index 0000000..215371c
--- /dev/null
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ResetDefaultGeoRepConfigCommand.java
@@ -0,0 +1,65 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.util.Map;
+
+import org.ovirt.engine.core.common.AuditLogType;
+import
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionConfigParameters;
+import
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession;
+import org.ovirt.engine.core.common.constants.gluster.GlusterConstants;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepConfigVdsParameters;
+
+public class ResetDefaultGeoRepConfigCommand extends
GeoRepSessionCommandBase<GlusterVolumeGeoRepSessionConfigParameters> {
+
+ public
ResetDefaultGeoRepConfigCommand(GlusterVolumeGeoRepSessionConfigParameters
params) {
+ super(params);
+ setGlusterVolumeId(getGeoRepSession().getMasterVolumeId());
+ }
+
+ @Override
+ protected void executeCommand() {
+ GlusterGeoRepSession session = getGeoRepSession();
+ VDSReturnValue returnValue =
+
runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfigDefault,
+ new
GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(),
+ session.getMasterVolumeName(),
+ session.getSlaveHostName(),
+ session.getSlaveVolumeName(),
+ getParameters().getConfigKey()));
+ setSucceeded(returnValue.getSucceeded());
+ if (!getSucceeded()) {
+
handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED,
returnValue.getVdsError()
+ .getMessage());
+ return;
+ }
+ }
+
+ @Override
+ public Map<String, String> getCustomValues() {
+ addCustomValue(GlusterConstants.OPTION_KEY,
getParameters().getConfigKey());
+ addCustomValue(GlusterConstants.GEO_REP_SESSION_KEY,
getGeoRepSession().getSessionKey());
+ return super.getCustomValues();
+ }
+
+ @Override
+ protected boolean canDoAction() {
+ return super.canDoAction();
+ }
+
+ @Override
+ protected void setActionMessageParameters() {
+ addCanDoActionMessage(VdcBllMessages.VAR__ACTION__RESET);
+ addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_GEOREP_CONFIG);
+ }
+
+ @Override
+ public AuditLogType getAuditLogTypeValue() {
+ if (getSucceeded()) {
+ return AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT;
+ } else {
+ return errorType == null ?
AuditLogType.GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED : errorType;
+ }
+ }
+}
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SetGeoRepConfigCommand.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SetGeoRepConfigCommand.java
new file mode 100644
index 0000000..dce0c43
--- /dev/null
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SetGeoRepConfigCommand.java
@@ -0,0 +1,78 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.util.Map;
+
+import org.ovirt.engine.core.common.AuditLogType;
+import
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionConfigParameters;
+import
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession;
+import
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration;
+import org.ovirt.engine.core.common.constants.gluster.GlusterConstants;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import
org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeGeoRepConfigVdsParameters;
+
+public class SetGeoRepConfigCommand extends
GeoRepSessionCommandBase<GlusterVolumeGeoRepSessionConfigParameters> {
+
+ public SetGeoRepConfigCommand(GlusterVolumeGeoRepSessionConfigParameters
params) {
+ super(params);
+ setGlusterVolumeId(getGeoRepSession().getMasterVolumeId());
+ }
+
+ @Override
+ protected boolean canDoAction() {
+ return super.canDoAction();
+ }
+
+ @Override
+ public Map<String, String> getCustomValues() {
+ addCustomValue(GlusterConstants.OPTION_KEY,
getParameters().getConfigKey());
+ addCustomValue(GlusterConstants.OPTION_VALUE,
getParameters().getConfigValue());
+ addCustomValue(GlusterConstants.GEO_REP_SESSION_KEY,
getGeoRepSession().getSessionKey());
+ return super.getCustomValues();
+ }
+
+ @Override
+ protected void executeCommand() {
+ GlusterGeoRepSession session = getGeoRepSession();
+ String configKey = getParameters().getConfigKey();
+ String configValue = getParameters().getConfigValue();
+ VDSReturnValue returnValue =
+ runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfig,
+ new
GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(),
+ session.getMasterVolumeName(),
+ session.getSlaveHostName(),
+ session.getSlaveVolumeName(),
+ configKey,
+ configValue));
+ setSucceeded(returnValue.getSucceeded());
+ if (getSucceeded()) {
+ GlusterGeoRepSessionConfiguration geoRepSessionConfig = new
GlusterGeoRepSessionConfiguration();
+ geoRepSessionConfig.setValue(configValue);
+ geoRepSessionConfig.setKey(configKey);
+ geoRepSessionConfig.setId(session.getId());
+ getGlusterGeoRepDao().updateConfig(geoRepSessionConfig);
+ } else {
+ handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_FAILED,
returnValue.getVdsError().getMessage());
+ return;
+ }
+ }
+
+ @Override
+ protected void setActionMessageParameters() {
+ addCanDoActionMessage(VdcBllMessages.VAR__ACTION__SET);
+ addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_GEOREP_CONFIG);
+ addCanDoActionMessageVariable("configName",
getParameters().getConfigKey());
+ addCanDoActionMessageVariable("geoRepSessionKey",
getGeoRepSession().getSessionKey());
+ addCanDoActionMessageVariable("configValue",
getParameters().getConfigValue());
+ }
+
+ @Override
+ public AuditLogType getAuditLogTypeValue() {
+ if (getSucceeded()) {
+ return AuditLogType.GLUSTER_GEOREP_CONFIG_SET;
+ } else {
+ return errorType == null ?
AuditLogType.GLUSTER_GEOREP_CONFIG_SET_FAILED : errorType;
+ }
+ }
+}
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 008a7b7..fe6c2ff 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
@@ -397,6 +397,12 @@
GEOREP_SESSION_DELETE(4103),
GEOREP_SESSION_DELETE_FAILED(4104, AuditLogSeverity.ERROR),
+ GLUSTER_GEOREP_CONFIG_SET(4105),
+ GLUSTER_GEOREP_CONFIG_SET_FAILED(4106, AuditLogSeverity.ERROR),
+ GLUSTER_GEOREP_CONFIG_LIST(4107),
+ GLUSTER_GEOREP_CONFIG_LIST_FAILED(4108, AuditLogSeverity.ERROR),
+ GLUSTER_GEOREP_CONFIG_SET_DEFAULT(4109),
+ GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED(4110, 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/action/VdcActionType.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
index c05c514..895ae85 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
@@ -310,6 +310,8 @@
StartGlusterVolumeGeoRep(1429, ActionGroup.MANIPULATE_GLUSTER_VOLUME,
QuotaDependency.NONE),
ResumeGeoRepSession(1430, ActionGroup.MANIPULATE_GLUSTER_VOLUME,
QuotaDependency.NONE),
PauseGlusterVolumeGeoRepSession(1431,
ActionGroup.MANIPULATE_GLUSTER_VOLUME, QuotaDependency.NONE),
+ SetGeoRepConfig(1432, ActionGroup.MANIPULATE_GLUSTER_VOLUME,
QuotaDependency.NONE),
+ ResetDefaultGeoRepConfig(1433, 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/GlusterVolumeGeoRepSessionConfigParameters.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterVolumeGeoRepSessionConfigParameters.java
new file mode 100644
index 0000000..739177f
--- /dev/null
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterVolumeGeoRepSessionConfigParameters.java
@@ -0,0 +1,42 @@
+package org.ovirt.engine.core.common.action.gluster;
+
+import org.ovirt.engine.core.compat.Guid;
+
+public class GlusterVolumeGeoRepSessionConfigParameters extends
GlusterVolumeGeoRepSessionParameters {
+
+ private static final long serialVersionUID = 1L;
+
+ private String configKey;
+ private String configValue;
+
+ public GlusterVolumeGeoRepSessionConfigParameters() {
+ super();
+ }
+
+ public GlusterVolumeGeoRepSessionConfigParameters(Guid volumeId, Guid
sessionId, String configKey, String configValue) {
+ super(volumeId, sessionId);
+ this.configKey = configKey;
+ this.configValue = configValue;
+ }
+
+ public GlusterVolumeGeoRepSessionConfigParameters(Guid volumeId, Guid
sessionId, String configKey) {
+ super(volumeId, sessionId);
+ this.configKey = configKey;
+ }
+
+ public String getConfigKey() {
+ return configKey;
+ }
+
+ public void setConfigKey(String configKey) {
+ this.configKey = configKey;
+ }
+
+ public String getConfigValue() {
+ return configValue;
+ }
+
+ public void setConfigValue(String configValue) {
+ this.configValue = configValue;
+ }
+}
diff --git
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionConfiguration.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionConfiguration.java
index 63cff97..7ce9a6e 100644
---
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionConfiguration.java
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterGeoRepSessionConfiguration.java
@@ -1,32 +1,18 @@
package org.ovirt.engine.core.common.businessentities.gluster;
+import java.util.List;
+
import org.ovirt.engine.core.common.businessentities.BusinessEntity;
import org.ovirt.engine.core.common.utils.ObjectUtils;
import org.ovirt.engine.core.compat.Guid;
-public class GlusterGeoRepSessionConfiguration implements BusinessEntity<Guid>{
+public class GlusterGeoRepSessionConfiguration extends GlusterVolumeOptionInfo
implements BusinessEntity<Guid>{
private static final long serialVersionUID = -6506417314359159692L;
Guid sessionId;
- String key;
- String value;
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
+ List<String> allowedValues;
@Override
public Guid getId() {
@@ -38,11 +24,27 @@
this.sessionId = id;
}
+ public String getValue() {
+ return getDefaultValue();
+ }
+
+ public void setValue(String value) {
+ setDefaultValue(value);
+ }
+
+ public List<String> getAllowedValues() {
+ return allowedValues;
+ }
+
+ public void setAllowedValues(List<String> allowedValues) {
+ this.allowedValues = allowedValues;
+ }
+
@Override
public boolean equals(Object obj) {
- return (obj != null) && (obj instanceof
GlusterGeoRepSessionConfiguration) && ObjectUtils.objectsEqual(getId(),
((GlusterGeoRepSessionConfiguration) obj).getId()) &&
- ObjectUtils.objectsEqual(getKey(),
((GlusterGeoRepSessionConfiguration) obj).getKey()) &&
- ObjectUtils.objectsEqual(getValue(),
((GlusterGeoRepSessionConfiguration) obj).getValue());
+ return obj != null && obj instanceof GlusterGeoRepSessionConfiguration
+ && ObjectUtils.objectsEqual(getId(),
((GlusterGeoRepSessionConfiguration) obj).getId())
+ && super.equals(obj);
}
@Override
@@ -50,8 +52,7 @@
final int prime = 31;
int result = 1;
result = prime * result + sessionId.hashCode();
- result = prime * result + key.hashCode();
- result = prime * result + value.hashCode();
+ result = prime * result + super.hashCode();
return result;
}
}
diff --git
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
index e509356..fa65ad5 100644
---
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
@@ -35,6 +35,7 @@
public static final String MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP =
"stop";
public static final String MANAGE_GLUSTER_SERVICE_ACTION_TYPE_RESTART =
"restart";
public static final String COMMAND = "command";
+ public static final String GEO_REP_SESSION_KEY = "geoRepSessionKey";
public static final String HOOK_NAME = "glusterhookname";
public static final String FAILURE_MESSAGE = "failuremessage";
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 478650c..be3e133 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
@@ -49,6 +49,7 @@
VAR__TYPE__GLUSTER_HOOK,
VAR__TYPE__GLUSTER_SERVICE,
VAR__TYPE__GLUSTER_GEOREP_SESSION,
+ VAR__TYPE__GLUSTER_GEOREP_CONFIG,
// External Event
VAR__TYPE__EXTERNAL_EVENT,
@@ -938,6 +939,8 @@
ACTION_TYPE_FAILED_GEOREP_SESSION_STOPPED(ErrorType.CONFLICT),
ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_RESUMED(ErrorType.CONFLICT),
ACTION_TYPE_FAILED_VOLUME_SNAPSHOT_LOCKED(ErrorType.CONFLICT),
+ ACTION_TYPE_FAILED_GLUSTER_GEOREP_CONFIG_SET(ErrorType.CONFLICT),
+ ACTION_TYPE_FAILED_GLUSTER_GEOREP_CONFIG_DEFAULT_SET(ErrorType.CONFLICT),
// OpenStack Glance
ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR(ErrorType.BAD_PARAMETERS),
diff --git
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
index 913be52..018d039 100644
---
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
+++
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
@@ -339,6 +339,7 @@
GetNonEligibilityReasonsOfVolumeForGeoRepSession,
GetGlusterGeoReplicationEligibleVolumes,
GetGlusterVolumeSnapshotsByVolumeId,
+ GetGlusterVolumeGeoRepConfigList,
GetDefaultConfigurationVersion(VdcQueryAuthType.User),
OsRepository(VdcQueryAuthType.User),
diff --git
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
index 245c593..76a9584 100644
---
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
+++
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoDbFacadeImpl.java
@@ -3,6 +3,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.ovirt.engine.core.common.businessentities.gluster.GeoRepCrawlStatus;
@@ -58,6 +59,8 @@
entity.setId(getGuidDefaultEmpty(rs, "session_id"));
entity.setKey(rs.getString("config_key"));
entity.setValue(rs.getString("config_value"));
+ entity.setDescription(rs.getString("config_description"));
+
entity.setAllowedValues(Arrays.asList(rs.getString("config_possible_values").split(";")));
return entity;
}
}
@@ -179,7 +182,9 @@
GlusterGeoRepSessionConfiguration geoRepSessionConfig) {
return createIdParameterMapper(geoRepSessionConfig.getId())
.addValue("config_key", geoRepSessionConfig.getKey())
- .addValue("config_value", geoRepSessionConfig.getValue());
+ .addValue("config_value", geoRepSessionConfig.getValue())
+ .addValue("config_description",
geoRepSessionConfig.getDescription())
+ .addValue("config_possible_values",
geoRepSessionConfig.getAllowedValues());
}
@Override
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 ec03984..a20fbdf 100644
---
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1142,6 +1142,8 @@
ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_RESUMED=Cannot ${action} ${type}.
Geo-replication session is resumed.
ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_PAUSED=Cannot ${action} ${type}.
Geo-replication session is paused.
+ACTION_TYPE_FAILED_GLUSTER_GEOREP_CONFIG_SET=Cannot ${action} ${type}. Cannot
set the configuration.
+ACTION_TYPE_FAILED_GLUSTER_GEOREP_CONFIG_DEFAULT_SET=Cannot ${action} ${type}.
Cannot set default value for the configuration.
ACTION_TYPE_FAILED_TAG_ID_REQUIRED=Cannot ${action} ${type}. Tag ID is
required.
ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES=Cannot ${action} ${type}. Values
are out of range.
ACTION_TYPE_FAILED_QOS_STORAGE_POOL_NOT_EXIST=Cannot ${action} ${type}.
Invalid data center.
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 1d8f2f3..8c29afa 100644
---
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -818,6 +818,10 @@
GEOREP_SESSION_DELETE_FAILED=Failed to delete geo-replication session on
volume ${glusterVolumeName}
GLUSTER_VOLUME_GEO_REP_START=Geo-replication session on volume
${glusterVolumeName} has been started.
GLUSTER_VOLUME_GEO_REP_START_FAILED_EXCEPTION=Failed to start geo-replication
session on volume ${glusterVolumeName}
+GLUSTER_GEOREP_CONFIG_SET=Configuration ${key} has been set to ${value} on the
geo-rep session ${geoRepSessionKey}.
+GLUSTER_GEOREP_CONFIG_SET_FAILED=Failed to set the configuration ${key} to
${value} on geo-rep session ${geoRepSessionKey}.
+GLUSTER_GEOREP_CONFIG_SET_DEFAULT=Configuration of ${key} of session
${geoRepSessionKey} reset to its default value .
+GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED=Failed to set ${key} of session
${geoRepSessionKey} to its default value.
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/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoTest.java
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoTest.java
index 51a5029..dc85f3b 100644
---
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoTest.java
+++
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/GlusterGeoRepDaoTest.java
@@ -56,6 +56,7 @@
GlusterGeoRepSessionConfiguration sessionConfig = new
GlusterGeoRepSessionConfiguration();
sessionConfig.setId(FixturesTool.GLUSTER_GEOREP_SESSION_ID);
sessionConfig.setKey("georep-crawl");
+ sessionConfig.setDescription("Geo-replication session crawl");
sessionConfig.setValue("changelog");
return sessionConfig;
}
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index c0100f1..abbcfe2 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -7348,4 +7348,20 @@
<value>NOTSTARTED</value>
</row>
</table>
+
+ <table name="gluster_config_master">
+ <column>config_key</column>
+ <column>config_description</column>
+ <column>minimum_supported_cluster</column>
+ <column>config_possible_values</column>
+ <column>config_feature</column>
+ <row>
+ <value>georep-crawl</value>
+ <value>Geo-replication session crawl</value>
+ <value>3.5</value>
+ <value></value>
+ <value>geo_replication</value>
+ </row>
+ </table>
+
</dataset>
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 14d5ea1..37ba4bb 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
@@ -3084,6 +3084,12 @@
@DefaultStringValue("Cannot ${action} ${type}. Geo-replication session is
paused.")
String ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_PAUSED();
+ @DefaultStringValue("Cannot ${action} ${type}. Cannot set the
configuration.")
+ String ACTION_TYPE_FAILED_GLUSTER_GEOREP_CONFIG_SET();
+
+ @DefaultStringValue("Cannot ${action} ${type}. Cannot reset the
configuration to its default value.")
+ String ACTION_TYPE_FAILED_GLUSTER_GEOREP_CONFIG_DEFAULT_SET();
+
@DefaultStringValue("Cannot ${action} ${type}. All three values are needed
in order to define QoS on each network directions.")
String ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_VALUES();
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 9320ea1..a3d64ce 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
@@ -451,6 +451,14 @@
String AuditLogType___GEOREP_SESSION_START_FAILED();
+ String AuditLogType___GLUSTER_GEOREP_CONFIG_SET();
+
+ String AuditLogType___GLUSTER_GEOREP_CONFIG_SET_FAILED();
+
+ String AuditLogType___GLUSTER_GEOREP_CONFIG_SET_DEFAULT();
+
+ String AuditLogType___GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED();
+
String VdcActionType___ActivateVds();
String VdcActionType___RecoveryStoragePool();
diff --git
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
index ef57943..70f08e3 100644
---
a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
+++
b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties
@@ -224,6 +224,10 @@
AuditLogType___GEOREP_SESSION_START_FAILED=Failed to start geo-replication
session on volume
AuditLogType___GLUSTER_VOLUME_SNAPSHOT_CREATED=Snapshot created for the volume
AuditLogType___GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED=Failed create snapshot
for the volume
+AuditLogType___GLUSTER_GEOREP_CONFIG_SET=Configuration has been set on the
geo-rep session.
+AuditLogType___GLUSTER_GEOREP_CONFIG_SET_FAILED=Failed to set the
configuration on geo-rep session.
+AuditLogType___GLUSTER_GEOREP_CONFIG_SET_DEFAULT=Configuration has been reset
to its default value.
+AuditLogType___GLUSTER_GEOREP_CONFIG_SET_DEFAULT_FAILED=Failed to reset the
configuration to its default value.
VdcActionType___ActivateVds=Activate Host
diff --git a/packaging/dbscripts/create_views.sql
b/packaging/dbscripts/create_views.sql
index 00ef45e..fc78ce4 100644
--- a/packaging/dbscripts/create_views.sql
+++ b/packaging/dbscripts/create_views.sql
@@ -1790,6 +1790,12 @@
FROM gluster_georep_session georep
INNER JOIN gluster_volumes ON gluster_volumes.id = georep.master_volume_id;
+CREATE OR REPLACE VIEW gluster_geo_rep_config_view
+AS
+SELECT session_id, georepConfig.config_key, config_value, config_description,
config_possible_values, _update_date
+FROM gluster_georep_config georepConfig
+INNER JOIN gluster_config_master ON gluster_config_master.config_key =
georepConfig.config_key AND
gluster_config_master.config_feature='geo_replication';
+
-- Affinity Groups view, including members
CREATE OR REPLACE VIEW affinity_groups_view
AS
diff --git a/packaging/dbscripts/gluster_georep_sp.sql
b/packaging/dbscripts/gluster_georep_sp.sql
index d73d43e..f636058 100644
--- a/packaging/dbscripts/gluster_georep_sp.sql
+++ b/packaging/dbscripts/gluster_georep_sp.sql
@@ -200,11 +200,11 @@
Create or replace FUNCTION GetGlusterGeoRepSessionConfig(v_session_id UUID)
-RETURNS SETOF gluster_georep_config STABLE
+RETURNS SETOF gluster_geo_rep_config_view STABLE
AS $procedure$
BEGIN
- RETURN QUERY SELECT session_id, config_key, config_value, _update_date
- FROM gluster_georep_config
+ RETURN QUERY SELECT *
+ FROM gluster_geo_rep_config_view
WHERE session_id = v_session_id order by config_key asc;
END; $procedure$
LANGUAGE plpgsql;
diff --git
a/packaging/dbscripts/upgrade/03_05_1320_add_gluster_config_master_table.sql
b/packaging/dbscripts/upgrade/03_05_1320_add_gluster_config_master_table.sql
new file mode 100644
index 0000000..2e9fe7a
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_1320_add_gluster_config_master_table.sql
@@ -0,0 +1,12 @@
+CREATE TABLE gluster_config_master
+(
+ config_key VARCHAR(50),
+ config_description VARCHAR(300),
+ minimum_supported_cluster VARCHAR(50),
+ config_possible_values VARCHAR(50),
+ config_feature VARCHAR(50),
+ CONSTRAINT pk_config_key PRIMARY KEY(config_key)
+) WITH OIDS;
+
+ALTER TABLE ONLY gluster_georep_config
+ ADD CONSTRAINT fk_config_key FOREIGN KEY(config_key) REFERENCES
gluster_config_master(config_key);
diff --git
a/packaging/dbscripts/upgrade/03_05_1330_insert_config_description.sql
b/packaging/dbscripts/upgrade/03_05_1330_insert_config_description.sql
new file mode 100644
index 0000000..e2d26b1
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_05_1330_insert_config_description.sql
@@ -0,0 +1,36 @@
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('gluster-log-file', 'The path to the geo-replication glusterfs log
file.', '3.5', '', 'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('gluster-log-level', 'The log level for glusterfs processes.', '3.5',
'', 'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('log-file', 'The path to the geo-replication log file.', '3.5', '',
'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('log-level', 'The log level for geo-replication.', '3.5', '',
'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('ssh-command', 'The SSH command to connect to the remote machine',
'3.5', '', 'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('rsync-command', 'The rsync command to use for synchronizing the
files', '3.5', '', 'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('use-tarssh', 'The use-tarssh command allows tar over Secure Shell
protocol. Use this option to handle workloads of files that have not undergone
edits.', '3.5', '', 'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('timeout', 'The timeout period in seconds.', '3.5', '',
'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('sync-jobs', 'The number of simultaneous files/directories that can be
synchronized.', '3.5', '', 'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('ignore-deletes', 'If this option is set to 1, a file deleted on the
master will not trigger a delete operation on the slave. As a result, the slave
will remain as a superset of the master and can be used to recover the master
in the event of a crash and/or accidental delete.', '3.5', '',
'geo_replication');
+
+INSERT INTO gluster_config_master(config_key, config_description,
minimum_supported_cluster, config_possible_values, config_feature)
+ values('checkpoint', 'Sets a checkpoint with the given option LABEL. If the
option is set as now, then the current time will be used as the label.', '3.5',
'', 'geo_replication');
+
+
+
+
diff --git
a/packaging/dbscripts/upgrade/03_05_1340_gluster_geo_rep_alter_config_value_column.sql
b/packaging/dbscripts/upgrade/03_05_1340_gluster_geo_rep_alter_config_value_column.sql
new file mode 100644
index 0000000..5368675
--- /dev/null
+++
b/packaging/dbscripts/upgrade/03_05_1340_gluster_geo_rep_alter_config_value_column.sql
@@ -0,0 +1 @@
+SELECT fn_db_change_column_type('gluster_georep_config', 'config_value',
'varchar', 'text');
\ No newline at end of file
--
To view, visit https://gerrit.ovirt.org/39668
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d98636a688f9565dff0c86c8820839cb99b1a38
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Sahina Bose <[email protected]>
Gerrit-Reviewer: anmolbabu <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches