corosync.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. '''CTS: Cluster Testing System: corosync...
  2. '''
  3. __copyright__='''
  4. Copyright (c) 2010 Red Hat, Inc.
  5. '''
  6. # All rights reserved.
  7. #
  8. # Author: Angus Salkeld <asalkeld@redhat.com>
  9. #
  10. # This software licensed under BSD license, the text of which follows:
  11. #
  12. # Redistribution and use in source and binary forms, with or without
  13. # modification, are permitted provided that the following conditions are met:
  14. #
  15. # - Redistributions of source code must retain the above copyright notice,
  16. # this list of conditions and the following disclaimer.
  17. # - Redistributions in binary form must reproduce the above copyright notice,
  18. # this list of conditions and the following disclaimer in the documentation
  19. # and/or other materials provided with the distribution.
  20. # - Neither the name of the MontaVista Software, Inc. nor the names of its
  21. # contributors may be used to endorse or promote products derived from this
  22. # software without specific prior written permission.
  23. #
  24. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  28. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  31. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  32. # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  33. # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  34. # THE POSSIBILITY OF SUCH DAMAGE.
  35. import os
  36. import sys
  37. import time
  38. import socket
  39. import shutil
  40. import string
  41. import augeas
  42. from cts.CTS import ClusterManager
  43. from cts.CTSscenarios import ScenarioComponent
  44. from cts.CTS import RemoteExec
  45. from cts.CTSvars import CTSvars
  46. from cts.CTSaudits import ClusterAudit
  47. from cts.CTSaudits import LogAudit
  48. ###################################################################
  49. class CoroConfig(object):
  50. def __init__(self, corobase=None):
  51. self.base = "/files/etc/corosync/corosync.conf/"
  52. self.new_root = "/tmp/aug-root/"
  53. if corobase == None:
  54. self.corobase = os.getcwd() + "/.."
  55. else:
  56. self.corobase = corobase
  57. example = self.corobase + "/conf/corosync.conf.example"
  58. if os.path.isdir(self.new_root):
  59. shutil.rmtree (self.new_root)
  60. os.makedirs (self.new_root + "/etc/corosync")
  61. shutil.copy (example, self.new_root + "/etc/corosync/corosync.conf")
  62. self.aug = augeas.Augeas (root=self.new_root,
  63. loadpath=self.corobase + "/conf/lenses")
  64. self.original = {}
  65. # store the original values (of totem), so we can restore them in
  66. # apply_default_config()
  67. totem = self.aug.match('/files/etc/corosync/corosync.conf/totem/*')
  68. for c in totem:
  69. # /files/etc/corosync/corosync.conf/
  70. short_name = c[len(self.base):]
  71. self.original[short_name] = self.aug.get(c)
  72. interface = self.aug.match('/files/etc/corosync/corosync.conf/totem/interface/*')
  73. for c in interface:
  74. short_name = c[len(self.base):]
  75. self.original[short_name] = self.aug.get(c)
  76. def get (self, name):
  77. return self.aug.get (self.base + name)
  78. def set (self, name, value):
  79. token = self.aug.set (self.base + name, str(value))
  80. def save (self):
  81. self.aug.save()
  82. def get_filename(self):
  83. return self.new_root + "/etc/corosync/corosync.conf"
  84. ###################################################################
  85. class corosync_needle(ClusterManager):
  86. '''
  87. bla
  88. '''
  89. def __init__(self, Environment, randseed=None):
  90. ClusterManager.__init__(self, Environment, randseed)
  91. self.update({
  92. "Name" : "corosync(needle)",
  93. "StartCmd" : CTSvars.INITDIR+"/corosync start",
  94. "StopCmd" : CTSvars.INITDIR+"/corosync stop",
  95. "RereadCmd" : CTSvars.INITDIR+"/corosync reload",
  96. "StatusCmd" : CTSvars.INITDIR+"/corosync status %s",
  97. "DeadTime" : 30,
  98. "StartTime" : 15, # Max time to start up
  99. "StableTime" : 10,
  100. "BreakCommCmd" : "/usr/share/corosync/tests/net_breaker.sh BreakCommCmd %s",
  101. "FixCommCmd" : "/usr/share/corosync/tests/net_breaker.sh FixCommCmd %s",
  102. "Pat:We_stopped" : "%s.*Corosync Cluster Engine exiting with status.*",
  103. "Pat:They_stopped" : "%s.*Member left:.*%s.*",
  104. "Pat:They_dead" : "corosync:.*Node %s is now: lost",
  105. "Pat:Local_starting" : "%s.*started and ready to provide service.",
  106. "Pat:Local_started" : "%s.*started and ready to provide service.",
  107. "Pat:Master_started" : "%s.*Completed service synchronization, ready to provide service.",
  108. "Pat:Slave_started" : "%s.*Completed service synchronization, ready to provide service.",
  109. "Pat:ChildKilled" : "%s corosync.*Child process %s terminated with signal 9",
  110. "Pat:ChildRespawn" : "%s corosync.*Respawning failed child process: %s",
  111. "Pat:ChildExit" : "Child process .* exited",
  112. "Pat:DC_IDLE" : ".*A processor joined or left the membership and a new membership was formed.",
  113. # Bad news Regexes. Should never occur.
  114. "BadRegexes" : (
  115. r"ERROR:",
  116. r"CRIT:",
  117. r"Shutting down\.",
  118. r"Forcing shutdown\.",
  119. r"core dump",
  120. r"Could not bind AF_UNIX",
  121. r"Too many open files",
  122. ),
  123. "LogFileName" : Environment["LogFileName"],
  124. })
  125. self.start_cpg = True
  126. self.cpg_agent = {}
  127. self.confdb_agent = {}
  128. self.sam_agent = {}
  129. self.votequorum_agent = {}
  130. self.config = CoroConfig ()
  131. self.node_to_ip = {}
  132. self.new_config = {}
  133. self.new_config['service[1]/name'] = 'corosync_tst_sv2'
  134. self.new_config['service[1]/ver'] = '0'
  135. self.applied_config = {}
  136. for n in self.Env["nodes"]:
  137. ip = socket.gethostbyname(n)
  138. ips = ip.split('.')
  139. ips[3] = '0'
  140. ip_mask = '.'.join(ips)
  141. self.new_config['totem/interface/bindnetaddr'] = str(ip_mask)
  142. return
  143. def apply_default_config(self):
  144. for c in self.applied_config:
  145. if 'bindnetaddr' in c:
  146. continue
  147. elif not self.config.original.has_key(c):
  148. # new config option (non default)
  149. pass
  150. elif self.applied_config[c] is not self.config.original[c]:
  151. # reset to the original
  152. self.new_config[c] = self.config.original[c]
  153. if len(self.new_config) > 0:
  154. self.debug('applying default config')
  155. self.stopall()
  156. def apply_new_config(self):
  157. if len(self.new_config) > 0:
  158. self.debug('applying new config')
  159. self.stopall()
  160. self.startall()
  161. def install_all_config(self):
  162. tmp1 = {}
  163. sorted_keys = sorted(self.new_config.keys())
  164. for c in sorted_keys:
  165. self.log('configuring: ' + c + ' = '+ str(self.new_config[c]))
  166. self.config.set (c, self.new_config[c])
  167. self.applied_config[c] = self.new_config[c]
  168. tmp1[c] = self.new_config[c]
  169. for c in tmp1:
  170. del self.new_config[c]
  171. self.config.save()
  172. src_file = self.config.get_filename()
  173. for node in self.Env["nodes"]:
  174. self.rsh.cp(src_file, "%s:%s" % (node, "/etc/corosync/"))
  175. def install_config(self, node):
  176. # install gets new_config and installs it, then moves the
  177. # config to applied_config
  178. if len(self.new_config) > 0:
  179. self.install_all_config()
  180. def key_for_node(self, node):
  181. if not self.node_to_ip.has_key(node):
  182. self.node_to_ip[node] = socket.gethostbyname (node)
  183. return self.node_to_ip[node]
  184. def StartaCM(self, node, verbose=False):
  185. if not self.ShouldBeStatus.has_key(node):
  186. self.ShouldBeStatus[node] = "down"
  187. if self.ShouldBeStatus[node] != "down":
  188. return 1
  189. self.debug('starting corosync on : ' + node)
  190. ret = ClusterManager.StartaCM(self, node)
  191. if self.start_cpg:
  192. if self.cpg_agent.has_key(node):
  193. self.cpg_agent[node].restart()
  194. else:
  195. self.cpg_agent[node] = CpgTestAgent(node, self.Env)
  196. self.cpg_agent[node].start()
  197. if self.confdb_agent.has_key(node):
  198. self.confdb_agent[node].restart()
  199. if self.sam_agent.has_key(node):
  200. self.sam_agent[node].restart()
  201. # votequorum agent started as needed.
  202. if self.applied_config.has_key('quorum/provider'):
  203. if self.applied_config['quorum/provider'] is 'corosync_votequorum':
  204. if self.votequorum_agent.has_key(node):
  205. self.votequorum_agent[node].restart()
  206. else:
  207. self.votequorum_agent[node] = VoteQuorumTestAgent(node, self.Env)
  208. self.votequorum_agent[node].start()
  209. return ret
  210. def StopaCM(self, node, verbose=False):
  211. if self.ShouldBeStatus[node] != "up":
  212. return 1
  213. self.debug('stoping corosync on : ' + node)
  214. if self.cpg_agent.has_key(node):
  215. self.cpg_agent[node].stop()
  216. if self.sam_agent.has_key(node):
  217. self.sam_agent[node].stop()
  218. if self.votequorum_agent.has_key(node):
  219. self.votequorum_agent[node].stop()
  220. return ClusterManager.StopaCM(self, node)
  221. def test_node_CM(self, node):
  222. # 2 - up and stable
  223. # 1 - unstable
  224. # 0 - down
  225. out = self.rsh(node, self["StatusCmd"], 1)
  226. is_stopped = string.find(out, 'stopped')
  227. is_dead = string.find(out, 'dead')
  228. ret = (is_dead is -1 and is_stopped is -1)
  229. try:
  230. if ret:
  231. ret = 2
  232. if self.ShouldBeStatus[node] == "down":
  233. self.log(
  234. "Node status for %s is %s but we think it should be %s"
  235. % (node, "up", self.ShouldBeStatus[node]))
  236. else:
  237. if self.ShouldBeStatus[node] == "up":
  238. self.log(
  239. "Node status for %s is %s but we think it should be %s"
  240. % (node, "down", self.ShouldBeStatus[node]))
  241. except KeyError: pass
  242. if ret: self.ShouldBeStatus[node] = "up"
  243. else: self.ShouldBeStatus[node] = "down"
  244. return ret
  245. def StataCM(self, node):
  246. '''Report the status of corosync on a given node'''
  247. if self.test_node_CM(node) > 0:
  248. return 1
  249. else:
  250. return None
  251. def RereadCM(self, node):
  252. self.log('reloading corosync on : ' + node)
  253. return ClusterManager.RereadCM(self, node)
  254. def find_partitions(self):
  255. ccm_partitions = []
  256. return ccm_partitions
  257. def prepare(self):
  258. '''Finish the Initialization process. Prepare to test...'''
  259. self.partitions_expected = 1
  260. for node in self.Env["nodes"]:
  261. self.ShouldBeStatus[node] = ""
  262. self.unisolate_node(node)
  263. self.StataCM(node)
  264. def HasQuorum(self, node_list):
  265. # If we are auditing a partition, then one side will
  266. # have quorum and the other not.
  267. # So the caller needs to tell us which we are checking
  268. # If no value for node_list is specified... assume all nodes
  269. if not node_list:
  270. node_list = self.Env["nodes"]
  271. for node in node_list:
  272. if self.ShouldBeStatus[node] == "up":
  273. quorum = self.rsh(node, self["QuorumCmd"], 1)
  274. if string.find(quorum, "1") != -1:
  275. return 1
  276. elif string.find(quorum, "0") != -1:
  277. return 0
  278. else:
  279. self.log("WARN: Unexpected quorum test result from "+ node +":"+ quorum)
  280. return 0
  281. def Components(self):
  282. return None
  283. class ShmLeakAudit(ClusterAudit):
  284. def __init__(self, cm):
  285. self.CM = cm
  286. def name(self):
  287. return "ShmLeakAudit"
  288. def is_applicable(self):
  289. return 1
  290. def __call__(self):
  291. rc = 1
  292. for node in self.CM.Env["nodes"]:
  293. (res, lines) = self.CM.rsh(node, "/usr/share/corosync/tests/shm_leak_audit.sh", None)
  294. for line in lines:
  295. self.CM.log("%s leaked %s" % (node, line))
  296. rc = 0
  297. return rc
  298. ###################################################################
  299. class TestAgentComponent(ScenarioComponent):
  300. def __init__(self, Env):
  301. self.Env = Env
  302. def IsApplicable(self):
  303. '''Return TRUE if the current ScenarioComponent is applicable
  304. in the given LabEnvironment given to the constructor.
  305. '''
  306. return True
  307. def SetUp(self, CM):
  308. '''Set up the given ScenarioComponent'''
  309. self.CM = CM
  310. for node in self.Env["nodes"]:
  311. if not CM.StataCM(node):
  312. raise RuntimeError ("corosync not up")
  313. if self.CM.start_cpg:
  314. self.CM.cpg_agent[node] = CpgTestAgent(node, CM.Env)
  315. self.CM.cpg_agent[node].start()
  316. self.CM.confdb_agent[node] = ConfdbTestAgent(node, CM.Env)
  317. self.CM.confdb_agent[node].start()
  318. self.CM.sam_agent[node] = SamTestAgent(node, CM.Env)
  319. self.CM.sam_agent[node].start()
  320. # votequorum agent started as needed.
  321. if self.CM.applied_config.has_key('quorum/provider'):
  322. if CM.applied_config['quorum/provider'] is 'corosync_votequorum':
  323. self.CM.votequorum_agent[node] = VoteQuorumTestAgent(node, CM.Env)
  324. self.CM.votequorum_agent[node].start()
  325. return 1
  326. def TearDown(self, CM):
  327. '''Tear down (undo) the given ScenarioComponent'''
  328. self.CM = CM
  329. for node in self.Env["nodes"]:
  330. if self.CM.cpg_agent.has_key(node):
  331. self.CM.cpg_agent[node].stop()
  332. self.CM.confdb_agent[node].stop()
  333. self.CM.sam_agent[node].stop()
  334. if self.CM.votequorum_agent.has_key(node):
  335. self.CM.votequorum_agent[node].stop()
  336. ###################################################################
  337. class TestAgent(object):
  338. def __init__(self, binary, node, port, env=None):
  339. self.node = node
  340. self.node_address = None
  341. self.port = port
  342. self.sock = None
  343. self.binary = binary
  344. self.started = False
  345. self.rsh = RemoteExec(Env=env)
  346. self.func_name = None
  347. self.used = False
  348. self.env = env
  349. self.send_recv = False
  350. def restart(self):
  351. self.stop()
  352. self.start()
  353. def clean_start(self):
  354. if self.used or not self.status():
  355. self.env.debug('test agent: cleaning %s on node %s' % (self.binary, self.node))
  356. self.stop()
  357. self.start()
  358. def status(self):
  359. if not self.started:
  360. return False
  361. try:
  362. self.send (["are_you_ok_dude"])
  363. self.read ()
  364. self.started = True
  365. return True
  366. except RuntimeError, msg:
  367. self.started = False
  368. return False
  369. def start(self):
  370. '''Set up the given ScenarioComponent'''
  371. self.env.debug('test agent: starting %s on node %s' % (self.binary, self.node))
  372. self.sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
  373. ip = socket.gethostbyname(self.node)
  374. self.rsh(self.node, self.binary, synchronous=False)
  375. is_connected = False
  376. retries = 0
  377. while not is_connected:
  378. try:
  379. retries = retries + 1
  380. self.sock.connect ((ip, self.port))
  381. is_connected = True
  382. except socket.error, msg:
  383. if retries > 10:
  384. self.env.log("Tried connecting to %s on node %s %d times. %s" % (self.binary, self.node, retries, str(msg)))
  385. if retries > 30:
  386. raise RuntimeError("can't connect to " % self.binary)
  387. time.sleep(1)
  388. self.started = True
  389. self.used = False
  390. def stop(self):
  391. '''Tear down (undo) the given ScenarioComponent'''
  392. self.env.debug('test agent: stopping %s on node %s' % (self.binary, self.node))
  393. self.rsh(self.node, "killall " + self.binary + " 2>/dev/null")
  394. self.sock.close ()
  395. self.rsh(self.node, "killall -9 " + self.binary + " 2>/dev/null")
  396. self.started = False
  397. def kill(self):
  398. '''Tear down (undo) the given ScenarioComponent'''
  399. self.env.debug('test agent: killing %s on node %s' % (self.binary, self.node))
  400. self.rsh(self.node, "killall -9 " + self.binary + " 2>/dev/null")
  401. self.started = False
  402. def getpid(self):
  403. return self.rsh(self.node, 'pidof ' + self.binary, 1)
  404. def send (self, args):
  405. if not self.started:
  406. self.start()
  407. real_msg = str (len (args))
  408. for a in args:
  409. a_str = str(a)
  410. real_msg += ":" + str (len (a_str)) + ":" + a_str
  411. real_msg += ";"
  412. sent = 0
  413. try:
  414. sent = self.sock.send (real_msg)
  415. except socket.error, msg:
  416. self.env.log("send(%s): %s; error: %s" % (self.node, real_msg, msg))
  417. if sent == 0:
  418. raise RuntimeError ("socket connection broken")
  419. self.used = True
  420. def __getattribute__(self,name):
  421. try:
  422. return object.__getattribute__(self, name)
  423. except:
  424. self.func_name = name
  425. if self.send_recv:
  426. return self.send_recv_dynamic
  427. else:
  428. return self.send_dynamic
  429. def send_recv_dynamic (self, *args):
  430. self.send_dynamic (args)
  431. try:
  432. res = self.read ()
  433. except RuntimeError, msg:
  434. res = None
  435. self.env.log("send_recv_dynamic: %s(); error: %s" % (self.func_name, msg))
  436. return res
  437. def send_dynamic (self, *args):
  438. if not self.started:
  439. self.start()
  440. # number of args+func
  441. real_msg = str (len (args) + 1) + ":" + str(len(self.func_name)) + ":" + self.func_name
  442. for a in args:
  443. a_str = str(a)
  444. real_msg += ":" + str (len (a_str)) + ":" + a_str
  445. real_msg += ";"
  446. sent = 0
  447. try:
  448. sent = self.sock.send (real_msg)
  449. except socket.error, msg:
  450. self.env.log("send_dynamic(%s): %s; error: %s" % (self.node, real_msg, msg))
  451. if sent == 0:
  452. raise RuntimeError ("socket connection broken")
  453. self.used = True
  454. def read (self):
  455. msg = self.sock.recv (4096)
  456. if msg == '':
  457. raise RuntimeError("socket connection broken")
  458. return msg
  459. class CpgConfigEvent:
  460. def __init__(self, msg):
  461. info = msg.split(',')
  462. self.group_name = info[0]
  463. self.node_id = info[1]
  464. self.node = None
  465. self.pid = info[2]
  466. if "left" in info[3]:
  467. self.is_member = False
  468. else:
  469. self.is_member = True
  470. def __str__ (self):
  471. str = self.group_name + "," + self.node_id + "," + self.pid + ","
  472. if self.is_member:
  473. return str + "joined"
  474. else:
  475. return str + "left"
  476. ###################################################################
  477. class CpgTestAgent(TestAgent):
  478. def __init__(self, node, Env=None):
  479. TestAgent.__init__(self, "cpg_test_agent", node, 9034, env=Env)
  480. self.initialized = False
  481. self.nodeid = None
  482. def start(self):
  483. if not self.started:
  484. TestAgent.start(self)
  485. self.cpg_initialize()
  486. self.used = False
  487. def stop(self):
  488. try:
  489. if self.started:
  490. self.cpg_finalize()
  491. except RuntimeError, msg:
  492. # if cpg_agent is down, we are not going to stress
  493. self.env.debug("CpgTestAgent::cpg_finalize() - %s" % msg)
  494. TestAgent.stop(self)
  495. def cpg_local_get(self):
  496. if self.nodeid == None:
  497. self.send (["cpg_local_get"])
  498. self.nodeid = self.read ()
  499. return self.nodeid
  500. def record_config_events(self, truncate=True):
  501. if truncate:
  502. self.send (["record_config_events", "truncate"])
  503. else:
  504. self.send (["record_config_events", "append"])
  505. return self.read ()
  506. def read_config_event(self):
  507. self.send (["read_config_event"])
  508. msg = self.read ()
  509. if "None" in msg:
  510. return None
  511. else:
  512. return CpgConfigEvent(msg)
  513. def read_messages(self, atmost):
  514. self.send (["read_messages", atmost])
  515. msg = self.read ()
  516. if "None" in msg:
  517. return None
  518. else:
  519. return msg
  520. def context_test(self):
  521. self.send (["context_test"])
  522. return self.read ()
  523. ###################################################################
  524. class ConfdbTestAgent(TestAgent):
  525. def __init__(self, node, Env=None):
  526. TestAgent.__init__(self, "confdb_test_agent", node, 9035, env=Env)
  527. self.initialized = False
  528. self.nodeid = None
  529. self.send_recv = True
  530. ###################################################################
  531. class SamTestAgent(TestAgent):
  532. def __init__(self, node, Env=None):
  533. TestAgent.__init__(self, "sam_test_agent", node, 9036, env=Env)
  534. self.initialized = False
  535. self.nodeid = None
  536. self.send_recv = True
  537. ###################################################################
  538. class VoteQuorumTestAgent(TestAgent):
  539. def __init__(self, node, Env=None):
  540. TestAgent.__init__(self, "votequorum_test_agent", node, 9037, env=Env)
  541. self.initialized = False
  542. self.nodeid = None
  543. self.send_recv = True
  544. def start(self):
  545. if not self.started:
  546. TestAgent.start(self)
  547. self.init()
  548. self.used = False
  549. AllAuditClasses = []
  550. AllAuditClasses.append(LogAudit)
  551. AllAuditClasses.append(ShmLeakAudit)
  552. def CoroAuditList(cm):
  553. result = []
  554. for auditclass in AllAuditClasses:
  555. a = auditclass(cm)
  556. if a.is_applicable():
  557. result.append(a)
  558. return result