diff options
| author | Alexandre Derumier <aderumier@odiso.com> | 2020-04-13 08:13:11 +0200 |
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2020-05-02 19:14:58 +0200 |
| commit | f9bc9640820074d770aedb8a0e431e5c69bae3c1 (patch) | |
| tree | 49a9cf18cc208f12115ad54fbb3b630a76503a8e /PVE/API2/Network/SDN/Controllers.pm | |
| parent | f703d2ae09b7f877c5afa23d1109426b83ed3b69 (diff) | |
sdn: use .version and global lock
Diffstat (limited to 'PVE/API2/Network/SDN/Controllers.pm')
| -rw-r--r-- | PVE/API2/Network/SDN/Controllers.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/PVE/API2/Network/SDN/Controllers.pm b/PVE/API2/Network/SDN/Controllers.pm index 50491eb..0f8dcbe 100644 --- a/PVE/API2/Network/SDN/Controllers.pm +++ b/PVE/API2/Network/SDN/Controllers.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::Zones; use PVE::Network::SDN::Controllers; use PVE::Network::SDN::Controllers::Plugin; @@ -136,7 +137,7 @@ __PACKAGE__->register_method ({ PVE::Cluster::check_cfs_quorum(); mkdir("/etc/pve/sdn"); - PVE::Network::SDN::Controllers::lock_sdn_controllers_config( + PVE::Network::SDN::lock_sdn_config( sub { my $controller_cfg = PVE::Network::SDN::Controllers::config(); @@ -151,6 +152,8 @@ __PACKAGE__->register_method ({ PVE::Network::SDN::Controllers::write_config($controller_cfg); + PVE::Network::SDN::increase_version(); + }, "create sdn controller object failed"); return undef; @@ -173,7 +176,7 @@ __PACKAGE__->register_method ({ my $id = extract_param($param, 'controller'); my $digest = extract_param($param, 'digest'); - PVE::Network::SDN::Controllers::lock_sdn_controllers_config( + PVE::Network::SDN::lock_sdn_config( sub { my $controller_cfg = PVE::Network::SDN::Controllers::config(); @@ -193,6 +196,9 @@ __PACKAGE__->register_method ({ PVE::Network::SDN::Controllers::write_config($controller_cfg); + PVE::Network::SDN::increase_version(); + + }, "update sdn controller object failed"); return undef; @@ -221,7 +227,7 @@ __PACKAGE__->register_method ({ my $id = extract_param($param, 'controller'); - PVE::Network::SDN::Controllers::lock_sdn_controllers_config( + PVE::Network::SDN::lock_sdn_config( sub { my $cfg = PVE::Network::SDN::Controllers::config(); @@ -237,6 +243,8 @@ __PACKAGE__->register_method ({ delete $cfg->{ids}->{$id}; PVE::Network::SDN::Controllers::write_config($cfg); + PVE::Network::SDN::increase_version(); + }, "delete sdn controller object failed"); |
