[pve-devel] [PATCH v4 pve-network 10/33] api: add endpoints for managing PVE IPAM

DERUMIER, Alexandre alexandre.derumier at groupe-cyllene.com
Mon Nov 20 13:28:33 CET 2023


Hi,

>>I'll look again into this, maybe POST / PUT / DELETE
>>`/ipams/pve/mapping` or `/ipams/pve/ip` would be a good alternative
>>here? We need to move away from MAC addresses as a unique identifier
>>anyway (since with dual-stack there can be multiple IP addresses for
>>the same MAC address) so I would need to adjust those endpoints
>>anyway to
>>work on IP/MAC pairings).

>>So the endpoints would then look like this:
>>
>>GET /ipams/pve
>>
>>POST /ipams/pve/ip
>>PUT /ipams/pve/ip
>>DELETE /ipams/pve/ip


You should use plugin name in path    ,for me it should work with any
ipam plugin


so, simply : "/ipams/ip"






Another thing, it's theses api are not really calling ipam method
directly.

for example:


"
__PACKAGE__->register_method ({
    name => 'dhcpcreate',
    path => '{vnet}/{mac}',
...
        my $vnet = extract_param($param, 'vnet');
        my $mac = extract_param($param, 'mac');
        my $ip = extract_param($param, 'ip');

        PVE::Network::SDN::Vnets::add_ip($vnet, $ip, '', $mac, undef);
"

and Vnets::add_ip is calling

      my ($zone, $subnetid, $subnet) =
PVE::Network::SDN::Vnets::get_subnet_from_vnet_ip($vnetid, $ip);
    PVE::Network::SDN::Subnets::add_ip($zone, $subnetid, $subnet, $ip,
$hostname, $mac, $vmid, undef, $skipdns);


and Subnets::add_ip is registering dns + register ip in ipam plugin






So, I think that theses should be subpath of subnets

/subnets/<subnetid/ips


>>
>>GET /subnets/<subnetid/ips
>>
>>POST /subnets/<subnetid>/ips/<ip>
>>PUT /subnets/<subnetid>/ips/<ip>
>>DELETE /subnets/<subnetid/ips/<ip>




More information about the pve-devel mailing list