def EQLssh_init(target, username, password):
    
    conn_cred = [target, username, password]
    conn = sshutil.SSHSession(conn_cred)
    conn.master_login()

    util.daemon()
    timer = KEEPALIVE
    command = "whoami"
    while os.path.exists(conn.statefile):
        time.sleep(SLEEP)
        timer -= SLEEP
        if timer <= 0:
            str = conn.command(command)
            timer = KEEPALIVE
    
    conn.close()
    os.kill(conn.sshpid,signal.SIGQUIT)
Exemple #2
0
import mpath_cli
import mpp_luncheck
import mpp_mpathutil
import glob

supported = ["iscsi", "lvmoiscsi", "rawhba", "lvmohba", "ocfsohba", "ocfsoiscsi", "netapp"]

LOCK_TYPE_HOST = "host"
LOCK_NS1 = "mpathcount1"
LOCK_NS2 = "mpathcount2"

MP_INUSEDIR = "/dev/disk/mpInuse"
mpp_path_update = False
match_bySCSIid = False

util.daemon()
if len(sys.argv) == 3:
    match_bySCSIid = True
    SCSIid = sys.argv[1]
    mpp_path_update = True
    mpp_entry = sys.argv[2]

# We use flocks to ensure that only one process
# executes at any one time, however we must make
# sure that any subsequent changes are always
# correctly updated, so we allow an outstanding
# process to queue behind the running one.
mpathcountlock = lock.Lock(LOCK_TYPE_HOST, LOCK_NS1)
mpathcountqueue = lock.Lock(LOCK_TYPE_HOST, LOCK_NS2)
util.SMlog("MPATH: Trying to acquire the lock")
if mpp_path_update:
Exemple #3
0
import mpath_cli
import mpp_luncheck
import mpp_mpathutil
import glob

supported = ['iscsi','lvmoiscsi','rawhba','lvmohba', 'ocfsohba', 'ocfsoiscsi', 'netapp','lvmofcoe']

LOCK_TYPE_HOST = "host"
LOCK_NS1 = "mpathcount1"
LOCK_NS2 = "mpathcount2"

MP_INUSEDIR = "/dev/disk/mpInuse"
mpp_path_update = False
match_bySCSIid = False

util.daemon()
if len(sys.argv) == 3:
    match_bySCSIid = True
    SCSIid = sys.argv[1]
    mpp_path_update = True
    mpp_entry = sys.argv[2]

# We use flocks to ensure that only one process 
# executes at any one time, however we must make
# sure that any subsequent changes are always 
# correctly updated, so we allow an outstanding
# process to queue behind the running one.
mpathcountlock = lock.Lock(LOCK_TYPE_HOST, LOCK_NS1)
mpathcountqueue = lock.Lock(LOCK_TYPE_HOST, LOCK_NS2)
util.SMlog("MPATH: Trying to acquire the lock")
if mpp_path_update:
Exemple #4
0
            os.dup2(self.wfile.fileno(), sys.stdout.fileno())
            os.execve(interp, args, env)
        except:
            self.server.handle_error(self.request, self.client_address)
            os._exit(127)
        return



if __name__ == '__main__':
    if sys.argv[1:]:
        port = int(sys.argv[1])
    else:
        print "need port"
        sys.exit(1)
    httpd = BaseHTTPServer.HTTPServer(("", port), CGIHandler)
    # add fd_cloexec flag to socket
    util.set_cloexec_flag(httpd.fileno())
    print "serving at port", port
    sdir = sys.path[0].rstrip('/')
    pidfile = sdir + '/server.pid'
    logdir = sdir + '/log'
    if not os.path.isdir(logdir):
        os.mkdir(logdir)
    logfile = logdir + '/server.log'
    util.daemon(pidfile, stdout = logfile, stderr = logfile)
    sys.stdout.write('server start %s\n' % util.current_timestamp())
    httpd.serve_forever()