Sahina Bose has uploaded a new change for review.

Change subject: engine: Bll command to refresh geo-rep data
......................................................................

engine: Bll command to refresh geo-rep data

BLL command to execute sync of geo-rep data
from Gluster CLI.

Change-Id: I416663044217891820d0540e3e63e7aa12330f45
Signed-off-by: Sahina Bose <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RefreshGeoRepSessionsCommand.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
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/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 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
8 files changed, 73 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/39584/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RefreshGeoRepSessionsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RefreshGeoRepSessionsCommand.java
new file mode 100644
index 0000000..ee4552a
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/RefreshGeoRepSessionsCommand.java
@@ -0,0 +1,55 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import org.ovirt.engine.core.bll.NonTransactiveCommandAttribute;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+
+
+/**
+ * BLL command to discover and refresh geo-replication sessions in a volume
+ */
+@NonTransactiveCommandAttribute
+public class RefreshGeoRepSessionsCommand<T extends GlusterVolumeParameters> 
extends GlusterCommandBase<T> {
+
+    public RefreshGeoRepSessionsCommand(T params) {
+        super(params);
+        setGlusterVolumeId(params.getVolumeId());
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REFRESH);
+        
addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_GEOREP_SESSION);
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        if (getParameters().getVolumeId() == null || getGlusterVolume() == 
null) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID);
+            return false;
+        }
+
+        return super.canDoAction();
+    }
+
+    protected GlusterGeoRepSyncJob getSyncJobInstance() {
+        return GlusterGeoRepSyncJob.getInstance();
+    }
+
+    @Override
+    protected void executeCommand() {
+        getSyncJobInstance().refreshGeoRepDataForVolume(getGlusterVolume());
+        setSucceeded(true);
+
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        if (getSucceeded()) {
+            return AuditLogType.GLUSTER_GEOREP_SESSION_REFRESH;
+        } else {
+            return errorType == null ? 
AuditLogType.GLUSTER_GEOREP_SESSION_REFRESH_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 6043d94..0e07613 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
@@ -384,6 +384,9 @@
     USER_FORCE_SELECTED_SPM_STOP_FAILED(4096, AuditLogSeverity.ERROR),
     GLUSTER_GEOREP_SESSION_DELETED_FROM_CLI(4097, AuditLogSeverity.WARNING),
     GLUSTER_GEOREP_SESSION_DETECTED_FROM_CLI(4098, AuditLogSeverity.WARNING),
+    GLUSTER_GEOREP_SESSION_REFRESH(4099),
+    GLUSTER_GEOREP_SESSION_REFRESH_FAILED(4100, 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 f739a33..954e4f6 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
@@ -304,6 +304,7 @@
     StopRemoveGlusterVolumeBricks(1423, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
false, QuotaDependency.NONE),
     CommitRemoveGlusterVolumeBricks(1424, 
ActionGroup.MANIPULATE_GLUSTER_VOLUME, false, QuotaDependency.NONE),
     RefreshGlusterVolumeDetails(1425, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
+    RefreshGeoRepSessions(1426, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
 
     // Cluster Policy
     AddClusterPolicy(1450, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, 
QuotaDependency.NONE),
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 2155bb9..1f731f2 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1034,6 +1034,7 @@
 VAR__TYPE__GLUSTER_SERVER=$type Gluster Server
 VAR__TYPE__GLUSTER_HOOK=$type Gluster Hook
 VAR__TYPE__GLUSTER_SERVICE=$type Service
+VAR__TYPE__GLUSTER_GEOREP_SESSION=$type Geo-replication session
 VALIDATION.GLUSTER.VOLUME.ID.NOT_NULL=Volume ID is required.
 VALIDATION.GLUSTER.VOLUME.CLUSTER_ID.NOT_NULL=Cluster ID is required.
 VALIDATION.GLUSTER.VOLUME.NAME.NOT_NULL=Volume Name is required.
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 d506a6d..b10ec03 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -806,6 +806,9 @@
 GLUSTER_BRICK_STATUS_CHANGED=Detected change in status of brick ${brickpath} 
of volume ${glusterVolumeName} from ${oldValue} to ${newValue}.
 GLUSTER_GEOREP_SESSION_DELETED_FROM_CLI=Detected deletion of geo-replication 
session ${geoRepSessionKey} from volume ${glusterVolumeName}
 GLUSTER_GEOREP_SESSION_DETECTED_FROM_CLI=Detected new geo-replication session 
${geoRepSessionKey} for volume ${glusterVolumeName}. Adding it to engine.
+GLUSTER_GEOREP_SESSION_REFRESH=Refreshed geo-replication sessions for volume 
${glusterVolumeName}.
+GLUSTER_GEOREP_SESSION_REFRESH_FAILED=Failed to refresh geo-replication 
sessions 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/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 5300f88..a5b6d98 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
@@ -1,7 +1,5 @@
 package org.ovirt.engine.ui.uicompat;
 
-import org.ovirt.engine.core.common.businessentities.NumaTuneMode;
-
 import com.google.gwt.i18n.client.ConstantsWithLookup;
 
 public interface LocalizedEnums extends ConstantsWithLookup {
@@ -429,6 +427,10 @@
 
     String AuditLogType___REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI();
 
+    String AuditLogType___GLUSTER_GEOREP_SESSION_REFRESH();
+
+    String AuditLogType___GLUSTER_GEOREP_SESSION_REFRESH_FAILED();
+
     String VdcActionType___ActivateVds();
 
     String VdcActionType___RecoveryStoragePool();
@@ -736,6 +738,8 @@
 
     String VdcActionType___ManageGlusterService();
 
+    String VdcActionType___RefreshGeoRepSessions();
+
     String VdcActionType___ConnectStorageToVds();
 
     String VdcActionType___AddVnicProfile();
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 a66ab14..1a63fb1 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
@@ -210,6 +210,8 @@
 AuditLogType___GLUSTER_BRICK_STATUS_CHANGED=Detected change in status of brick
 AuditLogType___GLUSTER_VOLUME_REBALANCE_NOT_FOUND_FROM_CLI=Could not find 
information for rebalance on volume from CLI. Marking it as unknown.
 AuditLogType___REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI=Could not find 
information for remove brick on volume from CLI. Marking it as unknown.
+AuditLogType___GLUSTER_GEOREP_SESSION_REFRESH=Refreshed geo-replication 
sessions for volume.
+AuditLogType___GLUSTER_GEOREP_SESSION_REFRESH_FAILED=Failed to refresh 
geo-replication sessions for volume.
 
 
 VdcActionType___ActivateVds=Activate Host
@@ -339,6 +341,7 @@
 VdcActionType___RemoveGlusterHook=Remove Gluster Hook
 VdcActionType___RefreshGlusterHook=Refresh Gluster Hook
 VdcActionType___ManageGlusterService=Manage Service
+VdcActionType___RefreshGeoRepSessions=Refresh Geo-replication Sessions
 VdcActionType___ActivateStorageDomain=Activate Storage Domain
 VdcActionType___FenceVdsManualy=Fence Host Manually
 VdcActionType___AddEmptyStoragePool=New Data Center
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 9dc1003..8ebabcb 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
@@ -313,6 +313,7 @@
 VAR__TYPE__GLUSTER_SERVER=$type Gluster Server
 VAR__TYPE__GLUSTER_HOOK=$type Gluster Hook
 VAR__TYPE__GLUSTER_SERVICE=$type Service
+VAR__TYPE__GLUSTER_GEOREP_SESSION=$type Geo-replication session
 VAR__TYPE__NETWORK_QOS=$type Network QoS
 VAR__TYPE__QOS=$type QoS
 VAR__TYPE__SPM=$type SPM


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

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

Reply via email to