You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "GaOrtiga (via GitHub)" <gi...@apache.org> on 2023/05/02 21:21:16 UTC

[GitHub] [cloudstack] GaOrtiga commented on a diff in pull request #7153: Introducing concept of domain VPCs

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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org