Skip to content

Commit ea893ea

Browse files
SakshamsSateesh Chodapuneedi
authored andcommitted
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 <sateesh@apache.org>
1 parent 21ce3be commit ea893ea

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎server/src/com/cloud/network/NetworkServiceImpl.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,11 +1868,13 @@ public Network updateGuestNetwork(long networkId, String name, String displayTex
18681868

18691869
// If networkCidr is null it implies that there was no prior IP reservation, so the network cidr is network.getCidr()
18701870
// But in case networkCidr is a non null value (IP reservation already exists), it implies network cidr is networkCidr
1871-
if (networkCidr != null && ! NetUtils.isNetworkAWithinNetworkB(guestVmCidr, networkCidr)) {
1871+
if (networkCidr != null) {
1872+
if(! NetUtils.isNetworkAWithinNetworkB(guestVmCidr, networkCidr)) {
18721873
throw new InvalidParameterValueException ("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " + networkCidr);
1874+
}
18731875
} else {
18741876
if (! NetUtils.isNetworkAWithinNetworkB(guestVmCidr, network.getCidr())) {
1875-
throw new InvalidParameterValueException ("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " + network.getCidr());
1877+
throw new InvalidParameterValueException ("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " + network.getCidr());
18761878
}
18771879
}
18781880

0 commit comments

Comments
 (0)