slavkap opened a new issue #4450:
URL: https://github.com/apache/cloudstack/issues/4450
<!--
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release and master branch are affected too.
Always add information AFTER of these HTML comments, but no need to delete
the comments.
-->
##### ISSUE TYPE
<!-- Pick one below and delete the rest -->
* Bug Report
##### COMPONENT NAME
~~~
network
~~~
##### CLOUDSTACK VERSION
~~~
branch 4.13 and master
~~~
##### CONFIGURATION
<!--
basic network configuration
-->
##### OS / ENVIRONMENT
<!--
-->
~~~
CentOS7
~~~
##### SUMMARY
<!-- Explain the problem/feature briefly -->
Using the basic installation wizard it's not possible to create a guest
network, because the "isolationmethods" are not provided, and an exception is
thrown:
`java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at
java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at
java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at
java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:459)
at
org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.encodeVlanIdIntoBroadcastUri(NetworkOrchestrator.java:2674)
at
org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.createGuestNetwork(NetworkOrchestrator.java:2447)
at
org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.createGuestNetwork(NetworkOrchestrator.java:2327)
at
com.cloud.network.NetworkServiceImpl$4.doInTransaction(NetworkServiceImpl.java:1502)
at
com.cloud.network.NetworkServiceImpl$4.doInTransaction(NetworkServiceImpl.java:1450)
at com.cloud.utils.db.Transaction.execute(Transaction.java:40)
`
According to the API documentation for createPhysicalNetwork the
"isolationmethods" parameter is not mandatory, and the list of IsolationMethod
in my case is emtpy.
```
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))) {
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);
}
```
With remote debug I have set one blank element in the list, and the
installation was successful.
----------------------------------------------------------------
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]