Adding fixes for the add user data and vpn rules
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/60eea3bb Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/60eea3bb Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/60eea3bb Branch: refs/heads/master Commit: 60eea3bb1a7f6e345452936b270ca3755d87b7a9 Parents: f2f4732 Author: Wilder Rodrigues <wrodrig...@schubergphilis.com> Authored: Mon Sep 8 17:30:01 2014 +0200 Committer: wilderrodrigues <wrodrig...@schubergphilis.com> Committed: Tue Oct 14 15:08:11 2014 +0200 ---------------------------------------------------------------------- .../cloud/network/element/VpcVirtualRouterElement.java | 4 ++-- .../src/com/cloud/network/router/CommandSetupHelper.java | 11 ++++++++++- .../network/rules/VirtualNetworkApplianceFactory.java | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60eea3bb/server/src/com/cloud/network/element/VpcVirtualRouterElement.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java index b6b5ccf..4a29fd1 100644 --- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java +++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java @@ -576,8 +576,8 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc return null; } - Network network = _networkDao.findById(vpn.getNetworkId()); - DataCenterVO dcVO = _dcDao.findById(network.getDataCenterId()); + Vpc vpc = _entityMgr.findById(Vpc.class, vpn.getVpcId()); + DataCenterVO dcVO = _dcDao.findById(vpc.getZoneId()); NetworkTopology networkTopology = networkTopologyContext.retrieveNetworkTopology(dcVO); return networkTopology.applyVpnUsers(vpn, users, routers.get(0)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60eea3bb/server/src/com/cloud/network/router/CommandSetupHelper.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/CommandSetupHelper.java b/server/src/com/cloud/network/router/CommandSetupHelper.java index 92a3bb1..df5ad48 100644 --- a/server/src/com/cloud/network/router/CommandSetupHelper.java +++ b/server/src/com/cloud/network/router/CommandSetupHelper.java @@ -657,8 +657,17 @@ public class CommandSetupHelper { final IpAddress ip = _networkModel.getIp(vpn.getServerAddressId()); + // This block is needed due to the line 206 of the + // RemoteAccessVpnManagenerImpl: + // TODO: assumes one virtual network / domr per account per zone + final String cidr; final Network network = _networkDao.findById(vpn.getNetworkId()); - final String cidr = network.getCidr(); + if (network == null) { + Vpc vpc = _vpcDao.findById(vpn.getVpcId()); + cidr = vpc.getCidr(); + } else { + cidr = network.getCidr(); + } final RemoteAccessVpnCfgCommand startVpnCmd = new RemoteAccessVpnCfgCommand(isCreate, ip.getAddress().addr(), vpn.getLocalIp(), vpn.getIpRange(), vpn.getIpsecPresharedKey(), vpn.getVpcId() != null); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/60eea3bb/server/src/com/cloud/network/rules/VirtualNetworkApplianceFactory.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/rules/VirtualNetworkApplianceFactory.java b/server/src/com/cloud/network/rules/VirtualNetworkApplianceFactory.java index a1944e0..5a551f0 100644 --- a/server/src/com/cloud/network/rules/VirtualNetworkApplianceFactory.java +++ b/server/src/com/cloud/network/rules/VirtualNetworkApplianceFactory.java @@ -273,6 +273,7 @@ public class VirtualNetworkApplianceFactory { AdvancedVpnRules vpnRules = new AdvancedVpnRules(remoteAccessVpn, users); initBeans(vpnRules); + vpnRules._vpcDao = _vpcDao; return vpnRules; }