Search in sources :

Example 6 with MacPool

use of org.ovirt.engine.core.bll.network.macpool.MacPool in project ovirt-engine by oVirt.

the class ObjectCompensation method handleReleaseMacsCompensation.

private void handleReleaseMacsCompensation(ReleaseMacsTransientCompensation releaseMacs) {
    MacPool macPool = macPoolPerCluster.getMacPoolById(releaseMacs.getMacPoolId());
    macPool.freeMacs(releaseMacs.getMacs());
}
Also used : MacPool(org.ovirt.engine.core.bll.network.macpool.MacPool)

Example 7 with MacPool

use of org.ovirt.engine.core.bll.network.macpool.MacPool in project ovirt-engine by oVirt.

the class UpdateVmInterfaceCommand method macPoolCleanupAfterExecution.

void macPoolCleanupAfterExecution(boolean macAddedToPool) {
    if (!macShouldBeChanged) {
        return;
    }
    MacPool macPool = getMacPool();
    if (getSucceeded()) {
        // command succeeded, actions are not going to be reverted.
        String macToRelease = oldIface.getMacAddress();
        boolean canReleaseMac = new MacIsNotReservedInSnapshotAndCanBeReleased().macCanBeReleased(macToRelease, getVm(), countMacUsageDifference);
        if (canReleaseMac) {
            macPool.freeMac(macToRelease);
        }
    } else {
        // since this command ins't transactive
        if (macAddedToPool) {
            // new mac was added to MAC pool.
            macPool.freeMac(getMacAddress());
        }
    }
}
Also used : MacPool(org.ovirt.engine.core.bll.network.macpool.MacPool)

Aggregations

MacPool (org.ovirt.engine.core.bll.network.macpool.MacPool)7 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)2 VmNic (org.ovirt.engine.core.common.businessentities.network.VmNic)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 ReadMacPool (org.ovirt.engine.core.bll.network.macpool.ReadMacPool)1 VnicWithBadMacPredicate (org.ovirt.engine.core.bll.network.predicate.VnicWithBadMacPredicate)1 VnicProfileHelper (org.ovirt.engine.core.bll.network.vm.VnicProfileHelper)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 Guid (org.ovirt.engine.core.compat.Guid)1