fix: Apply IPAM IP address to VM cloud-init configuration

- Fix field names in frontend: ipam_ip -> ip_address, ipam_gateway -> gateway
- Pass ipam_network_id to deploy API for proper network mask lookup
- Extract network mask from IPAM network CIDR (e.g., /24 from 10.10.10.0/24)
- Auto-fetch gateway from IPAM network if not provided
- Add detailed logging for VM IP configuration
- Remove hardcoded /24 mask, use actual network mask from IPAM

This fixes the issue where VMs were getting DHCP instead of the
static IP allocated from IPAM.
This commit is contained in:
2025-12-15 20:30:17 +05:00
parent 379afd0353
commit cf456faa16
2 changed files with 35 additions and 7 deletions

View File

@@ -2614,9 +2614,9 @@ async function executeCreateVM(event) {
start_after_create: document.getElementById('vmStartAfterCreate').checked,
onboot: document.getElementById('vmOnboot').checked,
enable_ha: document.getElementById('vmEnableHA').checked,
ipam_ip: allocatedIP,
ipam_gateway: allocatedGateway,
ipam_allocation_id: allocationId
ip_address: allocatedIP,
gateway: allocatedGateway,
ipam_network_id: ipamNetworkId ? parseInt(ipamNetworkId) : null
};
try {