[pve-devel] [PATCH pve-network 5/7] api2: update_hook: also verify transport associated to vnet
Alexandre Derumier
aderumier at odiso.com
Fri May 3 11:00:18 CEST 2019
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/API2/Network/Network.pm | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Network/Network.pm b/PVE/API2/Network/Network.pm
index d199234..3dd0a57 100644
--- a/PVE/API2/Network/Network.pm
+++ b/PVE/API2/Network/Network.pm
@@ -138,6 +138,14 @@ __PACKAGE__->register_method ({
$cfg->{ids}->{$networkid} = $opts;
$plugin->on_update_hook($networkid, $cfg);
+ #also verify transport associated to vnet
+ if($scfg->{type} eq 'vnet') {
+ my $transportid = $scfg->{transportzone};
+ die "missing transportzone" if !$transportid;
+ my $transport_cfg = $cfg->{ids}->{$transportid};
+ my $transport_plugin = PVE::Network::Network::Plugin->lookup($transport_cfg->{type});
+ $transport_plugin->on_update_hook($transportid, $cfg);
+ }
PVE::Network::Network::write_config($cfg);
@@ -180,7 +188,14 @@ __PACKAGE__->register_method ({
}
$plugin->on_update_hook($networkid, $cfg);
-
+ #also verify transport associated to vnet
+ if($scfg->{type} eq 'vnet') {
+ my $transportid = $scfg->{transportzone};
+ die "missing transportzone" if !$transportid;
+ my $transport_cfg = $cfg->{ids}->{$transportid};
+ my $transport_plugin = PVE::Network::Network::Plugin->lookup($transport_cfg->{type});
+ $transport_plugin->on_update_hook($transportid, $cfg);
+ }
PVE::Network::Network::write_config($cfg);
}, "update network object failed");
--
2.11.0
More information about the pve-devel
mailing list