Search in sources :

Example 21 with VmNic

use of org.ovirt.engine.core.common.businessentities.network.VmNic in project ovirt-engine by oVirt.

the class SnapshotsManager method canSynchronizeNics.

public boolean canSynchronizeNics(VM snapshotedVm, VmInterfaceManager vmInterfaceManager, List<VmNetworkInterface> interfaces, boolean macsInSnapshotAreExpectedToBeAlreadyAllocated) {
    MacPool macPool = vmInterfaceManager.getMacPool();
    List<VmNic> dbNics = vmNicDao.getAllForVm(snapshotedVm.getId());
    return new SyncMacsOfDbNicsWithSnapshot(macPool, auditLogDirector, macsInSnapshotAreExpectedToBeAlreadyAllocated).canSyncNics(dbNics, interfaces);
}
Also used : MacPool(org.ovirt.engine.core.bll.network.macpool.MacPool) VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic)

Example 22 with VmNic

use of org.ovirt.engine.core.common.businessentities.network.VmNic in project ovirt-engine by oVirt.

the class VmInfoBuilderImpl method buildVmNetworkInterfaces.

@Override
public void buildVmNetworkInterfaces(Map<Guid, String> passthroughVnicToVfMap) {
    Map<VmDeviceId, VmDevice> devicesByDeviceId = Entities.businessEntitiesById(vmDeviceDao.getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.INTERFACE, VmDeviceType.BRIDGE));
    devicesByDeviceId.putAll(Entities.businessEntitiesById(vmDeviceDao.getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.INTERFACE, VmDeviceType.HOST_DEVICE)));
    for (VmNic vmInterface : vm.getInterfaces()) {
        // get vm device for this nic from DB
        VmDevice vmDevice = devicesByDeviceId.get(new VmDeviceId(vmInterface.getId(), vmInterface.getVmId()));
        if (vmDevice != null && vmDevice.isManaged() && vmDevice.isPlugged()) {
            Map<String, Object> struct = new HashMap<>();
            VmInterfaceType ifaceType = VmInterfaceType.rtl8139;
            if (vmInterface.getType() != null) {
                ifaceType = VmInterfaceType.forValue(vmInterface.getType());
            }
            if (vmInterface.isPassthrough()) {
                String vfDeviceName = passthroughVnicToVfMap.get(vmInterface.getId());
                vmInfoBuildUtils.addNetworkVirtualFunctionProperties(struct, vmInterface, vmDevice, vfDeviceName, vm);
            } else {
                addNetworkInterfaceProperties(struct, vmInterface, vmDevice, vmInfoBuildUtils.evaluateInterfaceType(ifaceType, vm.getHasAgent()));
            }
            devices.add(struct);
            bootableDevices.add(vmDevice);
        }
    }
}
Also used : VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) HashMap(java.util.HashMap) VmInterfaceType(org.ovirt.engine.core.common.businessentities.network.VmInterfaceType) VmDeviceId(org.ovirt.engine.core.common.businessentities.VmDeviceId) VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic)

Example 23 with VmNic

use of org.ovirt.engine.core.common.businessentities.network.VmNic in project ovirt-engine by oVirt.

the class ChangeVMClusterCommandTest method macAddressToVmNic.

private VmNic macAddressToVmNic(String macAddress) {
    VmNic result = new VmNic();
    result.setMacAddress(macAddress);
    return result;
}
Also used : VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic)

Example 24 with VmNic

use of org.ovirt.engine.core.common.businessentities.network.VmNic in project ovirt-engine by oVirt.

the class MacPoolPerClusterTest method createVmNic.

protected VmNic createVmNic() {
    final VmNic vmNic = new VmNic();
    vmNic.setMacAddress("00:1a:4a:15:c0:fe");
    return vmNic;
}
Also used : VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic)

Example 25 with VmNic

use of org.ovirt.engine.core.common.businessentities.network.VmNic in project ovirt-engine by oVirt.

the class VmInterfaceManagerTest method testAuditLogMacInUse.

@Test
public void testAuditLogMacInUse() {
    final VmNic iface = createNewInterface();
    vmInterfaceManager.auditLogMacInUse(iface);
    verifyCommonAuditLogFilledProperly(AuditLogType.MAC_ADDRESS_IS_IN_USE, iface);
}
Also used : VmNic(org.ovirt.engine.core.common.businessentities.network.VmNic) Test(org.junit.Test)

Aggregations

VmNic (org.ovirt.engine.core.common.businessentities.network.VmNic)47 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)8 VM (org.ovirt.engine.core.common.businessentities.VM)6 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)6 Network (org.ovirt.engine.core.common.businessentities.network.Network)5 Guid (org.ovirt.engine.core.compat.Guid)5 HashMap (java.util.HashMap)4 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)4 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)4 List (java.util.List)3 Map (java.util.Map)3 VmNicValidator (org.ovirt.engine.core.bll.validator.VmNicValidator)3 Version (org.ovirt.engine.core.compat.Version)3 Collectors (java.util.stream.Collectors)2 VmInterfaceManager (org.ovirt.engine.core.bll.network.VmInterfaceManager)2 MacPool (org.ovirt.engine.core.bll.network.macpool.MacPool)2 VnicProfileHelper (org.ovirt.engine.core.bll.network.vm.VnicProfileHelper)2 VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)2 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)2