VPC: Don't allow to do ip assoc to the network in the VPC. The ip should be assigned to the VPC itself
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/83ed35f0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/83ed35f0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/83ed35f0 Branch: refs/heads/vpc Commit: 83ed35f06b2c9a114dd9e170d64c7375b0c3233b Parents: b770c8b Author: Alena Prokharchyk <[email protected]> Authored: Mon Jun 25 13:19:00 2012 -0700 Committer: Alena Prokharchyk <[email protected]> Committed: Mon Jun 25 20:58:00 2012 -0700 ---------------------------------------------------------------------- .../src/com/cloud/network/NetworkManagerImpl.java | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/83ed35f0/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 f0d873c..f9a5238 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -7066,6 +7066,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } if (networkId != null) { + Network network = _networksDao.findById(networkId); + if (network == null) { + throw new InvalidParameterValueException("Invalid network id is given"); + } + + if (network.getVpcId() != null) { + throw new InvalidParameterValueException("Specify vpcId to associate ip address to VPC"); + } return associateIPToGuestNetwork(ipId, networkId); }
