[pve-devel] [PATCH v3 cluster 2/2] cluster: use lock for legacy authkey generation
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Mar 13 15:01:33 CET 2019
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Notes:
changes since v2:
- make error handling more readable
data/PVE/Cluster.pm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 83b401c..e641cc1 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -158,11 +158,15 @@ sub gen_auth_key {
check_cfs_is_mounted();
- mkdir $authdir || $! == EEXIST || die "unable to create dir '$authdir' - $!\n";
+ cfs_lock_authkey(undef, sub {
+ mkdir $authdir || $! == EEXIST || die "unable to create dir '$authdir' - $!\n";
- run_silent_cmd(['openssl', 'genrsa', '-out', $authprivkeyfn, '2048']);
+ run_silent_cmd(['openssl', 'genrsa', '-out', $authprivkeyfn, '2048']);
- run_silent_cmd(['openssl', 'rsa', '-in', $authprivkeyfn, '-pubout', '-out', $authpubkeyfn]);
+ run_silent_cmd(['openssl', 'rsa', '-in', $authprivkeyfn, '-pubout', '-out', $authpubkeyfn]);
+ });
+
+ die "$@\n" if $@;
}
sub gen_pveca_key {
--
2.20.1
More information about the pve-devel
mailing list