Search in sources :

Example 1 with ConfigureSharedNetworkVlanIdCommand

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

the class NiciraNvpElement method sharedNetworkSupportNumericalVlanId.

private boolean sharedNetworkSupportNumericalVlanId(Network network, String lSwitchUuid, String ownerName, HostVO niciraNvpHost) {
    List<VlanVO> networkVlans = vlanDao.listVlansByNetworkId(network.getId());
    if (networkVlans.size() == 1) {
        for (VlanVO vlanVO : networkVlans) {
            long vlanId = Long.parseLong(vlanVO.getVlanTag());
            String l2GatewayServiceUuid = niciraNvpHost.getDetail("l2gatewayserviceuuid");
            if (l2GatewayServiceUuid == null) {
                throw new CloudRuntimeException("No L2 Gateway Service Uuid found on " + niciraNvpHost.getName());
            }
            ConfigureSharedNetworkVlanIdCommand cmd = new ConfigureSharedNetworkVlanIdCommand(lSwitchUuid, l2GatewayServiceUuid, vlanId, ownerName, network.getId());
            ConfigureSharedNetworkVlanIdAnswer answer = (ConfigureSharedNetworkVlanIdAnswer) agentMgr.easySend(niciraNvpHost.getId(), cmd);
            if (answer.getResult() == false) {
                s_logger.error("Failed to configure Shared network " + network.getDisplayText());
                return false;
            }
        }
    }
    return true;
}
Also used : CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ConfigureSharedNetworkVlanIdCommand(com.cloud.agent.api.ConfigureSharedNetworkVlanIdCommand) VlanVO(com.cloud.dc.VlanVO) ConfigureSharedNetworkVlanIdAnswer(com.cloud.agent.api.ConfigureSharedNetworkVlanIdAnswer)

Aggregations

ConfigureSharedNetworkVlanIdAnswer (com.cloud.agent.api.ConfigureSharedNetworkVlanIdAnswer)1 ConfigureSharedNetworkVlanIdCommand (com.cloud.agent.api.ConfigureSharedNetworkVlanIdCommand)1 VlanVO (com.cloud.dc.VlanVO)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1