Search in sources :

Example 1 with DhcpSubNetRules

use of com.cloud.network.rules.DhcpSubNetRules in project cloudstack by apache.

the class BasicNetworkTopology method configDhcpForSubnet.

@Override
public boolean configDhcpForSubnet(final Network network, final NicProfile nic, final VirtualMachineProfile profile, final DeployDestination dest, final List<DomainRouterVO> routers) throws ResourceUnavailableException {
    s_logger.debug("CONFIG DHCP FOR SUBNETS RULES");
    // Assuming we have only one router per network For Now.
    final DomainRouterVO router = routers.get(0);
    if (router.getState() != State.Running) {
        s_logger.warn("Failed to configure dhcp: router not in running state");
        throw new ResourceUnavailableException("Unable to assign ip addresses, domR is not in right state " + router.getState(), DataCenter.class, network.getDataCenterId());
    }
    final DhcpSubNetRules subNetRules = new DhcpSubNetRules(network, nic, profile);
    return subNetRules.accept(_basicVisitor, router);
}
Also used : DhcpSubNetRules(com.cloud.network.rules.DhcpSubNetRules) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) DomainRouterVO(com.cloud.vm.DomainRouterVO)

Aggregations

ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)1 DhcpSubNetRules (com.cloud.network.rules.DhcpSubNetRules)1 DomainRouterVO (com.cloud.vm.DomainRouterVO)1