Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 951404 Details for
Bug 1158067
Gluster volume monitor hangs glusterfsd process
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
status check used to monitor the bricks for GFS
brick_status.py (text/x-python), 4.20 KB, created by
Tom Young
on 2014-10-28 13:27:37 UTC
(
hide
)
Description:
status check used to monitor the bricks for GFS
Filename:
MIME Type:
Creator:
Tom Young
Created:
2014-10-28 13:27:37 UTC
Size:
4.20 KB
patch
obsolete
>#!/usr/bin/env python > >import sys >import subprocess > >def parse_output(output): > '''Parse the output from subprocess.''' > lines = output.split('\n') > lines = [line for line in lines if line.startswith('Brick')] > > if len(lines) != 4: > print("A brick is down ERROR") > return True > > for brick, addr, port, online, pid in [i.split() for i in lines]: > if online != 'Y': > print("A brick is down ERROR") > return True > > print("Volume OK") > return False > >def check_output(*popenargs, **kwargs): > '''Run command with arguments and return its output as a byte string. > > Backported from Python 2.7 as it's implemented as pure python on stdlib. > > ex: > >>> check_output(['/usr/bin/python', '--version']) > Python 2.6.2 > >>> check_output('ls -t', shell=True) > spam.py > eggs.py > foo.txt > ''' > process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) > output, unused_err = process.communicate() > retcode = process.poll() > if retcode: > cmd = kwargs.get("args") > if cmd is None: > cmd = popenargs[0] > error = subprocess.CalledProcessError(retcode, cmd) > error.output = output > # raise error > return output > >################################################################################ >test_output = [] >test_output.append('''Status of volume: homegfs >Gluster process Port Online Pid >------------------------------------------------------------------------------ >Brick gfsib01a.corvidtec.com:/data/brick01a/homegfs 49152 Y 3400 >Brick gfsib01b.corvidtec.com:/data/brick01b/homegfs 49152 Y 19446 >Brick gfsib01a.corvidtec.com:/data/brick02a/homegfs 49153 Y 3408 >Brick gfsib01b.corvidtec.com:/data/brick02b/homegfs 49153 Y 19455 >NFS Server on localhost 2049 Y 19480 >Self-heal Daemon on localhost N/A Y 19488 >NFS Server on gfsib01a.corvidtec.com 2049 Y 4615 >Self-heal Daemon on gfsib01a.corvidtec.com N/A Y 4620 > >Task Status of Volume homegfs >------------------------------------------------------------------------------ >There are no active volume tasks >''') > >test_output.append('''Status of volume: homegfs >Gluster process Port Online Pid >------------------------------------------------------------------------------ >Brick gfsib01a.corvidtec.com:/data/brick01a/homegfs 49152 Y 3400 >Brick gfsib01b.corvidtec.com:/data/brick01b/homegfs 49152 Y 19446 >Brick gfsib01a.corvidtec.com:/data/brick02a/homegfs 49153 Y 3408 >NFS Server on localhost 2049 Y 19480 >Self-heal Daemon on localhost N/A Y 19488 >NFS Server on gfsib01a.corvidtec.com 2049 Y 4615 >Self-heal Daemon on gfsib01a.corvidtec.com N/A Y 4620 > >Task Status of Volume homegfs >------------------------------------------------------------------------------ >There are no active volume tasks >''') > >test_output.append('''Status of volume: homegfs >Gluster process Port Online Pid >------------------------------------------------------------------------------ >Brick gfsib01a.corvidtec.com:/data/brick01a/homegfs 49152 Y 3400 >Brick gfsib01b.corvidtec.com:/data/brick01b/homegfs 49152 N 19446 >Brick gfsib01a.corvidtec.com:/data/brick02a/homegfs 49153 Y 3408 >Brick gfsib01b.corvidtec.com:/data/brick02b/homegfs 49153 Y 19455 >NFS Server on localhost 2049 Y 19480 >Self-heal Daemon on localhost N/A Y 19488 >NFS Server on gfsib01a.corvidtec.com 2049 Y 4615 >Self-heal Daemon on gfsib01a.corvidtec.com N/A Y 4620 > >Task Status of Volume homegfs >------------------------------------------------------------------------------ >There are no active volume tasks >''') > >def run_test(): > '''Test case to ensure it works correctly.''' > results = [] > for output_str in test_output: > results.append(output_str) > if all(results): > print 'All tests pass! Good to go!' > else: > print 'Tests failed!' > print results > >if __name__ == '__main__': > if '-t' in sys.argv: > run_test() > else: > if len(sys.argv) != 2: > print "Please give a volume name as an argument." > sys.exit(1) > > volume = sys.argv[1] > output = check_output(['gluster', 'volume', 'status', volume]) > disk_down = parse_output(output) > if disk_down: > sys.exit(2) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1158067
: 951404