Skip to content

Failed to create Guest Network during basic installation #4450

@slavkap

Description

@slavkap
ISSUE TYPE
  • Bug Report
COMPONENT NAME
network
CLOUDSTACK VERSION
branch 4.13 and master
CONFIGURATION
OS / ENVIRONMENT
CentOS7
SUMMARY

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions