* [pve-devel] [PATCH pve-network] vnet/subnet : add skipdns option
@ 2021-07-11 22:48 Alexandre Derumier
2021-07-13 4:41 ` Thomas Lamprecht
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Derumier @ 2021-07-11 22:48 UTC (permalink / raw)
To: pve-devel
allow to register ip to ipam without dns registration.
can be used for temp/pending ip for example
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
PVE/Network/SDN/Subnets.pm | 70 ++++++++++++++++++++++----------------
PVE/Network/SDN/Vnets.pm | 16 ++++-----
2 files changed, 49 insertions(+), 37 deletions(-)
diff --git a/PVE/Network/SDN/Subnets.pm b/PVE/Network/SDN/Subnets.pm
index 0231822..6bb42e5 100644
--- a/PVE/Network/SDN/Subnets.pm
+++ b/PVE/Network/SDN/Subnets.pm
@@ -184,7 +184,7 @@ sub del_subnet {
}
sub next_free_ip {
- my ($zone, $subnetid, $subnet, $hostname, $mac, $description) = @_;
+ my ($zone, $subnetid, $subnet, $hostname, $mac, $description, $skipdns) = @_;
my $cidr = undef;
my $ip = undef;
@@ -199,7 +199,7 @@ sub next_free_ip {
$hostname .= ".$dnszoneprefix" if $dnszoneprefix;
#verify dns zones before ipam
- verify_dns_zone($dnszone, $dns);
+ verify_dns_zone($dnszone, $dns) if !$skipdns;
if($ipamid) {
my $ipam_cfg = PVE::Network::SDN::Ipams::config();
@@ -215,10 +215,12 @@ sub next_free_ip {
eval {
my $reversednszone = get_reversedns_zone($subnetid, $subnet, $reversedns, $ip);
- #add dns
- add_dns_record($dnszone, $dns, $hostname, $ip);
- #add reverse dns
- add_dns_ptr_record($reversednszone, $dnszone, $reversedns, $hostname, $ip);
+ if(!$skipdns) {
+ #add dns
+ add_dns_record($dnszone, $dns, $hostname, $ip);
+ #add reverse dns
+ add_dns_ptr_record($reversednszone, $dnszone, $reversedns, $hostname, $ip);
+ }
};
if ($@) {
#rollback
@@ -232,7 +234,7 @@ sub next_free_ip {
}
sub add_ip {
- my ($zone, $subnetid, $subnet, $ip, $hostname, $mac, $description, $is_gateway) = @_;
+ my ($zone, $subnetid, $subnet, $ip, $hostname, $mac, $description, $is_gateway, $skipdns) = @_;
return if !$subnet || !$ip;
@@ -249,8 +251,10 @@ sub add_ip {
$hostname .= ".$dnszoneprefix" if $dnszoneprefix;
#verify dns zones before ipam
- verify_dns_zone($dnszone, $dns);
- verify_dns_zone($reversednszone, $reversedns);
+ if(!$skipdns) {
+ verify_dns_zone($dnszone, $dns);
+ verify_dns_zone($reversednszone, $reversedns);
+ }
if ($ipamid) {
@@ -265,10 +269,12 @@ sub add_ip {
}
eval {
- #add dns
- add_dns_record($dnszone, $dns, $hostname, $ip);
- #add reverse dns
- add_dns_ptr_record($reversednszone, $dnszone, $reversedns, $hostname, $ip);
+ if(!$skipdns) {
+ #add dns
+ add_dns_record($dnszone, $dns, $hostname, $ip);
+ #add reverse dns
+ add_dns_ptr_record($reversednszone, $dnszone, $reversedns, $hostname, $ip);
+ }
};
if ($@) {
#rollback
@@ -281,7 +287,7 @@ sub add_ip {
}
sub update_ip {
- my ($zone, $subnetid, $subnet, $ip, $hostname, $oldhostname, $mac, $description) = @_;
+ my ($zone, $subnetid, $subnet, $ip, $hostname, $oldhostname, $mac, $description, $skipdns) = @_;
return if !$subnet || !$ip;
@@ -298,8 +304,10 @@ sub update_ip {
$hostname .= ".$dnszoneprefix" if $dnszoneprefix;
#verify dns zones before ipam
- verify_dns_zone($dnszone, $dns);
- verify_dns_zone($reversednszone, $reversedns);
+ if(!$skipdns) {
+ verify_dns_zone($dnszone, $dns);
+ verify_dns_zone($reversednszone, $reversedns);
+ }
if ($ipamid) {
my $ipam_cfg = PVE::Network::SDN::Ipams::config();
@@ -314,18 +322,19 @@ sub update_ip {
return if $hostname eq $oldhostname;
eval {
- #add dns
-
- del_dns_record($dnszone, $dns, $oldhostname, $ip);
- add_dns_record($dnszone, $dns, $hostname, $ip);
- #add reverse dns
- del_dns_ptr_record($reversednszone, $reversedns, $ip);
- add_dns_ptr_record($reversednszone, $dnszone, $reversedns, $hostname, $ip);
+ if(!$skipdns) {
+ #add dns
+ del_dns_record($dnszone, $dns, $oldhostname, $ip);
+ add_dns_record($dnszone, $dns, $hostname, $ip);
+ #add reverse dns
+ del_dns_ptr_record($reversednszone, $reversedns, $ip);
+ add_dns_ptr_record($reversednszone, $dnszone, $reversedns, $hostname, $ip);
+ }
};
}
sub del_ip {
- my ($zone, $subnetid, $subnet, $ip, $hostname) = @_;
+ my ($zone, $subnetid, $subnet, $ip, $hostname, $skipdns) = @_;
return if !$subnet || !$ip;
@@ -340,9 +349,10 @@ sub del_ip {
my $dnszoneprefix = $subnet->{dnszoneprefix};
$hostname .= ".$dnszoneprefix" if $dnszoneprefix;
-
- verify_dns_zone($dnszone, $dns);
- verify_dns_zone($reversednszone, $reversedns);
+ if(!$skipdns) {
+ verify_dns_zone($dnszone, $dns);
+ verify_dns_zone($reversednszone, $reversedns);
+ }
if ($ipamid) {
my $ipam_cfg = PVE::Network::SDN::Ipams::config();
@@ -352,8 +362,10 @@ sub del_ip {
}
eval {
- del_dns_record($dnszone, $dns, $hostname, $ip);
- del_dns_ptr_record($reversednszone, $reversedns, $ip);
+ if(!$skipdns) {
+ del_dns_record($dnszone, $dns, $hostname, $ip);
+ del_dns_ptr_record($reversednszone, $reversedns, $ip);
+ }
};
if ($@) {
warn $@;
diff --git a/PVE/Network/SDN/Vnets.pm b/PVE/Network/SDN/Vnets.pm
index 86967a3..caa6bfc 100644
--- a/PVE/Network/SDN/Vnets.pm
+++ b/PVE/Network/SDN/Vnets.pm
@@ -100,7 +100,7 @@ sub get_subnet_from_vnet_cidr {
}
sub get_next_free_cidr {
- my ($vnetid, $hostname, $mac, $description, $ipversion) = @_;
+ my ($vnetid, $hostname, $mac, $description, $ipversion, $skipdns) = @_;
my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);
my $zoneid = $vnet->{zone};
@@ -121,7 +121,7 @@ sub get_next_free_cidr {
$subnetcount++;
eval {
- $ip = PVE::Network::SDN::Subnets::next_free_ip($zone, $subnetid, $subnet, $hostname, $mac, $description);
+ $ip = PVE::Network::SDN::Subnets::next_free_ip($zone, $subnetid, $subnet, $hostname, $mac, $description, $skipdns);
};
warn $@ if $@;
last if $ip;
@@ -132,30 +132,30 @@ sub get_next_free_cidr {
}
sub add_cidr {
- my ($vnetid, $cidr, $hostname, $mac, $description) = @_;
+ my ($vnetid, $cidr, $hostname, $mac, $description, $skipdns) = @_;
return if !$vnetid;
my ($zone, $subnetid, $subnet, $ip) = PVE::Network::SDN::Vnets::get_subnet_from_vnet_cidr($vnetid, $cidr);
- PVE::Network::SDN::Subnets::add_ip($zone, $subnetid, $subnet, $ip, $hostname, $mac, $description);
+ PVE::Network::SDN::Subnets::add_ip($zone, $subnetid, $subnet, $ip, $hostname, $mac, $description, undef, $skipdns);
}
sub update_cidr {
- my ($vnetid, $cidr, $hostname, $oldhostname, $mac, $description) = @_;
+ my ($vnetid, $cidr, $hostname, $oldhostname, $mac, $description, $skipdns) = @_;
return if !$vnetid;
my ($zone, $subnetid, $subnet, $ip) = PVE::Network::SDN::Vnets::get_subnet_from_vnet_cidr($vnetid, $cidr);
- PVE::Network::SDN::Subnets::update_ip($zone, $subnetid, $subnet, $ip, $hostname, $oldhostname, $mac, $description);
+ PVE::Network::SDN::Subnets::update_ip($zone, $subnetid, $subnet, $ip, $hostname, $oldhostname, $mac, $description, $skipdns);
}
sub del_cidr {
- my ($vnetid, $cidr, $hostname) = @_;
+ my ($vnetid, $cidr, $hostname, $skipdns) = @_;
return if !$vnetid;
my ($zone, $subnetid, $subnet, $ip) = PVE::Network::SDN::Vnets::get_subnet_from_vnet_cidr($vnetid, $cidr);
- PVE::Network::SDN::Subnets::del_ip($zone, $subnetid, $subnet, $ip, $hostname);
+ PVE::Network::SDN::Subnets::del_ip($zone, $subnetid, $subnet, $ip, $hostname, $skipdns);
}
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH pve-network] vnet/subnet : add skipdns option
2021-07-11 22:48 [pve-devel] [PATCH pve-network] vnet/subnet : add skipdns option Alexandre Derumier
@ 2021-07-13 4:41 ` Thomas Lamprecht
2021-07-13 6:17 ` alexandre derumier
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Lamprecht @ 2021-07-13 4:41 UTC (permalink / raw)
To: Proxmox VE development discussion, Alexandre Derumier
On 12.07.21 00:48, Alexandre Derumier wrote:
> allow to register ip to ipam without dns registration.
> can be used for temp/pending ip for example
>
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> ---
> PVE/Network/SDN/Subnets.pm | 70 ++++++++++++++++++++++----------------
> PVE/Network/SDN/Vnets.pm | 16 ++++-----
> 2 files changed, 49 insertions(+), 37 deletions(-)
>
looks OK, I wonder if we'd be more future proof if we went for adding a %param hash
(or as reference with $param) instead, with the skip dns options as property?
Not to sure how much change potential there's here.
btw., did you checked out newer ifupdown2 already? I saw that upstream added a changelog
entry already, but not yet tagged as release.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH pve-network] vnet/subnet : add skipdns option
2021-07-13 4:41 ` Thomas Lamprecht
@ 2021-07-13 6:17 ` alexandre derumier
2021-07-13 6:56 ` alexandre derumier
0 siblings, 1 reply; 4+ messages in thread
From: alexandre derumier @ 2021-07-13 6:17 UTC (permalink / raw)
To: Thomas Lamprecht, Proxmox VE development discussion
Le mardi 13 juillet 2021 à 06:41 +0200, Thomas Lamprecht a écrit :
> On 12.07.21 00:48, Alexandre Derumier wrote:
> > allow to register ip to ipam without dns registration.
> > can be used for temp/pending ip for example
> >
> > Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> > ---
> > PVE/Network/SDN/Subnets.pm | 70 ++++++++++++++++++++++------------
> > ----
> > PVE/Network/SDN/Vnets.pm | 16 ++++-----
> > 2 files changed, 49 insertions(+), 37 deletions(-)
> >
>
> looks OK, I wonder if we'd be more future proof if we went for adding
> a %param hash
> (or as reference with $param) instead, with the skip dns options as
> property?
>
> Not to sure how much change potential there's here.
Ok no problem, I'll look for this.
(I'm currently reworking lxc ipam too, based on my last work on qemu-
server)
>
> btw., did you checked out newer ifupdown2 already? I saw that
> upstream added a changelog
> entry already, but not yet tagged as release.
>
I'm currently testing it. (I had asked to julien to push theses last
patches 2 week ago to have them before proxmox7 release, but it was a
bit late ^_^)
https://github.com/CumulusNetworks/ifupdown2/issues/211
I known they are a dhcp fix, needed by a user on the forum
https://github.com/CumulusNetworks/ifupdown2/commit/1eacb76b3ab634838559d3a2b5a4e39b98b21d10
I'll try to finish my tests the week. (I'm going to holiday next week
for 3 weeks)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pve-devel] [PATCH pve-network] vnet/subnet : add skipdns option
2021-07-13 6:17 ` alexandre derumier
@ 2021-07-13 6:56 ` alexandre derumier
0 siblings, 0 replies; 4+ messages in thread
From: alexandre derumier @ 2021-07-13 6:56 UTC (permalink / raw)
To: Thomas Lamprecht, Proxmox VE development discussion
also, I have some patches for evpn in frr, not yet applied in master,
I'm just testing proxmox7, and it seem that debian package (7.5) is
used
(and bgp daemon is disable too by default)
maybe it could be great to maintain a frr 7.5 proxmox version for
proxmox7 too.
I'll to update patches too before the end of the week
Le mardi 13 juillet 2021 à 08:17 +0200, alexandre derumier a écrit :
> Le mardi 13 juillet 2021 à 06:41 +0200, Thomas Lamprecht a écrit :
> > On 12.07.21 00:48, Alexandre Derumier wrote:
> > > allow to register ip to ipam without dns registration.
> > > can be used for temp/pending ip for example
> > >
> > > Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> > > ---
> > > PVE/Network/SDN/Subnets.pm | 70 ++++++++++++++++++++++----------
> > > ------
> > > PVE/Network/SDN/Vnets.pm | 16 ++++-----
> > > 2 files changed, 49 insertions(+), 37 deletions(-)
> > >
> >
> > looks OK, I wonder if we'd be more future proof if we went for
> > adding a %param hash
> > (or as reference with $param) instead, with the skip dns options as
> > property?
> >
> > Not to sure how much change potential there's here.
>
> Ok no problem, I'll look for this.
> (I'm currently reworking lxc ipam too, based on my last work on qemu-
> server)
>
> >
> > btw., did you checked out newer ifupdown2 already? I saw that
> > upstream added a changelog
> > entry already, but not yet tagged as release.
> >
> I'm currently testing it. (I had asked to julien to push theses last
> patches 2 week ago to have them before proxmox7 release, but it was a
> bit late ^_^)
> https://github.com/CumulusNetworks/ifupdown2/issues/211
> I known they are a dhcp fix, needed by a user on the forum
> https://github.com/CumulusNetworks/ifupdown2/commit/1eacb76b3ab634838559d3a2b5a4e39b98b21d10
>
>
> I'll try to finish my tests the week. (I'm going to holiday next week
> for 3 weeks)
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-13 6:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11 22:48 [pve-devel] [PATCH pve-network] vnet/subnet : add skipdns option Alexandre Derumier
2021-07-13 4:41 ` Thomas Lamprecht
2021-07-13 6:17 ` alexandre derumier
2021-07-13 6:56 ` alexandre derumier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox