Updated Branches:
refs/heads/master 21ce3befc -> ea893eaf3
CLOUDSTACK-1786: While reserving IPs in guest network, if guestvmcidr is a subset of network cidr but not a subset of cidr, exception is thrown.
Signed-off-by: Sateesh Chodapuneedi <sa...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ea893eaf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ea893eaf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ea893eaf
Branch: refs/heads/master
Commit: ea893eaf338bfe914e1cb99517a8429128a64152
Parents: 21ce3be
Author: Saksham Srivastava <sa...@citrix.com>
Authored: Fri Mar 22 16:37:44 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Fri Apr 19 14:08:37 2013 +0530
----------------------------------------------------------------------
.../src/com/cloud/network/NetworkServiceImpl.java | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ea893eaf/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index c4effc9..878d2a8 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -1868,11 +1868,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// If networkCidr is null it implies that there was no prior IP reservation, so the network cidr is network.getCidr()
// But in case networkCidr is a non null value (IP reservation already exists), it implies network cidr is networkCidr
- if (networkCidr != null && ! NetUtils.isNetworkAWithinNetworkB(guestVmCidr, networkCidr)) {
+ if (networkCidr != null) {
+ if(! NetUtils.isNetworkAWithinNetworkB(guestVmCidr, networkCidr)) {
throw new InvalidParameterValueException ("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " + networkCidr);
+ }
} else {
if (! NetUtils.isNetworkAWithinNetworkB(guestVmCidr, network.getCidr())) {
- throw new InvalidParameterValueException ("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " + network.getCidr());
+ throw new InvalidParameterValueException ("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " + network.getCidr());
}
}