weizhouapache commented on code in PR #10837:
URL: https://github.com/apache/cloudstack/pull/10837#discussion_r2081528998
##########
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java:
##########
@@ -4407,14 +4407,35 @@ public Vlan createVlanAndPublicIpRange(final
CreateVlanIpRangeCmd cmd) throws In
String endIP = cmd.getEndIp();
final String newVlanGateway = cmd.getGateway();
final String newVlanNetmask = cmd.getNetmask();
+ Long networkId = cmd.getNetworkID();
+ Long physicalNetworkId = cmd.getPhysicalNetworkId();
+
+ // Verify that network exists
+ Network network = null;
+ if (networkId != null) {
+ network = _networkDao.findById(networkId);
+ if (network == null) {
+ throw new InvalidParameterValueException("Unable to find
network by id " + networkId);
+ } else {
+ zoneId = network.getDataCenterId();
+ physicalNetworkId = network.getPhysicalNetworkId();
+ }
+ }
+
String vlanId = cmd.getVlan();
+ if (StringUtils.isBlank(vlanId)) {
+ vlanId = Vlan.UNTAGGED;
+ if (network != null & network.getTrafficType() ==
TrafficType.Guest) {
+ boolean connectivityWithoutVlan =
isConnectivityWithoutVlan(network);
+ vlanId = getNetworkVlanId(network, connectivityWithoutVlan);
+ }
+ }
+
// TODO decide if we should be forgiving or demand a valid and
complete URI
if (!(vlanId == null || "".equals(vlanId) ||
vlanId.startsWith(BroadcastDomainType.Vlan.scheme()))) {
vlanId = BroadcastDomainType.Vlan.toUri(vlanId).toString();
}
final Boolean forVirtualNetwork = cmd.isForVirtualNetwork();
Review Comment:
does this need to be cleaned up ?
--
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]