use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class BackendHostNicNetworkAttachmentsResource method verifyNicExistenceToHandle404StatusCode.
private void verifyNicExistenceToHandle404StatusCode() {
List<VdsNetworkInterface> hostInterfaces = getBackendCollection(VdsNetworkInterface.class, QueryType.GetVdsInterfacesByVdsId, new IdQueryParameters(getHostId()));
boolean found = false;
for (VdsNetworkInterface hostInterface : hostInterfaces) {
if (hostInterface.getId().equals(nicId)) {
found = true;
break;
}
}
if (!found) {
notFound(VdsNetworkInterface.class);
}
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class BackendHostNicResource method getOldNetwork.
private org.ovirt.engine.core.common.businessentities.network.Network getOldNetwork(VdsNetworkInterface originalInter) {
String oldNetworkName = originalInter.getNetworkName();
if (!StringUtils.isEmpty(oldNetworkName)) {
return lookupAtachedNetwork(originalInter.getNetworkName());
} else {
InterfaceAndIdQueryParameters params = new InterfaceAndIdQueryParameters(originalInter.getVdsId(), originalInter);
List<VdsNetworkInterface> vlans = getBackendCollection(VdsNetworkInterface.class, QueryType.GetAllChildVlanInterfaces, params);
if (vlans != null && !vlans.isEmpty()) {
return lookupAtachedNetwork(vlans.get(0).getNetworkName());
} else {
return null;
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostNicMapper method map.
@Mapping(from = HostNic.class, to = VdsNetworkInterface.class)
public static VdsNetworkInterface map(HostNic model, VdsNetworkInterface template) {
VdsNetworkInterface entity;
if (template != null) {
entity = template;
} else if (model.isSetBonding()) {
entity = new Bond();
} else if (model.isSetVlan()) {
entity = new Vlan();
} else {
entity = new Nic();
}
if (model.isSetId()) {
entity.setId(GuidUtils.asGuid(model.getId()));
}
if (model.isSetNetwork() && model.getNetwork().isSetName()) {
entity.setNetworkName(model.getNetwork().getName());
}
if (model.isSetName()) {
entity.setName(model.getName());
}
if (model.isSetBaseInterface()) {
entity.setBaseInterface(model.getBaseInterface());
}
mapIpv4FromModel(model, entity);
mapIpv6FromModel(model, entity);
if (model.isSetMac() && model.getMac().isSetAddress()) {
entity.setMacAddress(model.getMac().getAddress());
}
if (model.isSetBonding()) {
entity.setBonded(true);
if (model.getBonding().isSetOptions()) {
List<Option> bondingOptions = model.getBonding().getOptions().getOptions();
String optionsString = bondingOptions.stream().filter(Option::isSetName).map(x -> x.getName() + "=" + x.getValue()).collect(joining(" "));
entity.setBondOptions(optionsString);
}
}
if (model.isSetQos()) {
entity.setQos((HostNetworkQos) QosMapper.map(model.getQos(), null));
}
return entity;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class AutoRecoveryManager method recoverImpl.
public void recoverImpl() {
check(vdsDao, ActionType.ActivateVds, arg -> {
final VdsActionParameters params = new VdsActionParameters(arg.getId());
params.setRunSilent(true);
return params;
}, list -> {
List<VDS> filtered = new ArrayList<>(list.size());
List<VdsNetworkInterface> nics;
for (VDS vds : list) {
if (vds.getNonOperationalReason() == NonOperationalReason.NETWORK_INTERFACE_IS_DOWN) {
backend.getResourceManager().runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(vds));
nics = vds.getInterfaces();
} else {
nics = interfaceDao.getAllInterfacesForVds(vds.getId());
}
Map<String, Set<String>> problematicNics = NetworkMonitoringHelper.determineProblematicNics(nics, networkDao.getAllForCluster(vds.getClusterId()));
if (problematicNics.isEmpty()) {
filtered.add(vds);
}
}
return filtered;
}, "hosts");
check(storageDomainDao, ActionType.ConnectDomainToStorage, arg -> {
final StorageDomainPoolParametersBase params = new StorageDomainPoolParametersBase(arg.getId(), arg.getStoragePoolId());
params.setRunSilent(true);
return params;
}, list -> list, "storage domains");
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class GlusterSyncJob method updateStatusAndpeerProbeOtherIface.
private void updateStatusAndpeerProbeOtherIface(Network glusterNetwork, VDS host, GlusterServerInfo fetchedServerInfo) {
GlusterServer glusterServer = serverDao.get(host.getId());
if (glusterServer == null) {
return;
}
if (glusterServer.getPeerStatus() == PeerStatus.DISCONNECTED && fetchedServerInfo.getStatus() == PeerStatus.CONNECTED) {
// change the status to indicate that host is now part of cluster
serverDao.updatePeerStatus(host.getId(), PeerStatus.CONNECTED);
}
if (glusterNetwork == null || host.getStatus() != VDSStatus.Up) {
return;
}
List<VdsNetworkInterface> interfaces = interfaceDao.getAllInterfacesForVds(host.getId());
for (VdsNetworkInterface iface : interfaces) {
if (glusterNetwork.getName().equals(iface.getNetworkName()) && StringUtils.isNotBlank(iface.getIpv4Address()) && !glusterServer.getKnownAddresses().contains(iface.getIpv4Address())) {
// get another server in the cluster
VDS upServer = getAlternateUpServerInCluster(host.getClusterId(), host.getId());
if (upServer != null) {
boolean peerProbed = glusterPeerProbeAdditionalInterface(upServer, iface.getIpv4Address());
if (peerProbed) {
serverDao.addKnownAddress(host.getId(), iface.getIpv4Address());
}
} else {
log.warn("probe could not be done for server '{}' as no alternate UP server found", host.getHostName());
}
}
}
}
Aggregations