-
Notifications
You must be signed in to change notification settings - Fork 1
/
chunkserver-cli
executable file
·40 lines (34 loc) · 1.3 KB
/
chunkserver-cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
import ChunkServer, gevent.server, rpc, gevent
import logging, config, util, sys, os.path
header="""Chunk Server of SoftSAN
Usage: chkserv-cli [options]
options:"""
cfgstruct = (\
('address', 'a', '0.0.0.0', 'IP address to bind'), \
('port', 'p', 0x2121, 'TCP port to bind'), \
('mdsaddress', 'M', None, 'meta data server address'), \
('mdsport', 'm', 0x6789, 'meta data server TCP port'), \
('vg', 'g', 'SANGroup', 'name of volume group for use exclusively by SoftSAN'),\
('volprefix', 'z', 'lv_softsan_', 'prefix of volume name'),\
('logging-level', 'l', 'info', 'logging level, can be "debug", "info", "warning", "error" or "critical"'), \
('logging-file', 'f', 'stdout', 'logging appends to this file'),\
('config', 'c', 'softsan.conf', 'config file'),\
('help', 'h', False, 'this help'),\
)
try:
configure,_ = config.config(cfgstruct, 'chunkserver')
confobj = util.Object(configure)
except:
pass
if configure['help']==True:
print header
config.usage_print(cfgstruct)
exit(0)
util.setupLogging(configure)
server=ChunkServer.ChunkServer()
gevent.spawn(server.heartBeat, confobj)
service=rpc.RpcService(server)
endpoint=(configure['address'], int(configure['port']))
framework=gevent.server.StreamServer(endpoint, service.handler)
framework.serve_forever()