@@ -0,0 +1,2077 @@
+package org.ovirt.engine.core.bll.network.host;%0A%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.TimeoutException;%0A%0Aimport org.ovirt.engine.core.bll.Backend;%0Aimport org.ovirt.engine.core.common.config.Config;%0Aimport org.ovirt.engine.core.common.config.ConfigValues;%0Aimport org.ovirt.engine.core.common.interfaces.FutureVDSCall;%0Aimport org.ovirt.engine.core.common.vdscommands.FutureVDSCommandType;%0Aimport org.ovirt.engine.core.common.vdscommands.VDSReturnValue;%0Aimport org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase;%0Aimport org.ovirt.engine.core.compat.Guid;%0A%0A/**%0A * The %7B@code HostSetupNetworkPoller%7D class uses %7B@link FutureVDSCall%7D to poll the VDSM (with ping verb).%0A */%0Apublic class HostSetupNetworkPoller %7B%0A%0A    /** Time between polling attempts, to prevent flooding the host/network. */%0A    private static final long POLLING_BREAK = 500;%0A%0A    public boolean poll(Guid hostId) %7B%0A        long timeBeforePoll = System.currentTimeMillis();%0A        FutureVDSCall%3CVDSReturnValue%3E task =%0A                Backend.getInstance()%0A                        .getResourceManager()%0A                        .runFutureVdsCommand(FutureVDSCommandType.Poll, new VdsIdVDSCommandParametersBase(hostId));%0A        try %7B%0A            VDSReturnValue returnValue =%0A                    task.get(Config.%3CInteger%3E getValue(ConfigValues.SetupNetworksPollingTimeout), TimeUnit.SECONDS);%0A            if (returnValue.getSucceeded()) %7B%0A                return true;%0A            %7D%0A%0A            waitBeforeNextPoll(timeBeforePoll);%0A        %7D catch (TimeoutException e) %7B%0A            // ignore failure. network can go down due to VDSM changing the network. No need to suspend between polls is%0A            // timeout has reached.%0A        %7D%0A%0A        return false;%0A    %7D%0A%0A    public void waitBeforeNextPoll(long timeBeforePoll) %7B%0A        if (System.currentTimeMillis() - timeBeforePoll %3C POLLING_BREAK) %7B%0A            try %7B%0A                Thread.sleep(POLLING_BREAK);%0A            %7D catch (InterruptedException e) %7B%0A                // ignore.%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Add host poller for setup network actions