[pve-devel] [PATCH pve-network 5/5] add on_update_hook
Alexandre Derumier
aderumier at odiso.com
Thu Apr 4 10:18:35 CEST 2019
do nothing for now
---
PVE/API2/Network/Network.pm | 10 ++++------
PVE/Network/Network/Plugin.pm | 6 ++++++
PVE/Network/Network/VlanPlugin.pm | 8 ++++++++
PVE/Network/Network/VnetPlugin.pm | 6 ++++++
PVE/Network/Network/VxlanMulticastPlugin.pm | 9 +++++++++
5 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/PVE/API2/Network/Network.pm b/PVE/API2/Network/Network.pm
index a647edf..7a8b299 100644
--- a/PVE/API2/Network/Network.pm
+++ b/PVE/API2/Network/Network.pm
@@ -136,9 +136,7 @@ __PACKAGE__->register_method ({
}
$cfg->{ids}->{$networkid} = $opts;
-
- #improveme:
- #check local configuration of all nodes for conflict
+ $plugin->on_update_hook($networkid, $scfg);
PVE::Network::Network::write_config($cfg);
@@ -179,9 +177,9 @@ __PACKAGE__->register_method ({
foreach my $k (%$opts) {
$scfg->{$k} = $opts->{$k};
}
- #improveme:
- #add vlan/vxlan check on existingvnets
- #check local configuration of all nodes for conflict
+
+ $plugin->on_update_hook($networkid, $scfg);
+
PVE::Network::Network::write_config($cfg);
}, "update network object failed");
diff --git a/PVE/Network/Network/Plugin.pm b/PVE/Network/Network/Plugin.pm
index b537535..e834434 100644
--- a/PVE/Network/Network/Plugin.pm
+++ b/PVE/Network/Network/Plugin.pm
@@ -58,6 +58,12 @@ sub on_delete_hook {
# do nothing by default
}
+sub on_update_hook {
+ my ($class, $networkid, $scfg) = @_;
+
+ # do nothing by default
+}
+
#helpers
sub parse_tag_number_or_range {
my ($str, $max, $tag) = @_;
diff --git a/PVE/Network/Network/VlanPlugin.pm b/PVE/Network/Network/VlanPlugin.pm
index c335764..a2c0292 100644
--- a/PVE/Network/Network/VlanPlugin.pm
+++ b/PVE/Network/Network/VlanPlugin.pm
@@ -102,6 +102,14 @@ sub on_delete_hook {
# verify that no vnet are associated to this transport
}
+sub on_update_hook {
+ my ($class, $networkid, $scfg) = @_;
+
+ # verify that vlan-allowed don't conflict with another vlan-allowed transport
+
+ # verify that vlan-allowed is matching currently vnet tag in this transport
+}
+
1;
diff --git a/PVE/Network/Network/VnetPlugin.pm b/PVE/Network/Network/VnetPlugin.pm
index 983e6a2..6ee1a3e 100644
--- a/PVE/Network/Network/VnetPlugin.pm
+++ b/PVE/Network/Network/VnetPlugin.pm
@@ -67,5 +67,11 @@ sub on_delete_hook {
# verify than no vm or ct have interfaces in this bridge
}
+sub on_update_hook {
+ my ($class, $networkid, $scfg) = @_;
+
+ # verify that tag is not already defined in another vnet
+
+}
1;
diff --git a/PVE/Network/Network/VxlanMulticastPlugin.pm b/PVE/Network/Network/VxlanMulticastPlugin.pm
index 901f425..ae4ec1a 100644
--- a/PVE/Network/Network/VxlanMulticastPlugin.pm
+++ b/PVE/Network/Network/VxlanMulticastPlugin.pm
@@ -86,6 +86,15 @@ sub on_delete_hook {
# verify that no vnet are associated to this transport
}
+sub on_update_hook {
+ my ($class, $networkid, $scfg) = @_;
+
+ # verify that vxlan-allowed don't conflict with another vxlan-allowed transport
+
+ # verify that vxlan-allowed is matching currently vnet tag in this transport
+
+}
+
1;
--
2.11.0
More information about the pve-devel
mailing list