Moti Asayag has uploaded a new change for review. Change subject: engine: Collect stats based on non-operational reason ......................................................................
engine: Collect stats based on non-operational reason If a host become non-operational due to network issue, the statistics will not be collected any more. Therefore any attempt to activate the host by the Auto-Recovery manager will be skipped. Even if the network issue will be solved, the host will remain non-operational unless activated by the user. This patch will allow to examine the cause for the non- operational status and continue stats collection to assure a network issue was solved and re-attempt to activate the host. Change-Id: I407d165e1cf13bbd1ba50811eaed4771c3f36f1a Bug-Url: https://bugzilla.redhat.com/1070260 Signed-off-by: Moti Asayag <[email protected]> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.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 5 files changed, 29 insertions(+), 20 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/64/25664/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java index 311f553..ca53003 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NonOperationalReason.java @@ -21,9 +21,11 @@ UNINITIALIZED(13), CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER(14), GLUSTER_HOST_UUID_ALREADY_EXISTS(15), - ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER(16); + ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER(16), + NETWORK_INTERFACE_IS_DOWN(17, true); private final int value; + private boolean collectStats; private static final Map<Integer, NonOperationalReason> valueMap = new HashMap<Integer, NonOperationalReason>( values().length); @@ -38,10 +40,19 @@ this.value = value; } + private NonOperationalReason(int value, boolean collectStats) { + this(value); + this.collectStats = collectStats; + } + public int getValue() { return value; } + public boolean shouldCollectStats() { + return collectStats; + } + public static NonOperationalReason forValue(int value) { return valueMap.get(value); } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java index 969ca98..183e444 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java @@ -22,10 +22,11 @@ import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.DiskImageDynamic; import org.ovirt.engine.core.common.businessentities.Entities; -import org.ovirt.engine.core.common.businessentities.MigrationSupport; import org.ovirt.engine.core.common.businessentities.IVdsEventListener; import org.ovirt.engine.core.common.businessentities.LUNs; import org.ovirt.engine.core.common.businessentities.LunDisk; +import org.ovirt.engine.core.common.businessentities.MigrationSupport; +import org.ovirt.engine.core.common.businessentities.NonOperationalReason; import org.ovirt.engine.core.common.businessentities.OriginType; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; @@ -635,36 +636,29 @@ return; } - // if we could retreive it within the timeout, remove from map (for future checks) and set the host to + // if we could retrieve it within the timeout, remove from map (for future checks) and set the host to // non-operational hostDownTimes.remove(_vds.getId()); try { - StringBuilder sNics = new StringBuilder(); - StringBuilder sNetworks = new StringBuilder(); - - for (String nic : brokenNics) { - sNics.append(nic) - .append(", "); - } - for (String net : networks) { - sNetworks.append(net) - .append(", "); - } + String networkNames = StringUtils.join(networks, ", "); + String nicNames = StringUtils.join(brokenNics, ", "); String message = String.format( "Host '%s' moved to Non-Operational state because interface/s '%s' are down which needed by network/s '%s' in the current cluster", _vds.getName(), - sNics.toString(), - sNetworks.toString()); + nicNames, + networkNames); + _vds.setNonOperationalReason(NonOperationalReason.NETWORK_INTERFACE_IS_DOWN); _vdsManager.setStatus(VDSStatus.NonOperational, _vds); log.info(message); AuditLogableBase logable = new AuditLogableBase(_vds.getId()); - logable.addCustomValue("Networks", StringUtils.stripEnd(sNetworks.toString(), ", ")); - logable.addCustomValue("Interfaces", StringUtils.stripEnd(sNics.toString(), ", ")); + logable.addCustomValue("Networks", networkNames); + logable.addCustomValue("Interfaces", nicNames); + logable.setCustomId(nicNames + networkNames); auditLog(logable, AuditLogType.VDS_SET_NONOPERATIONAL_IFACE_DOWN); } catch (Exception e) { log.error(String.format("checkInterface: Failure on moving host: %s to non-operational.", diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java index 6eca035..350dbec 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VirtMonitoringStrategy.java @@ -36,8 +36,9 @@ @Override public boolean isMonitoringNeeded(VDS vds) { - // No need to update the run-time info for hosts that don't run VMs - return (vds.getStatus() != VDSStatus.NonOperational || vds.getVmCount() > 0); + // No need to update the run-time info for hosts that don't run VMs, depends on the non-operational reason + return vds.getStatus() != VDSStatus.NonOperational || vds.getVmCount() > 0 + || (vds.getNonOperationalReason() != null && vds.getNonOperationalReason().shouldCollectStats()); } @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 151d996..b19b6d0 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 @@ -38,6 +38,8 @@ String NonOperationalReason___ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER(); + String NonOperationalReason___NETWORK_INTERFACE_IS_DOWN(); + String UsbPolicy___ENABLED_LEGACY(); String UsbPolicy___ENABLED_NATIVE(); 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 2f1d615..96adddc 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 @@ -15,6 +15,7 @@ NonOperationalReason___UNTRUSTED=Host is untrusted. NonOperationalReason___UNINITIALIZED=Host is uninitialized as it is not attested yet. NonOperationalReason___ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER=Host's architecture doesn't match the Cluster's architecture. +NonOperationalReason___NETWORK_INTERFACE_IS_DOWN=One or more interfaces required by one or more networks is down. UsbPolicy___ENABLED_LEGACY=Legacy UsbPolicy___DISABLED=Disabled UsbPolicy___ENABLED_NATIVE=Native -- To view, visit http://gerrit.ovirt.org/25664 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I407d165e1cf13bbd1ba50811eaed4771c3f36f1a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Moti Asayag <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
