Search in sources :

Example 1 with ShutDownVspCommand

use of com.cloud.agent.api.element.ShutDownVspCommand in project cloudstack by apache.

the class NuageVspElement method shutdown.

@Override
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
    if (!canHandle(network, Service.Connectivity)) {
        return false;
    }
    if (cleanup && isDnsSupportedByVR(network)) {
        // The network is restarted, possibly the domain name is changed, update the dhcpOptions as soon as possible
        NetworkOfferingVO networkOfferingVO = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
        VspDhcpDomainOption vspDhcpOptions = _nuageVspEntityBuilder.buildNetworkDhcpOption(network, networkOfferingVO);
        VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
        HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
        ShutDownVspCommand cmd = new ShutDownVspCommand(vspNetwork, vspDhcpOptions);
        Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
        if (answer == null || !answer.getResult()) {
            s_logger.error("ShutDownVspCommand for network " + network.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
            if ((null != answer) && (null != answer.getDetails())) {
                throw new ResourceUnavailableException(answer.getDetails(), Network.class, network.getId());
            }
        }
    }
    return true;
}
Also used : Answer(com.cloud.agent.api.Answer) VspDhcpDomainOption(net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) NetworkOfferingVO(com.cloud.offerings.NetworkOfferingVO) VspNetwork(net.nuage.vsp.acs.client.api.model.VspNetwork) ShutDownVspCommand(com.cloud.agent.api.element.ShutDownVspCommand) HostVO(com.cloud.host.HostVO)

Aggregations

Answer (com.cloud.agent.api.Answer)1 ShutDownVspCommand (com.cloud.agent.api.element.ShutDownVspCommand)1 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)1 HostVO (com.cloud.host.HostVO)1 NetworkOfferingVO (com.cloud.offerings.NetworkOfferingVO)1 VspDhcpDomainOption (net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption)1 VspNetwork (net.nuage.vsp.acs.client.api.model.VspNetwork)1