[pve-devel] r6374 - pve-storage/pve2

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Jul 28 07:51:35 CEST 2011


Author: dietmar
Date: 2011-07-28 07:51:35 +0200 (Thu, 28 Jul 2011)
New Revision: 6374

Modified:
   pve-storage/pve2/ChangeLog
   pve-storage/pve2/pvesm
Log:
	* pvesm (lock): removed - we do not use the central lock manager
	anymore.



Modified: pve-storage/pve2/ChangeLog
===================================================================
--- pve-storage/pve2/ChangeLog	2011-07-28 05:26:46 UTC (rev 6373)
+++ pve-storage/pve2/ChangeLog	2011-07-28 05:51:35 UTC (rev 6374)
@@ -1,5 +1,8 @@
 2011-07-28  Proxmox Support Team  <support at proxmox.com>
 
+	* pvesm (lock): removed - we do not use the central lock manager
+	anymore.
+
 	* PVE/Storage.pm (vdisk_alloc): use run_command() in order to get
 	better error messages.
 

Modified: pve-storage/pve2/pvesm
===================================================================
--- pve-storage/pve2/pvesm	2011-07-28 05:26:46 UTC (rev 6373)
+++ pve-storage/pve2/pvesm	2011-07-28 05:51:35 UTC (rev 6374)
@@ -63,87 +63,6 @@
 
     }});
 
-__PACKAGE__->register_method ({
-    name => 'lock', 
-    path => 'lock',
-    method => 'PUT',
-    description => "Lock specified storage",
-    parameters => {
-    	additionalProperties => 0,
-	properties => {
-	    storage => get_standard_option('pve-storage-id'),
-	    timeout => {
-		type => 'integer',
-		minimum => 1,
-		optional => 1,
-	    }
-	},
-    },
-    returns => { type => 'null' },
-    
-    code => sub {
-	my ($param) = @_;
-
-	my $storeid = $param->{storage};
-	my $timeout = $param->{timeout};
-
-	$timeout = 10 if !$timeout;
-
-	PVE::Storage::parse_storage_id ($storeid);
-
-	my $lockdir = "/var/run/pve-storage";
-	mkpath $lockdir;
-
-	my $filename = "$lockdir/lock-$storeid.lock";
-
-	my $fh;
-
-	eval {
-
-	    $SIG{PIPE} = sub { die "got signal - broken pipe\n"; };
-	    $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub { die "got signal\n";  };
-
-	    local $SIG{ALRM} = sub { die "got timeout\n"; };
-
-	    alarm ($timeout);
-
-	    $fh = new IO::File (">>$filename") ||
-		die "can't open lock for storage '$storeid' - $!\n";
-
-	    if (!flock ($fh, LOCK_EX|LOCK_NB)) {
-		print STDERR "trying to aquire storage lock '$storeid' ...";
-		if (!flock ($fh, LOCK_EX)) {
-		    print STDERR " failed\n";
-		    die "can't aquire lock for storage '$storeid' - $!\n";
-		}
-		print STDERR " OK\n";
-	    }
-	    alarm (0);
-	};
-	my $err = $@;
-
-	alarm (0);
-
-	if ($err) {
-	    close ($fh) if $fh;
-	    print "lock $storeid: $err\n";
-	    *STDOUT->flush();
-	    return undef;
-	}
-
-	print "lock $storeid: success\n";
-	*STDOUT->flush();
-
-	while (my $line = <>) {
-	    chomp $line;
-	    last if $line =~ m/^release$/;
-	}
-
-	close ($fh);
-
-	return undef;
-    }});
-
 my $print_content = sub {
     my ($list) = @_;
 
@@ -245,7 +164,6 @@
 		     }
 		 }],
     path => [ __PACKAGE__, 'path', ['volume']],
-    lock => [ __PACKAGE__, 'lock', ['storage']],
 };
 
 my $cmd = shift;



More information about the pve-devel mailing list