You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/05/08 19:49:35 UTC
[71/90] [abbrv] git commit: updated
refs/heads/ui-cisco-asa1000v-support to c1e9e4d
CLOUDSTACK-2364: fixed private gateway creation in VPC - the vnet for the private gateway network is not stored in data_center_vnet table
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/732566e7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/732566e7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/732566e7
Branch: refs/heads/ui-cisco-asa1000v-support
Commit: 732566e70368ef771d2f29f951bfba3b8272f9c3
Parents: 43fdb14
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue May 7 13:02:29 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue May 7 13:07:47 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/network/NetworkManagerImpl.java | 39 ++++++++------
1 files changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/732566e7/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index a995661..4fffbc1 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2005,23 +2005,28 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (_networksDao.countByZoneAndUri(zoneId, uri) > 0) {
throw new InvalidParameterValueException("Network with vlan " + vlanId + " already exists in zone " + zoneId);
} else {
- DataCenterVnetVO dcVnet = _datacenterVnetDao.findVnet(zoneId, vlanId.toString()).get(0);
- // Fail network creation if specified vlan is dedicated to a different account
- if (dcVnet.getAccountGuestVlanMapId() != null) {
- Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId();
- AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId);
- if (map.getAccountId() != owner.getAccountId()) {
- throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account");
- }
- // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool
- } else {
- List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId());
- if (maps != null && !maps.isEmpty()) {
- int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId());
- int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId());
- if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) {
- throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" +
- " to the vlan range dedicated to the owner "+ owner.getAccountName());
+ List<DataCenterVnetVO> dcVnets = _datacenterVnetDao.findVnet(zoneId, vlanId.toString());
+ //for the network that is created as part of private gateway,
+ //the vnet is not coming from the data center vnet table, so the list can be empty
+ if (!dcVnets.isEmpty()) {
+ DataCenterVnetVO dcVnet = dcVnets.get(0);
+ // Fail network creation if specified vlan is dedicated to a different account
+ if (dcVnet.getAccountGuestVlanMapId() != null) {
+ Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId();
+ AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId);
+ if (map.getAccountId() != owner.getAccountId()) {
+ throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account");
+ }
+ // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool
+ } else {
+ List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId());
+ if (maps != null && !maps.isEmpty()) {
+ int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId());
+ int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId());
+ if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) {
+ throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" +
+ " to the vlan range dedicated to the owner "+ owner.getAccountName());
+ }
}
}
}