* [pve-devel] [PATCH pve-network] vnets: subroutines: return if !$vnetid
@ 2021-05-24 15:22 Alexandre Derumier
0 siblings, 0 replies; only message in thread
From: Alexandre Derumier @ 2021-05-24 15:22 UTC (permalink / raw)
To: pve-devel
---
PVE/Network/SDN/Vnets.pm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/PVE/Network/SDN/Vnets.pm b/PVE/Network/SDN/Vnets.pm
index 8c9629d..86967a3 100644
--- a/PVE/Network/SDN/Vnets.pm
+++ b/PVE/Network/SDN/Vnets.pm
@@ -52,6 +52,8 @@ sub complete_sdn_vnet {
sub get_vnet {
my ($vnetid, $running) = @_;
+ return if !$vnetid;
+
my $cfg = {};
if($running) {
my $cfg = PVE::Network::SDN::running_config();
@@ -68,6 +70,8 @@ sub get_vnet {
sub get_subnets {
my ($vnetid) = @_;
+ return if !$vnetid;
+
my $subnets = undef;
my $subnets_cfg = PVE::Network::SDN::Subnets::config();
foreach my $subnetid (sort keys %{$subnets_cfg->{ids}}) {
@@ -130,6 +134,8 @@ sub get_next_free_cidr {
sub add_cidr {
my ($vnetid, $cidr, $hostname, $mac, $description) = @_;
+ 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);
}
@@ -137,6 +143,8 @@ sub add_cidr {
sub update_cidr {
my ($vnetid, $cidr, $hostname, $oldhostname, $mac, $description) = @_;
+ 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);
}
@@ -144,6 +152,8 @@ sub update_cidr {
sub del_cidr {
my ($vnetid, $cidr, $hostname) = @_;
+ 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);
}
--
2.20.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-24 15:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 15:22 [pve-devel] [PATCH pve-network] vnets: subroutines: return if !$vnetid Alexandre Derumier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal