#
# Copyright (C) 2002 Cluster File Systems, Inc.
# Author: Robert Read <rread@clusterfs.com>
-
# This file is part of Lustre, http://www.lustre.org.
#
# Lustre is free software; you can redistribute it and/or
# (the /dev/loop* nodes need to be created beforehand)
MAX_LOOP_DEVICES = 256
+first_cleanup_error = 0
+def cleanup_error(rc):
+ global first_cleanup_error
+ if not first_cleanup_error:
+ first_cleanup_error = rc
+
def usage():
print """usage: lconf config.xml
except CommandError, e:
log(self.module_name, "disconnect failed: ", self.name)
e.dump()
+ cleanup_error(e.rc)
try:
lctl.cleanup(self.name, self.uuid)
except CommandError, e:
log(self.module_name, "cleanup failed: ", self.name)
e.dump()
+ cleanup_error(e.rc)
def add_module(self, dev_dir, modname):
"""Append a module to list of modules to load."""
lo = get_attr(r, 'lo')
hi = get_attr(r,'hi', '')
lctl.add_route(net_type, gw, lo, hi)
- if self.net_type == 'tcp' and hi == '':
+ if net_type == 'tcp' and net_type == self.net_type and hi == '':
srv = nid2server(self.dom_node.parentNode.parentNode, lo)
if not srv:
panic("no server for nid", lo)
except CommandError, e:
print "disconnect failed: ", self.name
e.dump()
+ cleanup_error(e.rc)
try:
lctl.del_route(self.net_type, self.nid, lo, hi)
except CommandError, e:
print "del_route failed: ", self.name
e.dump()
+ cleanup_error(e.rc)
try:
lctl.cleanup("RPCDEV", "")
except CommandError, e:
print "cleanup failed: ", self.name
e.dump()
+ cleanup_error(e.rc)
try:
lctl.disconnectAll(self.net_type)
except CommandError, e:
print "disconnectAll failed: ", self.name
e.dump()
+ cleanup_error(e.rc)
if self.net_type == 'tcp':
# yikes, this ugly! need to save pid in /var/something
run("killall acceptor")
panic('osc not found:', osc_uuid)
Module.cleanup(self)
cleanup_mdc(self.dom_node.parentNode, self.mds_uuid)
+
+
def load_module(self):
for osc_uuid in self.devlist:
osc = lookup(self.dom_node.parentNode, osc_uuid)
else:
panic('osc not found:', osc_uuid)
Module.load_module(self)
+
+
def cleanup_module(self):
Module.cleanup_module(self)
for osc_uuid in self.devlist:
self.info(self.obd_uuid, self.ost_uuid)
r = find_route(srv)
if r:
- lctl.del_route_host(r[0], srv.uuid, r[1], r[2])
+ try:
+ lctl.del_route_host(r[0], srv.uuid, r[1], r[2])
+ except CommandError, e:
+ print "del_route failed: ", self.name
+ e.dump()
+ cleanup_error(e.rc)
Module.cleanup(self)
short_opts = "hdnv"
long_opts = ["ldap", "reformat", "lustre=", "verbose", "gdb",
"portals=", "makeldiff", "cleanup", "noexec",
- "help", "node=", "get=", "nomod", "nosetup",
+ "help", "node=", "nomod", "nosetup",
"dump="]
opts = []
args = []
config.reformat(1)
if o == "--node":
config.node(a)
- if o == "--get":
- config.url(a)
if o == "--gdb":
config.gdb(1)
if o == "--nomod":
print e
except CommandError, e:
e.dump()
+ sys.exit(e.rc)
+
+ if first_cleanup_error:
+ sys.exit(first_cleanup_error)
+2