-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Broadcast URI not set to vxlan, but vlan (Fix #3040) #4190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2279,7 +2279,7 @@ public Network createGuestNetwork(final long networkOfferingId, final String nam | |
| } | ||
|
|
||
| if (vlanSpecified) { | ||
| URI uri = BroadcastDomainType.fromString(vlanId); | ||
| URI uri = encodeVlanIdIntoBroadcastUri(vlanId, pNtwk); | ||
| //don't allow to specify vlan tag used by physical network for dynamic vlan allocation | ||
| if (!(bypassVlanOverlapCheck && ntwkOff.getGuestType() == GuestType.Shared) && _dcDao.findVnet(zoneId, pNtwk.getId(), BroadcastDomainType.getValue(uri)).size() > 0) { | ||
| throw new InvalidParameterValueException("The VLAN tag " + vlanId + " is already being used for dynamic vlan allocation for the guest network in zone " | ||
|
|
@@ -2424,7 +2424,7 @@ public Network doInTransaction(final TransactionStatus status) { | |
| //Logical router's UUID provided as VLAN_ID | ||
| userNetwork.setVlanIdAsUUID(vlanIdFinal); //Set transient field | ||
| } else { | ||
| uri = BroadcastDomainType.fromString(vlanIdFinal); | ||
| uri = encodeVlanIdIntoBroadcastUri(vlanIdFinal, pNtwk); | ||
| } | ||
| userNetwork.setBroadcastUri(uri); | ||
| if (!vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) { | ||
|
|
@@ -2475,6 +2475,25 @@ public Network doInTransaction(final TransactionStatus status) { | |
| return network; | ||
| } | ||
|
|
||
| /** | ||
| * Encodes VLAN/VXLAN ID into a Broadcast URI according to the isolation method from the Physical Network. | ||
| * @return Broadcast URI, e.g. 'vlan://vlan_ID' or 'vxlan://vlxan_ID' | ||
| */ | ||
| protected URI encodeVlanIdIntoBroadcastUri(String vlanId, PhysicalNetwork pNtwk) { | ||
| if (pNtwk == null) { | ||
| throw new InvalidParameterValueException(String.format("Failed to encode VLAN/VXLAN %s into a Broadcast URI. Physical Network cannot be null.", vlanId)); | ||
| } | ||
|
|
||
| if(StringUtils.isNotBlank(pNtwk.getIsolationMethods().get(0))) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @GabrielBrascher Should we check if
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rhtyd thanks for the review :-) Answering your question: I did not add null verification on the respective parameter due to the fact that both methods that call this one already validate the private network
However, considering that this method could be reused, I have no problem in adding null validations.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, NetworkOrchestrator.java#L2397 is not exactly a null validation. I will add a null verification @rhtyd.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @GabrielBrascher please add the null validation, thnx |
||
| String isolationMethod = pNtwk.getIsolationMethods().get(0).toLowerCase(); | ||
| String vxlan = BroadcastDomainType.Vxlan.toString().toLowerCase(); | ||
| if(isolationMethod.equals(vxlan)) { | ||
| return BroadcastDomainType.encodeStringIntoBroadcastUri(vlanId, BroadcastDomainType.Vxlan); | ||
| } | ||
| } | ||
| return BroadcastDomainType.fromString(vlanId); | ||
| } | ||
|
|
||
| /** | ||
| * Checks bypass VLAN id/range overlap check during network creation for guest networks | ||
| * @param bypassVlanOverlapCheck bypass VLAN id/range overlap check | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got wondering if there could be more than one isolation method on a network. Considering that this is a List of isolation methods. I assume that to get into a VLAN conditional (the ones that this method is called) there will be only one isolation method, either VLAN or VXLAN.