use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class NetworkCommonUtils method fillBondSlaves.
public static void fillBondSlaves(Collection<? extends VdsNetworkInterface> nics) {
Map<String, List<String>> bondToSlaves = getBondNameToBondSlaveNamesMap(nics);
for (VdsNetworkInterface nic : nics) {
if (nic instanceof Bond) {
Bond bond = (Bond) nic;
bond.setSlaves(bondToSlaves.containsKey(bond.getName()) ? bondToSlaves.get(bond.getName()) : new ArrayList<String>());
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class NetworkDeviceHelperImpl method updateHostNicVfsConfigWithNumVfsData.
@Override
public void updateHostNicVfsConfigWithNumVfsData(HostNicVfsConfig hostNicVfsConfig) {
VdsNetworkInterface nic = getNicById(hostNicVfsConfig.getNicId());
updateVfsConfigWithNumOfVfsData(hostNicVfsConfig, nic, getDevicesByHostId(nic.getVdsId()));
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class NicLabelValidator method labelBeingAttachedToValidBond.
ValidationResult labelBeingAttachedToValidBond(NicLabel nicLabel) {
String interfaceName = nicLabel.getNicName();
VdsNetworkInterface nic = existingInterfacesMap.get(interfaceName);
if (nic instanceof Bond) {
CreateOrUpdateBond createOrUpdateBond = createOrUpdateBondBusinessEntityMap.containsKey(interfaceName) ? createOrUpdateBondBusinessEntityMap.get(interfaceName) : CreateOrUpdateBond.fromBond((Bond) nic);
if (createOrUpdateBond.getSlaves().size() < 2) {
return new ValidationResult(EngineMessage.IMPROPER_BOND_IS_LABELED, ReplacementUtils.createSetVariableString(HostInterfaceValidator.VAR_BOND_NAME, createOrUpdateBond.getName()));
}
}
return ValidationResult.VALID;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class NicLabelValidator method shouldBeConfigureAsBondSlave.
private boolean shouldBeConfigureAsBondSlave(String interfaceName) {
// Check if the interface was updated to be a bond's slave
for (CreateOrUpdateBond createOrUpdateBond : params.getCreateOrUpdateBonds()) {
if (createOrUpdateBond.getSlaves().contains(interfaceName)) {
return true;
}
}
// The interface wasn't updated to be a slave, check if currently it is a slave.
VdsNetworkInterface existingNic = existingInterfacesMap.get(interfaceName);
if (existingNic == null) {
return false;
}
if (existingNic.isPartOfBond()) {
String bondName = existingNic.getBondName();
VdsNetworkInterface bond = existingInterfacesMap.get(bondName);
boolean bondWasRemoved = params.getRemovedBonds().contains(bond.getId());
boolean slaveWasRemovedFromBond = createOrUpdateBondBusinessEntityMap.containsKey(bondName) && !createOrUpdateBondBusinessEntityMap.get(bondName).getSlaves().contains(interfaceName);
return !bondWasRemoved && !slaveWasRemovedFromBond;
}
return false;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksCommand method isBonding.
private boolean isBonding(NetworkAttachment attachment, BusinessEntityMap<VdsNetworkInterface> nics) {
for (CreateOrUpdateBond bond : getParameters().getCreateOrUpdateBonds()) {
if (bond.getName() != null && bond.getName().equals(attachment.getNicName())) {
return true;
}
}
VdsNetworkInterface attachedNic = nics.get(attachment.getNicId(), attachment.getNicName());
Validate.notNull(attachedNic, "NicId/NicName must refer to a resolvable interface");
return Boolean.TRUE.equals(attachedNic.getBonded());
}
Aggregations