Moti Asayag has uploaded a new change for review.

Change subject: engine: Improve message when network is mis-configured
......................................................................

engine: Improve message when network is mis-configured

The patch adds a specific message to the host general sub tab
for the case of a VM network isn't implemented so on the host.

In addition, it adjusts the indicator of the same error in the
event log to warning so it could be noticeable easily.

Change-Id: I0f51fdc0d66cc55020858391dabd026b88e4fe35
Bug-Url: https://bugzilla.redhat.com/951920
Signed-off-by: Moti Asayag <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CollectVdsNetworkDataVDSCommand.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
7 files changed, 32 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/82/14082/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java
index 32d25f6..6b797e7 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetNonOperationalVdsCommand.java
@@ -19,6 +19,7 @@
  * This command will try to migrate all the vds vms (if needed) and move the 
vds
  * to Non-Operational state
  */
+@SuppressWarnings("serial")
 @NonTransactiveCommandAttribute
 public class SetNonOperationalVdsCommand<T extends 
SetNonOperationalVdsParameters> extends MaintenanceVdsCommand<T> {
 
@@ -56,6 +57,8 @@
                     case HA_ONLY:
                         MigrateAllVms(getExecutionContext(), true);
                         break;
+                    default:
+                        break;
                     }
                 }
             });
@@ -66,6 +69,11 @@
                     getVds().getName(), 
getParameters().getCustomLogValues().get("Networks"));
         }
 
+        if (getParameters().getNonOperationalReason() == 
NonOperationalReason.VM_NETWORK_IS_BRIDGELESS) {
+            log.errorFormat("Host '{0}' is set to Non-Operational, the 
following networks are implemented as non-VM instead of a VM networks: '{1}'",
+                    getVds().getName(), 
getParameters().getCustomLogValues().get("Networks"));
+        }
+
         setSucceeded(true);
     }
 
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
index eebd957..f68f6fb 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java
@@ -301,7 +301,7 @@
         severities.put(AuditLogType.VDS_LOW_DISK_SPACE_ERROR, 
AuditLogSeverity.ERROR);
         severities.put(AuditLogType.VDS_ACTIVATE_ASYNC, 
AuditLogSeverity.NORMAL);
         severities.put(AuditLogType.VDS_ACTIVATE_FAILED_ASYNC, 
AuditLogSeverity.NORMAL);
-        
severities.put(AuditLogType.VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS, 
AuditLogSeverity.NORMAL);
+        
severities.put(AuditLogType.VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS, 
AuditLogSeverity.WARNING);
         severities.put(AuditLogType.VDS_TIME_DRIFT_ALERT, 
AuditLogSeverity.WARNING);
         severities.put(AuditLogType.PROXY_HOST_SELECTION, 
AuditLogSeverity.NORMAL);
     }
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 dac1553..e65fd10 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -545,7 +545,7 @@
 STORAGE_DOMAIN_TASKS_ERROR=Storage Domain ${StorageDomainName} is down while 
there are tasks running on it. These tasks may fail.
 IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES=While importing VM ${VmName}, the 
Network/s ${Networks} were found to be Non-VM Networks or do not exist in 
Cluster. Network Name was not set in the Interface/s ${Interfaces}.
 IMPORTEXPORT_IMPORT_TEMPLATE_INVALID_INTERFACES=While importing Template 
${VmTemplateName}, the Network/s ${Networks} were found to be Non-VM Networks 
or do not exist in Cluster. Network Name was not set in the Interface/s 
${Interfaces}.
-VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS=Host ${VdsName} does not 
comply with the cluster ${VdsGroupName} networks, the following VM networks are 
bridgeless: '${Networks}'
+VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS=Host ${VdsName} does not 
comply with the cluster ${VdsGroupName} networks, the following VM networks are 
non-VM networks: '${Networks}'
 # Gluster Messages
 GLUSTER_VOLUME_CREATE=Gluster Volume ${glusterVolumeName} created.
 GLUSTER_VOLUME_CREATE_FAILED=Creation of Gluster Volume ${glusterVolumeName} 
failed.
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
index e3708cc..eb0bd2c 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java
@@ -548,21 +548,22 @@
             }
 
             VDSStatus returnStatus = vds.getStatus();
-            boolean isSetNonOperational =
+            NonOperationalReason nonOperationalReason =
                     
CollectVdsNetworkDataVDSCommand.persistAndEnforceNetworkCompliance(vds, 
skipMgmtNet);
-            if (isSetNonOperational) {
-                setIsSetNonOperationalExecuted(true);
-            }
 
-            if (isSetNonOperational && returnStatus != 
VDSStatus.NonOperational) {
-                if (log.isDebugEnabled()) {
-                    log.debugFormat(
-                            "refreshCapabilities:GetCapabilitiesVDSCommand vds 
{0} networks do not match its cluster networks, vds will be moved to 
NonOperational",
-                            vds.getStaticData().getId());
+            if (nonOperationalReason != NonOperationalReason.NONE) {
+                setIsSetNonOperationalExecuted(true);
+
+                if (returnStatus != VDSStatus.NonOperational) {
+                    if (log.isDebugEnabled()) {
+                        log.debugFormat(
+                                "refreshCapabilities:GetCapabilitiesVDSCommand 
vds {0} networks do not match its cluster networks, vds will be moved to 
NonOperational",
+                                vds.getStaticData().getId());
+                    }
+                    vds.setStatus(VDSStatus.NonOperational);
+                    vds.setNonOperationalReason(nonOperationalReason);
+                    returnStatus = vds.getStatus();
                 }
-                vds.setStatus(VDSStatus.NonOperational);
-                
vds.setNonOperationalReason(NonOperationalReason.NETWORK_UNREACHABLE);
-                returnStatus = vds.getStatus();
             }
 
             // We process the software capabilities.
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CollectVdsNetworkDataVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CollectVdsNetworkDataVDSCommand.java
index 58083e4..cc3de76 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CollectVdsNetworkDataVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/CollectVdsNetworkDataVDSCommand.java
@@ -1,6 +1,5 @@
 package org.ovirt.engine.core.vdsbroker.vdsbroker;
 
-import static 
org.ovirt.engine.core.common.businessentities.NonOperationalReason.VM_NETWORK_IS_BRIDGELESS;
 import static 
org.ovirt.engine.core.common.businessentities.network.NetworkStatus.OPERATIONAL;
 
 import java.util.ArrayList;
@@ -78,9 +77,9 @@
      * @param skipManagementNetwork
      *            if <code>true</code> skip validations for the management 
network (existence on the host or configured
      *            properly)
-     * @return
+     * @return The reason for non-operability of the host or 
<code>NonOperationalReason.NONE</code>
      */
-    public static boolean persistAndEnforceNetworkCompliance(VDS vds, boolean 
skipManagementNetwork) {
+    public static NonOperationalReason persistAndEnforceNetworkCompliance(VDS 
vds, boolean skipManagementNetwork) {
         persistTopology(vds);
 
         if (vds.getStatus() != VDSStatus.Maintenance) {
@@ -100,7 +99,7 @@
                 customLogValues.put("Networks", networks);
 
                 setNonOperationl(vds, 
NonOperationalReason.NETWORK_UNREACHABLE, customLogValues);
-                return true;
+                return NonOperationalReason.NETWORK_UNREACHABLE;
             }
 
             // Check that VM networks are implemented above a bridge.
@@ -109,13 +108,13 @@
                 customLogValues = new HashMap<String, String>();
                 customLogValues.put("Networks", networks);
 
-                setNonOperationl(vds, VM_NETWORK_IS_BRIDGELESS, 
customLogValues);
-                return true;
+                setNonOperationl(vds, 
NonOperationalReason.VM_NETWORK_IS_BRIDGELESS, customLogValues);
+                return NonOperationalReason.VM_NETWORK_IS_BRIDGELESS;
             }
 
             logUnsynchronizedNetworks(vds, 
Entities.entitiesByName(clusterNetworks));
         }
-        return false;
+        return NonOperationalReason.NONE;
     }
 
     private static void skipManagementNetworkCheck(List<VdsNetworkInterface> 
ifaces, List<Network> clusterNetworks) {
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 1fa8e95..dc2c818 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
@@ -14,6 +14,8 @@
 
        String NonOperationalReason___NETWORK_UNREACHABLE();
 
+       String NonOperationalReason___VM_NETWORK_IS_BRIDGELESS();
+
        String NonOperationalReason___VERSION_INCOMPATIBLE_WITH_CLUSTER();
 
        String NonOperationalReason___KVM_NOT_RUNNING();
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 06bae33..affa4b7 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
@@ -3,6 +3,7 @@
 NonOperationalReason___CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER=Host CPU type is not 
compatible with Cluster Properties.
 NonOperationalReason___STORAGE_DOMAIN_UNREACHABLE=Host failed to attach one of 
the Storage Domains attached to it.
 NonOperationalReason___NETWORK_UNREACHABLE=One of the Logical Networks defined 
for this Cluster is Unreachable by the Host.
+NonOperationalReason___VM_NETWORK_IS_BRIDGELESS=One of the host's networks is 
configured as a non-VM network while its Logical Network configuration 
specifies it is a VM network.
 NonOperationalReason___VERSION_INCOMPATIBLE_WITH_CLUSTER=Host's Compatibility 
Version doesn't match the Cluster's Compatibility Version.
 NonOperationalReason___KVM_NOT_RUNNING=KVM is not running on the Host.
 NonOperationalReason___TIMEOUT_RECOVERING_FROM_CRASH=Timeout connecting to 
Host.


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

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

Reply via email to