Ramesh N has uploaded a new change for review.

Change subject: gluster: display error message when sync storage device fails
......................................................................

gluster: display error message when sync storage device fails

  Handle the exceptions properly in StorageDeviceSyncJob so that
error in sync storage device will be logged in the audit log
when user tries a manual sync from the UI.

Change-Id: Ib05b3f0bcaa95fb50440c939f6b07ade9ba8879c
Bug-Url: https://bugzilla.redhat.com/1218240
Signed-off-by: Ramesh Nachimuthu <rnach...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StorageDeviceSyncJob.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SyncStorageDevicesCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/HostGlusterStorageDevicesListModel.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
8 files changed, 28 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/42274/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StorageDeviceSyncJob.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StorageDeviceSyncJob.java
index 8db7d8c..5d8bc25 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StorageDeviceSyncJob.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/StorageDeviceSyncJob.java
@@ -47,7 +47,7 @@
         }
     }
 
-    public void refreshStorageDevicesFromServers(List<VDS> upServers) {
+    private void refreshStorageDevicesFromServers(List<VDS> upServers) {
         List<Callable<Pair<VDS, List<StorageDevice>>>> storageDevicesListCalls 
= new ArrayList<>();
 
         for (final VDS server : upServers) {
@@ -90,7 +90,7 @@
 
     }
 
-    private void updateStorageDevices(VDS vds, List<StorageDevice> 
storageDevicesFromVdsm) {
+    public void updateStorageDevices(VDS vds, List<StorageDevice> 
storageDevicesFromVdsm) {
         Set<String> deviceUuidsFromVdsm = new HashSet<>();
         Set<String> deviceNamesFromVdsm = new HashSet<>();
 
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SyncStorageDevicesCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SyncStorageDevicesCommand.java
index 5628085..13dc600 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SyncStorageDevicesCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/SyncStorageDevicesCommand.java
@@ -1,6 +1,6 @@
 package org.ovirt.engine.core.bll.gluster;
 
-import java.util.Arrays;
+import java.util.List;
 
 import org.ovirt.engine.core.bll.VdsCommand;
 import org.ovirt.engine.core.bll.VdsValidator;
@@ -9,7 +9,11 @@
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.VdsActionParameters;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
+import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice;
 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.VdsIdVDSCommandParametersBase;
 
 public class SyncStorageDevicesCommand<T extends VdsActionParameters> extends 
VdsCommand<T> {
 
@@ -40,9 +44,17 @@
 
     @Override
     protected void executeCommand() {
+        VDSReturnValue returnValue =
+                runVdsCommand(VDSCommandType.GetStorageDeviceList, new 
VdsIdVDSCommandParametersBase(getVds().getId()));
+        if (returnValue.getSucceeded()){
+            List<StorageDevice> storageDevices = (List<StorageDevice>) 
returnValue.getReturnValue();
+            getStorageDeviceSyncJobInstance().updateStorageDevices(getVds(), 
storageDevices);
+            setSucceeded(true);
+        } else {
+            handleVdsError(returnValue);
+            setSucceeded(false);
+        }
 
-        
getStorageDeviceSyncJobInstance().refreshStorageDevicesFromServers(Arrays.asList(getVds()));
-        setSucceeded(true);
     }
 
     private StorageDeviceSyncJob getStorageDeviceSyncJobInstance() {
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 c0542bc..09aa767 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
@@ -418,7 +418,7 @@
     NEW_STORAGE_DEVICE_DETECTED(4124),
     STORAGE_DEVICE_REMOVED_FROM_THE_HOST(4125),
     SYNC_STORAGE_DEVICES_IN_HOST(4126),
-    SYNC_STORAGE_DEVICES_IN_HOST_FAILED(4127),
+    SYNC_STORAGE_DEVICES_IN_HOST_FAILED(4127, AuditLogSeverity.ERROR),
     GEOREP_OPTION_SET_FROM_CLI(4128, AuditLogSeverity.WARNING),
     GEOREP_OPTION_CHANGED_FROM_CLI(4129, AuditLogSeverity.WARNING),
     GLUSTER_MASTER_VOLUME_STOP_FAILED_DURING_SNAPSHOT_RESTORE(4130, 
AuditLogSeverity.ERROR),
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 63408e5..f9ec8de 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -851,7 +851,7 @@
 NEW_STORAGE_DEVICE_DETECTED=Found new storage device ${storageDevice} on host 
${VdsName}, and added it to engine DB."
 STORAGE_DEVICE_REMOVED_FROM_THE_HOST=Detected deletion of storage device 
${storageDevice} on host ${VdsName}, and deleting it from engine DB."
 SYNC_STORAGE_DEVICES_IN_HOST=Manually synced the storage devices from host 
${VdsName}
-SYNC_STORAGE_DEVICES_IN_HOST_FAILED=Failed to synced storage devices from host 
${VdsName}
+SYNC_STORAGE_DEVICES_IN_HOST_FAILED=Failed to sync storage devices from host 
${VdsName}
 GEOREP_SESSION_STARTED=Geo-replication session on volume ${glusterVolumeName} 
of cluster ${vdsGroupName} has been started.
 GEOREP_SESSION_START_FAILED=Failed to start geo-replication session on volume 
${glusterVolumeName} of cluster ${vdsGroupName}
 GEOREP_OPTION_SET_FROM_CLI=Detected new option ${key}=${value} for 
geo-replication session ${geoRepSessionKey} on volume ${glusterVolumeName} of 
cluster ${VdsGroupName}, and added it to engine.
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
index d5221c6..84e73b0 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -117,6 +117,7 @@
 job.SshSoftFencing=Executing SSH Soft Fencing on host ${VDS}
 job.RemoveDiskSnapshots=Removing Disks from Snapshot(s) ${Snapshots} of VM 
${VM}
 job.VdsKdumpDetection=Detecting kdump flow on host ${VDS}
+job.SyncStorageDevices=Scanning storage devices on the host ${VDS}
 
 # Step types
 step.VALIDATING=Validating
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/HostGlusterStorageDevicesListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/HostGlusterStorageDevicesListModel.java
index 4f0b656..6daf493 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/HostGlusterStorageDevicesListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/HostGlusterStorageDevicesListModel.java
@@ -161,7 +161,11 @@
 
     private void syncStorageDevices() {
         Frontend.getInstance()
-                .runAction(VdcActionType.SyncStorageDevices, new 
VdsActionParameters(getEntity().getId()));
+                .runAction(VdcActionType.SyncStorageDevices,
+                        new VdsActionParameters(getEntity().getId()),
+                        null,
+                        true,
+                        true);
     }
 
     @Override
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 ab7b503..668fabc 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
@@ -864,6 +864,8 @@
 
     String VdcActionType___RestoreGlusterVolumeSnapshot();
 
+    String VdcActionType___SyncStorageDevices();
+
     String VdcActionType___CreateBrick();
 
     String VdcObjectType___AdElements();
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 1953336..da902ae 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
@@ -386,6 +386,7 @@
 VdcActionType___AddGlusterHook=Add Gluster Hook
 VdcActionType___RemoveGlusterHook=Remove Gluster Hook
 VdcActionType___RefreshGlusterHook=Refresh Gluster Hook
+VdcActionType___SyncStorageDevices=Sync Storage Devices
 VdcActionType___CreateBrick=Create Brick
 VdcActionType___ManageGlusterService=Manage Service
 VdcActionType___RefreshGeoRepSessions=Refresh Geo-replication Sessions


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

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

Reply via email to