Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,9 @@ private void setupPersistentNetwork(NetworkVO network, NetworkOfferingVO offerin
}

private boolean networkMeetsPersistenceCriteria(NetworkVO network, NetworkOfferingVO offering, boolean cleanup) {
BroadcastDomainType broadcastDomainType = network.getBroadcastUri() != null ? BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BroadcastDomainType broadcastDomainType = network.getBroadcastUri() != null ? BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) : null;
BroadcastDomainType broadcastDomainType = BroadcastDomainType.getSchemeValue(network.getBroadcastUri());

nullcheck is part of the getSchemeValue() contract

boolean criteriaMet = offering.isPersistent() &&
(network.getBroadcastUri() != null && BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) == BroadcastDomainType.Vlan);
(broadcastDomainType == BroadcastDomainType.Vlan || broadcastDomainType == BroadcastDomainType.Vxlan);
Comment on lines 1607 to +1608

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice for readability to use a list of values:

Suggested change
boolean criteriaMet = offering.isPersistent() &&
(network.getBroadcastUri() != null && BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) == BroadcastDomainType.Vlan);
(broadcastDomainType == BroadcastDomainType.Vlan || broadcastDomainType == BroadcastDomainType.Vxlan);
List<BroadcastDomainType> broadcastTypes = Arrays.asList(BroadcastDomainType.Vlan, BroadcastDomainType.Vxlan)
boolean criteriaMet = offering.isPersistent() && broadcastTypes.contains(broadcastDomainType);

if (!cleanup) {
return criteriaMet && network.getGuestType() == GuestType.L2;
} else {
Expand Down