Updated Branches: refs/heads/vpc 2fc1dc0df -> 3c90fc842
CS-15704: Fix wrong domain id setting of non-root domain Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/3c90fc84 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3c90fc84 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3c90fc84 Branch: refs/heads/vpc Commit: 3c90fc842f4d0aebae6374a377369b060ab75222 Parents: fd9ef34 Author: Sheng Yang <[email protected]> Authored: Fri Jul 27 16:27:20 2012 -0700 Committer: Sheng Yang <[email protected]> Committed: Fri Jul 27 16:28:06 2012 -0700 ---------------------------------------------------------------------- .../cloud/network/vpn/Site2SiteVpnManagerImpl.java | 21 ++------------ 1 files changed, 3 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3c90fc84/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java index 0647de5..48bb387 100644 --- a/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java @@ -117,18 +117,13 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager { if (gws != null) { throw new InvalidParameterValueException("The VPN gateway of VPC " + vpcId + " already existed!"); } - Long accountId = cmd.getEntityOwnerId(); - Long domainId = cmd.getDomainId(); - if (domainId == null) { - domainId = Domain.ROOT_DOMAIN; - } //Use source NAT ip for VPC List<IPAddressVO> ips = _ipAddressDao.listByAssociatedVpc(vpcId, true); if (ips.size() != 1) { throw new CloudRuntimeException("Cannot found source nat ip of vpc " + vpcId); } - Site2SiteVpnGatewayVO gw = new Site2SiteVpnGatewayVO(accountId, domainId, ips.get(0).getId(), vpcId); + Site2SiteVpnGatewayVO gw = new Site2SiteVpnGatewayVO(owner.getAccountId(), owner.getDomainId(), ips.get(0).getId(), vpcId); _vpnGatewayDao.persist(gw); return gw; } @@ -177,12 +172,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager { if (_customerGatewayDao.findByName(name) != null) { throw new InvalidParameterValueException("The customer gateway with name " + name + " already existed!"); } - Long accountId = cmd.getEntityOwnerId(); - Long domainId = cmd.getDomainId(); - if (domainId == null) { - domainId = Domain.ROOT_DOMAIN; - } - Site2SiteCustomerGatewayVO gw = new Site2SiteCustomerGatewayVO(name, accountId, domainId, gatewayIp, guestCidrList, ipsecPsk, + Site2SiteCustomerGatewayVO gw = new Site2SiteCustomerGatewayVO(name, owner.getAccountId(), owner.getDomainId(), gatewayIp, guestCidrList, ipsecPsk, ikePolicy, espPolicy, lifetime); _customerGatewayDao.persist(gw); return gw; @@ -215,12 +205,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager { throw new InvalidParameterValueException("The vpn connection with customer gateway id " + customerGatewayId + " or vpn gateway id " + vpnGatewayId + " already existed!"); } - Long accountId = cmd.getEntityOwnerId(); - Long domainId = cmd.getDomainId(); - if (domainId == null) { - domainId = Domain.ROOT_DOMAIN; - } - Site2SiteVpnConnectionVO conn = new Site2SiteVpnConnectionVO(accountId, domainId, vpnGatewayId, customerGatewayId); + Site2SiteVpnConnectionVO conn = new Site2SiteVpnConnectionVO(owner.getAccountId(), owner.getDomainId(), vpnGatewayId, customerGatewayId); conn.setState(State.Pending); _vpnConnectionDao.persist(conn); return conn;
