apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.13k stars 1.11k forks source link

Unable to create network with long broadcastUri in vSwitch #9507

Open borisstoyanov opened 3 months ago

borisstoyanov commented 3 months ago
ISSUE TYPE
COMPONENT NAME
VMware integration
CLOUDSTACK VERSION
4.19 and before 
SUMMARY

When the broadcastUri is too long, it is being refused at vCenter for violating max length of 80 chars. A specified parameter was not correct: spec.name The name value : cloud.guest.3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020.3000.1-dvS-ext in spec.name is too long. Maximum length cannot exceed 80 characters. It's possible to workaround this on dvSwitch with the following syntax vlan://3001-3020, but not on normal vSwitch.

STEPS TO REPRODUCE
Create a shared network with long broadcastUri
Deploy a VM in the network 
EXPECTED RESULTS
Network implemented at vCenter
ACTUAL RESULTS
Error for max length exceeded. 
JoaoJandre commented 3 months ago

@borisstoyanov did you mean 4.19 and after?

sureshanaparti commented 3 months ago

It seems, for vSwitch and dvSwitch port groups in VMware, only VLAN ID between 0 and 4095 is accepted, not the range or multiple comma-separated VLANs. For dvSwitch port groups, VLAN range is accepted through VLAN trunking.

VLANs range check in vSwitch port group:

VMware-vSwitch-VLANs-range

VLANs comma-separated check in vSwitch port group:

VMware-vSwitch-VLANs-comma-separated

VLANs range check in dvSwitch port group:

VMware-dvSwitch-VLANs-range
sureshanaparti commented 3 months ago

VLANs range check using trunking in dvSwitch port group:

VMware-dvSwitch-VLAN-trunking-range VMware-dvSwitch-VLAN-trunking-comma-separated-2

VLANs comma-separated check using trunking in dvSwitch port group:

VMware-dvSwitch-VLAN-trunking-comma-separated
sureshanaparti commented 3 months ago

CloudStack supports dvSwitch with VLAN trunking, it is recommended to specify the vlan range wherever possible along with the vlan:// scheme prefix.

https://github.com/apache/cloudstack/blob/c9f1c5790d131b744fb16cc417c7f9540d7c604d/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java#L1168-L1175

In case, multiple individual/seperate VLANs, there are chances that the port group name exceeds 80 chars limit as the vlans are part of port group name, this may be improved using a custom attribute (say, cloud.vlan) for the port group, and use network uuid for naming.