[pve-devel] r5438 - pve-access-control/trunk/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Jan 25 11:25:18 CET 2011


Author: dietmar
Date: 2011-01-25 11:25:18 +0100 (Tue, 25 Jan 2011)
New Revision: 5438

Modified:
   pve-access-control/trunk/PVE/AccessControl.pm
Log:
use PVE::Cluster lock code


Modified: pve-access-control/trunk/PVE/AccessControl.pm
===================================================================
--- pve-access-control/trunk/PVE/AccessControl.pm	2011-01-25 10:18:38 UTC (rev 5437)
+++ pve-access-control/trunk/PVE/AccessControl.pm	2011-01-25 10:25:18 UTC (rev 5438)
@@ -9,24 +9,17 @@
 use Authen::PAM qw(:constants);
 use Net::LDAP;
 use PVE::Tools qw(run_command lock_file file_get_contents split_list safe_print);
-use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file);
+use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file);
 use PVE::JSONSchema;
 
 use Data::Dumper; # fixme: remove
 
-# fixme: implement cluster wide locks
-
-my $lockdir = "/var/lock/pve-manager";
-mkdir $lockdir;
-
 # $authdir must be writable by root only!
 my $confdir = "/etc/pve";
 my $authdir = "$confdir/priv";
 my $authprivkeyfn = "$authdir/authkey.key";
 my $authpubkeyfn = "$confdir/authkey.pub";
-my $userconfiglock = "$lockdir/.lock-user.cfg";
 my $shadowconfigfile = "priv/shadow.cfg";
-my $shadowconfiglock = "$lockdir/.lock-shadow.cfg";
 my $domainconfigfile = "priv/domains.cfg";
 
 my $ticket_lifetime = 3600*2; # 2 hours
@@ -50,7 +43,7 @@
 
     my $parent = ( caller(1) )[3];
 
-    lock_file($userconfiglock, undef, $parent, $code);
+    cfs_lock_file("user.cfg", undef, $parent, $code);
     my $err = $@;
     if ($err) {
 	$errmsg ? die "$errmsg: $err" : die $err;
@@ -62,7 +55,7 @@
 
     my $parent = ( caller(1) )[3];
 
-    lock_file($shadowconfiglock, undef, $parent, $code);
+    cfs_lock_file($shadowconfigfile, undef, $parent, $code);
     my $err = $@;
     if ($err) {
 	$errmsg ? die "$errmsg: $err" : die $err;



More information about the pve-devel mailing list