use of org.ovirt.engine.core.common.businessentities.network.InterfaceStatus in project ovirt-engine by oVirt.
the class HostNetworkInterfaceBondedListViewItem method createIcon.
@Override
protected IsWidget createIcon() {
InterfaceStatus interfaceStatus = getEntity().getInterface().getStatistics().getStatus();
SafeHtml bondPropertiesMessage = createBondTooltipMessage(getEntity(), interfaceStatus);
SafeHtml bondMessage = templates.italicWordWrapMaxWidthWithBoldTitle(constants.bondProperties(), bondPropertiesMessage);
WidgetTooltip iconTooltip = new WidgetTooltip(new BondedNetworkIcon());
iconTooltip.setHtml(bondMessage);
iconPanel.add(iconTooltip);
return iconPanel;
}
use of org.ovirt.engine.core.common.businessentities.network.InterfaceStatus in project ovirt-engine by oVirt.
the class HostMonitoring method reportNicStatusChanges.
private void reportNicStatusChanges() {
List<VdsNetworkInterface> interfaces = vds.getInterfaces();
Set<VdsNetworkInterface> slaves = new HashSet<>();
Map<String, VdsNetworkInterface> monitoredInterfaces = new HashMap<>();
Map<String, VdsNetworkInterface> interfaceByName = Entities.entitiesByName(interfaces);
for (VdsNetworkInterface iface : interfaces) {
if (iface.getBondName() != null) {
slaves.add(iface);
}
String baseIfaceName = NetworkCommonUtils.stripVlan(iface);
// If the parent interface already marked as monitored- no need to check it again
if (monitoredInterfaces.containsKey(baseIfaceName)) {
continue;
}
// The status of the interface should be monitored only if it has networks attached to it or has labels
if (StringUtils.isNotEmpty(iface.getNetworkName()) || NetworkUtils.isLabeled(iface)) {
VdsNetworkInterface baseIface = iface;
// If vlan find the parent interface
if (iface.getVlanId() != null) {
baseIface = interfaceByName.get(baseIfaceName);
}
monitoredInterfaces.put(baseIfaceName, baseIface);
}
}
// Slaves should be monitored if the bond is monitored
for (VdsNetworkInterface slave : slaves) {
if (monitoredInterfaces.containsKey(slave.getBondName())) {
monitoredInterfaces.put(slave.getName(), slave);
}
}
for (Map.Entry<String, InterfaceStatus> entry : oldInterfaceStatus.entrySet()) {
VdsNetworkInterface iface = monitoredInterfaces.get(entry.getKey());
InterfaceStatus oldStatus = entry.getValue();
InterfaceStatus status;
if (iface != null) {
status = iface.getStatistics().getStatus();
if (oldStatus != InterfaceStatus.NONE && oldStatus != status) {
AuditLogable logable = createAuditLogableForHost();
logable.setCustomId(iface.getName());
if (iface.getBondName() != null) {
logable.addCustomValue("SlaveName", iface.getName());
logable.addCustomValue("BondName", iface.getBondName());
auditLog(logable, status == InterfaceStatus.UP ? AuditLogType.HOST_BOND_SLAVE_STATE_UP : AuditLogType.HOST_BOND_SLAVE_STATE_DOWN);
} else {
logable.addCustomValue("InterfaceName", iface.getName());
auditLog(logable, status == InterfaceStatus.UP ? AuditLogType.HOST_INTERFACE_STATE_UP : AuditLogType.HOST_INTERFACE_STATE_DOWN);
}
}
}
}
}
Aggregations