-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
ISSUE TYPE
- Bug Report
- Improvement Request
COMPONENT NAME
API
CLOUDSTACK VERSION
Since long long time ago ... (10 years)
CONFIGURATION
- Zone Network type: Advanced network with Security Groups enabled
- Network isolation: VXLAN
- Virtualization: KVM
SUMMARY
The API command listPublicIpAddresses does not list IP addresses for any network with Advanced Networking + Security Groups + VLAN / VXLAN.
Command example: list publicipaddresses networkid=a7f6b609-211f-4157-a016-62c5563f8085 listall=True
The API command lists IP addresses with a select such as:
SELECT user_ip_address.id, user_ip_address.account_id, user_ip_address.domain_id, user_ip_address.public_ip_address, user_ip_address.data_center_id, user_ip_address.source_nat, user_ip_address.allocated, user_ip_address.vlan_db_id, user_ip_address.one_to_one_nat, user_ip_address.vm_id, user_ip_address.state, user_ip_address.mac_address, user_ip_address.source_network_id, user_ip_address.network_id, user_ip_address.uuid, user_ip_address.physical_network_id, user_ip_address.is_system, user_ip_address.vpc_id, user_ip_address.dnat_vmip, user_ip_address.is_portable, user_ip_address.display, user_ip_address.rule_state, user_ip_address.forsystemvms, user_ip_address.removed, user_ip_address.created
FROM user_ip_address
INNER JOIN vlan ON user_ip_address.vlan_db_id=vlan.id
INNER JOIN account ON user_ip_address.account_id=account.id
WHERE user_ip_address.source_network_id = 216 AND user_ip_address.display=1 AND user_ip_address.forsystemvms=0 AND user_ip_address.allocated IS NOT NULL AND user_ip_address.removed IS NULL AND (vlan.vlan_type = 'VirtualNetwork' AND vlan.removed IS NULL ) AND (account.type != 5 ) ORDER BY user_ip_address.public_ip_address DESC LIMIT 0, 500
The problem here is that the WHERE conditional vlan.vlan_type = 'VirtualNetwork' filters to VLANs of type 'VirtualNetwork'; however, all networks of Advanced Network + SG are deployed with VLAN of type 'DirectAttached' which leads to an empty result.
This is due to the following code at ManagementServerImpl.java:
VlanType vlanType = null;
if (forVirtualNetwork != null) {
vlanType = forVirtualNetwork ? VlanType.VirtualNetwork : VlanType.DirectAttached;
} else {
vlanType = VlanType.VirtualNetwork;
}
When adding the parameter forVirtualNetwork at the API Command then it lists all the allocated IPs as expected.
list publicipaddresses networkid=<network-uuid> listall=true forvirtualnetwork=true;
This also affects the UI (both legacy and primate):
DISCUSSION
Considering the context presented here I see this as a bug, however, I would appreciate any feedback.
Is this a bug, or simply the desired behavior? If it is not a bug, we should then enhance the UI and API documentation.
I still don't see the "why" of such behavior in the case of VLAN on Advanced networking, as we hold networks with public IPs but none of them are listed on UI.
STEPS TO REPRODUCE
🐱 > list publicipaddresses networkid=<network-uuid> listall=true;
🐱 > list publicipaddresses networkid=<network-uuid> listall=true forvirtualnetwork=true;
count = 7
...
...
...
EXPECTED RESULTS
🐱 > list publicipaddresses networkid=<network-uuid> listall=true;
count = 7
...
...
...

