GaOrtiga commented on code in PR #7153:
URL: https://github.com/apache/cloudstack/pull/7153#discussion_r1183062659
##########
server/src/main/java/com/cloud/network/IpAddressManagerImpl.java:
##########
@@ -1476,7 +1476,8 @@ public IPAddressVO associateIPToGuestNetwork(long ipId,
long networkId, boolean
// - if shared network in Advanced zone
// - and it belongs to the system
if (network.getAccountId() != owner.getId()) {
- if (zone.getNetworkType() != NetworkType.Basic &&
!(zone.getNetworkType() == NetworkType.Advanced && network.getGuestType() ==
Network.GuestType.Shared)) {
+ if (zone.getNetworkType() != NetworkType.Basic &&
+ !(zone.getNetworkType() == NetworkType.Advanced &&
network.getGuestType() == Network.GuestType.Shared ||
network.getVpcId().equals(ipToAssoc.getVpcId()))) {
Review Comment:
Theres a subtle "!" in the beginning of the expression
`(zone.getNetworkType() == NetworkType.Advanced && network.getGuestType() ==
Network.GuestType.Shared || network.getVpcId().equals(ipToAssoc.getVpcId()))`
which makes it equivalent to the following expression
`(!zone.getNetworkType() == NetworkType.Advanced &&
!network.getVpcId().equals(ipToAssoc.getVpcId()) || !network.getGuestType() ==
Network.GuestType.Shared && !network.getVpcId().equals(ipToAssoc.getVpcId()))`
So we are actually checking if both VpcIds are different and throwing an
exception if that is the case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]