summaryrefslogtreecommitdiff
path: root/PVE/API2/Network/SDN/Vnets.pm
diff options
context:
space:
mode:
authorAlexandre Derumier <aderumier@odiso.com>2020-04-13 08:13:11 +0200
committerThomas Lamprecht <t.lamprecht@proxmox.com>2020-05-02 19:14:58 +0200
commitf9bc9640820074d770aedb8a0e431e5c69bae3c1 (patch)
tree49a9cf18cc208f12115ad54fbb3b630a76503a8e /PVE/API2/Network/SDN/Vnets.pm
parentf703d2ae09b7f877c5afa23d1109426b83ed3b69 (diff)
sdn: use .version and global lock
Diffstat (limited to 'PVE/API2/Network/SDN/Vnets.pm')
-rw-r--r--PVE/API2/Network/SDN/Vnets.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/PVE/API2/Network/SDN/Vnets.pm b/PVE/API2/Network/SDN/Vnets.pm
index a9561f1..8f70bab 100644
--- a/PVE/API2/Network/SDN/Vnets.pm
+++ b/PVE/API2/Network/SDN/Vnets.pm
@@ -6,6 +6,7 @@ use warnings;
use PVE::SafeSyslog;
use PVE::Tools qw(extract_param);
use PVE::Cluster qw(cfs_read_file cfs_write_file);
+use PVE::Network::SDN;
use PVE::Network::SDN::Vnets;
use PVE::Network::SDN::VnetPlugin;
@@ -116,7 +117,7 @@ __PACKAGE__->register_method ({
PVE::Cluster::check_cfs_quorum();
mkdir("/etc/pve/sdn");
- PVE::Network::SDN::Vnets::lock_sdn_vnets_config(
+ PVE::Network::SDN::lock_sdn_config(
sub {
my $cfg = PVE::Network::SDN::Vnets::config();
@@ -132,6 +133,9 @@ __PACKAGE__->register_method ({
PVE::Network::SDN::Vnets::write_config($cfg);
+ PVE::Network::SDN::increase_version();
+
+
}, "create sdn vnet object failed");
return undef;
@@ -154,7 +158,7 @@ __PACKAGE__->register_method ({
my $id = extract_param($param, 'vnet');
my $digest = extract_param($param, 'digest');
- PVE::Network::SDN::Vnets::lock_sdn_vnets_config(
+ PVE::Network::SDN::lock_sdn_config(
sub {
my $cfg = PVE::Network::SDN::Vnets::config();
@@ -168,6 +172,8 @@ __PACKAGE__->register_method ({
PVE::Network::SDN::Vnets::write_config($cfg);
+ PVE::Network::SDN::increase_version();
+
}, "update sdn vnet object failed");
return undef;
@@ -196,7 +202,7 @@ __PACKAGE__->register_method ({
my $id = extract_param($param, 'vnet');
- PVE::Network::SDN::Vnets::lock_sdn_vnets_config(
+ PVE::Network::SDN::lock_sdn_config(
sub {
my $cfg = PVE::Network::SDN::Vnets::config();
@@ -210,6 +216,8 @@ __PACKAGE__->register_method ({
delete $cfg->{ids}->{$id};
PVE::Network::SDN::Vnets::write_config($cfg);
+ PVE::Network::SDN::increase_version();
+
}, "delete sdn vnet object failed");