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/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
6 files changed, 71 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/34630/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 6de3b65..d33e437 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
@@ -381,6 +381,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 e99a0ee..d525cd4 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
@@ -300,6 +300,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),
 
     // Scheduling Policy
     AddClusterPolicy(1450, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, 
QuotaDependency.NONE),
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 838e40d..7b630a6 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -798,6 +798,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 ${NetworkQoSName} was added. (User: 
${UserName})
 USER_FAILED_TO_ADD_NETWORK_QOS=Failed to add Network QoS ${NetworkQoSName}. 
(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 fd06a63..3dd847d 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 {
@@ -425,6 +423,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();
@@ -732,6 +734,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 03e3806..dfd985f 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
@@ -212,6 +212,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
@@ -341,6 +343,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


-- 
To view, visit http://gerrit.ovirt.org/34630
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to