Search in sources :

Example 1 with L2GatewayServiceConfig

use of com.cloud.network.nicira.L2GatewayServiceConfig in project cloudstack by apache.

the class NiciraNvpGuestNetworkGuru method checkL2GatewayServiceSharedNetwork.

private void checkL2GatewayServiceSharedNetwork(HostVO niciraNvpHost) throws Exception {
    String l2GatewayServiceUuid = niciraNvpHost.getDetail("l2gatewayserviceuuid");
    if (l2GatewayServiceUuid == null) {
        throw new Exception("No L2 Gateway Service found");
    } else {
        final FindL2GatewayServiceCommand cmdL2GWService = new FindL2GatewayServiceCommand(new L2GatewayServiceConfig(l2GatewayServiceUuid));
        final FindL2GatewayServiceAnswer answerL2GWService = (FindL2GatewayServiceAnswer) agentMgr.easySend(niciraNvpHost.getId(), cmdL2GWService);
        if (answerL2GWService == null || !answerL2GWService.getResult()) {
            throw new Exception("No L2 Gateway Service found with uuid " + l2GatewayServiceUuid);
        } else {
            String uuidFound = answerL2GWService.getGatewayServiceUuid();
            if (!uuidFound.equals(l2GatewayServiceUuid)) {
                throw new Exception("Found L2 Gateway Service " + uuidFound + " instead of " + l2GatewayServiceUuid);
            }
        }
    }
}
Also used : FindL2GatewayServiceAnswer(com.cloud.agent.api.FindL2GatewayServiceAnswer) FindL2GatewayServiceCommand(com.cloud.agent.api.FindL2GatewayServiceCommand) L2GatewayServiceConfig(com.cloud.network.nicira.L2GatewayServiceConfig) URISyntaxException(java.net.URISyntaxException) InsufficientAddressCapacityException(com.cloud.exception.InsufficientAddressCapacityException) InsufficientVirtualNetworkCapacityException(com.cloud.exception.InsufficientVirtualNetworkCapacityException)

Example 2 with L2GatewayServiceConfig

use of com.cloud.network.nicira.L2GatewayServiceConfig in project cloudstack by apache.

the class NiciraNvpFindL2GatewayServiceCommandWrapper method execute.

@Override
public Answer execute(FindL2GatewayServiceCommand command, NiciraNvpResource niciraNvpResource) {
    final GatewayServiceConfig config = command.getGatewayServiceConfig();
    final String uuid = config.getUuid();
    final String type = config.getType();
    final NiciraNvpApi niciraNvpApi = niciraNvpResource.getNiciraNvpApi();
    s_logger.info("Looking for L2 Gateway Service " + uuid + " of type " + type);
    try {
        List<L2GatewayServiceConfig> lstGW = niciraNvpApi.findL2GatewayServiceByUuidAndType(uuid, type);
        if (lstGW.size() == 0) {
            return new FindL2GatewayServiceAnswer(command, false, "L2 Gateway Service not found", null);
        } else {
            return new FindL2GatewayServiceAnswer(command, true, "L2 Gateway Service " + lstGW.get(0).getDisplayName() + " found", lstGW.get(0).getUuid());
        }
    } catch (NiciraNvpApiException e) {
        s_logger.error("Error finding Gateway Service due to: " + e.getMessage());
        final CommandRetryUtility retryUtility = niciraNvpResource.getRetryUtility();
        retryUtility.addRetry(command, NUM_RETRIES);
        return retryUtility.retry(command, FindL2GatewayServiceAnswer.class, e);
    }
}
Also used : FindL2GatewayServiceAnswer(com.cloud.agent.api.FindL2GatewayServiceAnswer) L2GatewayServiceConfig(com.cloud.network.nicira.L2GatewayServiceConfig) NiciraNvpApi(com.cloud.network.nicira.NiciraNvpApi) GatewayServiceConfig(com.cloud.network.nicira.GatewayServiceConfig) L2GatewayServiceConfig(com.cloud.network.nicira.L2GatewayServiceConfig) CommandRetryUtility(com.cloud.network.utils.CommandRetryUtility) NiciraNvpApiException(com.cloud.network.nicira.NiciraNvpApiException)

Aggregations

FindL2GatewayServiceAnswer (com.cloud.agent.api.FindL2GatewayServiceAnswer)2 L2GatewayServiceConfig (com.cloud.network.nicira.L2GatewayServiceConfig)2 FindL2GatewayServiceCommand (com.cloud.agent.api.FindL2GatewayServiceCommand)1 InsufficientAddressCapacityException (com.cloud.exception.InsufficientAddressCapacityException)1 InsufficientVirtualNetworkCapacityException (com.cloud.exception.InsufficientVirtualNetworkCapacityException)1 GatewayServiceConfig (com.cloud.network.nicira.GatewayServiceConfig)1 NiciraNvpApi (com.cloud.network.nicira.NiciraNvpApi)1 NiciraNvpApiException (com.cloud.network.nicira.NiciraNvpApiException)1 CommandRetryUtility (com.cloud.network.utils.CommandRetryUtility)1 URISyntaxException (java.net.URISyntaxException)1