VPC: as there is no support for FirewallRules/remoteAccessVPN in the VPC, removed the networkId from the list of parameters for corresponding api calls
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c8ec262d Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c8ec262d Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c8ec262d Branch: refs/heads/vpc Commit: c8ec262deac84e626936382476e60ae81e80e980 Parents: 5ecdad7 Author: Alena Prokharchyk <[email protected]> Authored: Wed Jun 27 11:48:17 2012 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Thu Jun 28 10:17:53 2012 -0700 ---------------------------------------------------------------------- .../cloud/api/commands/CreateFirewallRuleCmd.java | 8 +------- .../api/commands/CreateLoadBalancerRuleCmd.java | 3 ++- .../api/commands/CreatePortForwardingRuleCmd.java | 3 ++- .../api/commands/CreateRemoteAccessVpnCmd.java | 8 +------- .../com/cloud/api/commands/EnableStaticNatCmd.java | 3 ++- .../network/vpn/RemoteAccessVpnManagerImpl.java | 12 ------------ 6 files changed, 8 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c8ec262d/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java b/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java index 77caf19..5ab908b 100644 --- a/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreateFirewallRuleCmd.java @@ -76,11 +76,6 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user") private String type; - @IdentityMapper(entityTableName="networks") - @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, - description="The network of the vm the Firewall rule will be created for") - private Long networkId; - // /////////////////////////////////////////////////// // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// @@ -201,9 +196,8 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal if (ip.getAssociatedWithNetworkId() != null) { ntwkId = ip.getAssociatedWithNetworkId(); - } else { - ntwkId = networkId; } + if (ntwkId == null) { throw new InvalidParameterValueException("Unable to create firewall rule for the ipAddress id=" + ipAddressId + " as ip is not associated with any network and no networkId is passed in"); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c8ec262d/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java b/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java index 8ad84d7..6c1e3b7 100644 --- a/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreateLoadBalancerRuleCmd.java @@ -91,7 +91,8 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements private List<String> cidrlist; @IdentityMapper(entityTableName="networks") - @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="The guest network this rule will be created for") + @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="The guest network this " + + "rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)") private Long networkId; ///////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c8ec262d/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java index 20132a6..4ced43d 100644 --- a/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java +++ b/api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java @@ -83,7 +83,8 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, - description="The network of the vm the Port Forwarding rule will be created for") + description="The network of the vm the Port Forwarding rule will be created for. " + + "Required when public Ip address is not associated with any Guest network yet (VPC case)") private Long networkId; // /////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c8ec262d/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java b/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java index 77f49b0..6787d1f 100644 --- a/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java +++ b/api/src/com/cloud/api/commands/CreateRemoteAccessVpnCmd.java @@ -62,11 +62,6 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.OPEN_FIREWALL, type = CommandType.BOOLEAN, description = "if true, firewall rule for source/end pubic port is automatically created; if false - firewall rule has to be created explicitely. Has value true by default") private Boolean openFirewall; - @IdentityMapper(entityTableName="networks") - @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, - description="The network of the ip the VPN be created for") - private Long networkId; - ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -140,9 +135,8 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { if (ip.getAssociatedWithNetworkId() != null) { ntwkId = ip.getAssociatedWithNetworkId(); - } else { - ntwkId = networkId; } + if (ntwkId == null) { throw new InvalidParameterValueException("Unable to create remote access vpn for the ipAddress id=" + getPublicIpId() + " as ip is not associated with any network and no networkId is passed in"); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c8ec262d/api/src/com/cloud/api/commands/EnableStaticNatCmd.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/api/commands/EnableStaticNatCmd.java b/api/src/com/cloud/api/commands/EnableStaticNatCmd.java index fdd0ee5..9e21b83 100644 --- a/api/src/com/cloud/api/commands/EnableStaticNatCmd.java +++ b/api/src/com/cloud/api/commands/EnableStaticNatCmd.java @@ -54,7 +54,8 @@ public class EnableStaticNatCmd extends BaseCmd{ @IdentityMapper(entityTableName="networks") @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, - description="The network of the vm the static nat will be enabled for.") + description="The network of the vm the static nat will be enabled for." + + " Required when public Ip address is not associated with any Guest network yet (VPC case)") private Long networkId; ///////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c8ec262d/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java index 39dbea9..9290044 100755 --- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java @@ -120,18 +120,6 @@ public class RemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manag } IPAddressVO ipAddress = _ipAddressDao.findById(publicIpId); - - //associate ip address to network (if needed) - if (ipAddress.getAssociatedWithNetworkId() == null) { - s_logger.debug("The ip is not associated with the network id="+ networkId + " so assigning"); - try { - ipAddress = _networkMgr.associateIPToGuestNetwork(publicIpId, networkId); - } catch (Exception ex) { - s_logger.warn("Failed to associate ip id=" + publicIpId + " to network id=" + networkId + " as " + - "a part of remote access vpn creation"); - return null; - } - } _networkMgr.checkIpForService(ipAddress, Service.Vpn); RemoteAccessVpnVO vpnVO = _remoteAccessVpnDao.findByPublicIpAddress(publicIpId);
