]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Vnets.pm
ipams: add mac address
[pve-network.git] / PVE / Network / SDN / Vnets.pm
index 5616419c300573aa7ee91e94a4a03a05efa5f74b..d68ffab7d592ecbd01f242b58ae6492a9face104 100644 (file)
@@ -3,8 +3,10 @@ package PVE::Network::SDN::Vnets;
 use strict;
 use warnings;
 
-use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
 use Net::IP;
+
+use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
+use PVE::Network::SDN;
 use PVE::Network::SDN::Subnets;
 use PVE::Network::SDN::Zones;
 
@@ -78,7 +80,7 @@ sub get_subnets {
 }
 
 sub get_next_free_cidr {
-    my ($vnetid, $hostname, $description, $ipversion) = @_;
+    my ($vnetid, $hostname, $mac, $description, $ipversion) = @_;
 
     my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);
     my $zoneid = $vnet->{zone};
@@ -97,7 +99,7 @@ sub get_next_free_cidr {
        $subnetcount++;
        if ($zone->{ipam}) {
            eval {
-               $ip = PVE::Network::SDN::Subnets::next_free_ip($zone, $subnetid, $subnet, $hostname, $description);
+               $ip = PVE::Network::SDN::Subnets::next_free_ip($zone, $subnetid, $subnet, $hostname, $mac, $description);
            };
            warn $@ if $@;
        }
@@ -109,7 +111,7 @@ sub get_next_free_cidr {
 }
 
 sub add_cidr {
-    my ($vnetid, $cidr, $hostname, $description) = @_;
+    my ($vnetid, $cidr, $hostname, $mac, $description) = @_;
 
     my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid, 1);
     my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);
@@ -120,7 +122,7 @@ sub add_cidr {
     die "ip address is not in cidr format" if !$mask;
     my ($subnetid, $subnet) = PVE::Network::SDN::Subnets::find_ip_subnet($ip, $mask, $subnets);
 
-    PVE::Network::SDN::Subnets::add_ip($zone, $subnetid, $subnet, $ip, $hostname, $description);
+    PVE::Network::SDN::Subnets::add_ip($zone, $subnetid, $subnet, $ip, $hostname, $mac, $description);
 }
 
 sub del_cidr {