Moti Asayag has uploaded a new change for review. Change subject: engine: Collect stats before activating host ......................................................................
engine: Collect stats before activating host When the host moves to non operational due to a required interface in down state, the host statistics should be collected and examined before attempting to activate the host. Change-Id: Id3de8a3ccb1084f8be8f9c3213f797146f8f0b36 Bug-Url: https://bugzilla.redhat.com/1070260 Signed-off-by: Moti Asayag <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java 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/VirtMonitoringStrategy.java 3 files changed, 17 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/26015/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java index 4eb0c96..07ebf3a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AutoRecoveryManager.java @@ -10,11 +10,15 @@ import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdsActionParameters; import org.ovirt.engine.core.common.businessentities.BusinessEntity; +import org.ovirt.engine.core.common.businessentities.NonOperationalReason; import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.VDS; +import org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface; import org.ovirt.engine.core.common.config.Config; import org.ovirt.engine.core.common.config.ConfigValues; import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.common.vdscommands.VDSCommandType; +import org.ovirt.engine.core.common.vdscommands.VdsIdAndVdsVDSCommandParametersBase; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.AutoRecoverDAO; @@ -69,12 +73,20 @@ @Override public List<VDS> filter(List<VDS> list) { List<VDS> filtered = new ArrayList<>(list.size()); + List<VdsNetworkInterface> nics; for (VDS vds : list) { + if (vds.getNonOperationalReason() == NonOperationalReason.NETWORK_INTERFACE_IS_DOWN) { + getBackend().getResourceManager().RunVdsCommand(VDSCommandType.GetStats, + new VdsIdAndVdsVDSCommandParametersBase(vds)); + nics = vds.getInterfaces(); + } else { + nics = getDbFacade().getInterfaceDao().getAllInterfacesForVds(vds.getId()); + } + Pair<List<String>, List<String>> problematicNics = - VdsUpdateRunTimeInfo.determineProblematicNics(getDbFacade().getInterfaceDao() - .getAllInterfacesForVds(vds.getId()), getDbFacade().getNetworkDao() - .getAllForCluster(vds.getVdsGroupId())); + VdsUpdateRunTimeInfo.determineProblematicNics(nics, getDbFacade().getNetworkDao() + .getAllForCluster(vds.getVdsGroupId())); if (problematicNics.getFirst().isEmpty()) { filtered.add(vds); } 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 ca53003..adda7f1 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 @@ -22,10 +22,9 @@ CLUSTER_VERSION_INCOMPATIBLE_WITH_CLUSTER(14), GLUSTER_HOST_UUID_ALREADY_EXISTS(15), ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER(16), - NETWORK_INTERFACE_IS_DOWN(17, true); + NETWORK_INTERFACE_IS_DOWN(17); private final int value; - private boolean collectStats; private static final Map<Integer, NonOperationalReason> valueMap = new HashMap<Integer, NonOperationalReason>( values().length); @@ -40,17 +39,8 @@ 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) { 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 350dbec..5542298 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 @@ -37,8 +37,7 @@ @Override public boolean isMonitoringNeeded(VDS vds) { // 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()); + return vds.getStatus() != VDSStatus.NonOperational || vds.getVmCount() > 0; } @Override -- To view, visit http://gerrit.ovirt.org/26015 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id3de8a3ccb1084f8be8f9c3213f797146f8f0b36 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
