nvazquez commented on a change in pull request #3732: [Vmware] Enable PVLAN
support on L2 networks
URL: https://github.com/apache/cloudstack/pull/3732#discussion_r358233838
##########
File path: server/src/main/java/com/cloud/network/NetworkServiceImpl.java
##########
@@ -1348,11 +1363,54 @@ public Network createGuestNetwork(CreateNetworkCmd
cmd) throws InsufficientCapac
return network;
}
+ /**
+ * Retrieve information (if set) for private VLAN when creating the network
+ */
+ protected Pair<String, PVlanType> getPrivateVlanPair(String pvlanId,
String pvlanTypeStr, String vlanId) {
+ String secondaryVlanId = pvlanId;
+ PVlanType type = null;
+
+ if (isNotBlank(secondaryVlanId) && (secondaryVlanId.startsWith("i") ||
secondaryVlanId.startsWith("c") || secondaryVlanId.startsWith("p"))) {
+ String[] parts = secondaryVlanId.split("-");
+ if (parts.length < 2) {
+ throw new CloudRuntimeException("Could not properly parse the
secondary VLAN ID to format TYPE-SVLANID: " + secondaryVlanId);
+ }
+ secondaryVlanId = parts[1];
+ type = PVlanType.fromValue(parts[0]);
Review comment:
Not actually IndexOutOfRange as the check is to ensure >= 2, so in worst
case at least the == 2 case is covered. Adding numerical check
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services