[pve-devel] [PATCH manager] NodeConfig: ensure locked context has current view
Fabian Grünbichler
f.gruenbichler at proxmox.com
Thu Apr 30 10:37:02 CEST 2020
similar to the recent changes for pve-guest-common - we start each API
call with a cfs_update, but while we were waiting for the flock another
R-M-W cycle might have happened, so we need to refresh after obtaining
the lock.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Notes:
there's only a single API call using this, so it's pretty straight-forward.
patch generated on-top of ACME patch set
PVE/NodeConfig.pm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/PVE/NodeConfig.pm b/PVE/NodeConfig.pm
index a0921558..6a95d7aa 100644
--- a/PVE/NodeConfig.pm
+++ b/PVE/NodeConfig.pm
@@ -50,7 +50,13 @@ sub write_config {
}
sub lock_config {
- my ($node, $code, @param) = @_;
+ my ($node, $realcode, @param) = @_;
+
+ # make sure configuration file is up-to-date
+ my $code = sub {
+ PVE::Cluster::cfs_update();
+ $realcode->(@_);
+ };
my $res = lock_file($node_config_lock, 10, $code, @param);
--
2.20.1
More information about the pve-devel
mailing list