Package: lockserver
1. INTRODUCTIONlockserver is a simple lock server that enables the coordination of several clientsto accede to a single resource in a network that has a maximum number of simultaneoussessions.The origin of this server is the access to a Dell Equallogic SAN. Such SAN has a limitof 7 (or 8) SSH concurrent sessions, but we had more clients that were trying to sshthis SAN. A limit was needed, and so this lockserver was created.Clients are modified to use the Lock object from the lockcli module and connect to theserver that is located in a URL in the network. The server is configured to allow anumber of simultaneous clients.The server is created in a general way so multiple locks can be created although it isdisabled the remote creation of locks. The server is able to create a lock at startup,and the parameters of such lock are stated in the .conf file.* There is a start-up service created for debian, but it is not supposed to work in RedHat based distros.2. JOB PENDING- Include some kind of authentication for clients (i.e. a secret key)- Include a script to start as a service in other than debian-based distros3. EXAMPLE3.1 SERVER: lockserver.my.url.comWill run lockserver with the "DefaultLock" lock created on startup, and will allow upto 6 concurrent locks. If a lock query is not used for more than 1200 seconds, it willexpire.3.1.1 FILE /etc/lockserver.conf[general]# set to localhost if you do not want access from outside this serverSERVER=0.0.0.0# the port where it will listenPORT=9090# the log fileLOG_FILE=/var/log/lockserver.log# the log level (superdebug, debug, info, error or warning)LOGLEVEL=debug# the period for evaluating the queueLIFECYCLE_PERIOD=1# the parameters of the lock that will be created on startupDEFAULT_LOCK=DefaultLockDEFAULT_LOCK_SIZE=6DEFAULT_LOCK_GRACE_TIME=10DEFAULT_LOCK_EXPIRATION_TIME=1200DEFAULT_LOCK_MAX_LOCK_TIME=12003.2 CLIENTS (e.g. node1.my.url.com, node2.my.url.com, node3.my.url.com)Will run cliapp to coordinate3.2.1 APPLICATION cliapp/usr/bin/myapp.py#!/usr/bin/pythonimport lockcliimport socketl = lockcli.Lock("http://lockserver.my.url.com:9090/RPC2", "DefaultLock")if l.lock_query("i queried a lock from %s" % socket.gethostname()):print "lock queried"if l.lock_wait():print "lock acquired"time.sleep(30) # this is the hard jobl.lock_release()print "lock released"else:print "could not get lock"else:print "could not query for lock"4. LICENSE# The MIT License (MIT)## Copyright (c) 2014 Carlos de Alfonso (caralla@upv.es)## Permission is hereby granted, free of charge, to any person obtaining a copy# of this software and associated documentation files (the "Software"), to deal# in the Software without restriction, including without limitation the rights# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell# copies of the Software, and to permit persons to whom the Software is# furnished to do so, subject to the following conditions:## The above copyright notice and this permission notice shall be included in# all copies or substantial portions of the Software.## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN# THE SOFTWARE.5. CHANGE LOG2014-12-16 (v.0.36)Bug correction in install for pypi.2014-12-16 (v.0.35)Added web browsing support. Using a web browser we can get statistics of usageand the current state of the locks (locks locked and the queue).2014-12-11 (v.0.30)Initial public version, submited to pypi