From a5397b366d79314828dc53bb70e8b51478c2c7b0 Mon Sep 17 00:00:00 2001 From: rread Date: Tue, 31 Dec 2002 00:53:20 +0000 Subject: [PATCH] * support mutlitple mds with one uuid (539) lmc --add mds --mds mds1 --node hostA ... lmc --add mds --mds mds1 --node hostB ... Creates two different mdsdev in the config, and one mds. The lovconfig reference is now attached to the mds service instead of the node, so both mdsdevs can configure the LOVs. Needless to say, the xml format has changed yet again, so regenerate those configs. --- lustre/utils/lconf.in | 108 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 80 insertions(+), 28 deletions(-) diff --git a/lustre/utils/lconf.in b/lustre/utils/lconf.in index 338609e..4cbfe3c 100755 --- a/lustre/utils/lconf.in +++ b/lustre/utils/lconf.in @@ -50,8 +50,10 @@ def usage(): print """usage: lconf config.xml config.xml Lustre configuration in xml format. ---get URL to fetch a config file +--ldapurl LDAP server URL, eg. ldap://localhost +--config Cluster config name used for LDAP query --node Load config for +--select service=nodeA,service2=nodeB U -d | --cleanup Cleans up config. (Shutdown) -f | --force Forced unmounting and/or obd detach during cleanup -v | --verbose Print system commands as they are run @@ -73,7 +75,7 @@ config.xml Lustre configuration in xml format. 30 - obd, mdd 40 - mds, ost 50 - mdc, osc - 60 - lov, lovconfig + 60 - lov 70 - mountpoint, echo_client --lustre=src_dir Base directory of lustre sources. This parameter will cause lconf to load modules from a source tree. @@ -116,6 +118,7 @@ class Config: self._recovery_upcall = '' self._ldapurl = '' self._config_name = '' + self._select = {} def verbose(self, flag = None): if flag: self._verbose = flag @@ -201,6 +204,19 @@ class Config: if val: self._config_name = val return self._config_name + def init_select(self, arg): + # arg = "service=nodeA,service2=nodeB" + list = string.split(arg, ',') + for entry in list: + srv, node = string.split(entry, '=') + self._select[srv] = node + + def select(self, srv): + if self._select.has_key(srv): + return self._select[srv] + return None + + config = Config() # ============================================================ @@ -730,7 +746,6 @@ class Module: msg = string.join(map(str,args)) print self.module_name + ":", self.name, self.uuid, msg - def lookup_server(self, srv_uuid): """ Lookup a server's network information """ net = self.db.get_ost_net(srv_uuid) @@ -990,6 +1005,7 @@ class LOV(Module): class LOVConfig(Module): def __init__(self,db): Module.__init__(self, 'LOVConfig', db) + self.lov_uuid = self.db.get_first_ref('lov') l = self.db.lookup(self.lov_uuid) self.lov = LOV(l) @@ -1006,13 +1022,17 @@ class LOVConfig(Module): #nothing to do here pass - -class MDS(Module): +class MDSDEV(Module): def __init__(self,db): - Module.__init__(self, 'MDS', db) + Module.__init__(self, 'MDSDEV', db) self.devname = self.db.get_val('devpath','') self.size = self.db.get_val_int('devsize', 0) self.fstype = self.db.get_val('fstype', '') + # overwrite the orignal MDSDEV name and uuid with the MDS name and uuid + self.uuid = self.db.get_first_ref('mds') + mds = self.db.lookup(self.uuid) + self.name = mds.getName() + self.lovconfig_uuids = mds.get_refs('lovconfig') # FIXME: if fstype not set, then determine based on kernel version self.format = self.db.get_val('autoformat', "no") if self.fstype == 'extN': @@ -1031,6 +1051,11 @@ class MDS(Module): setup ="") lctl.newdev(attach="mds %s %s" % (self.name, self.uuid), setup ="%s %s" %(blkdev, self.fstype)) + for uuid in self.lovconfig_uuids: + db = self.db.lookup(uuid) + lovconfig = LOVConfig(db) + lovconfig.prepare() + def cleanup(self): if is_prepared('MDT_UUID'): try: @@ -1048,29 +1073,37 @@ class MDS(Module): # Builds itself from an MDS node class MDC(Module): def __init__(self,db): - self.mds = MDS(db) + self.mds_uuid = db.getUUID() + self.mds_name = db.getName() self.db = db + node_name = config.select(self.mds_name) + if node_name: + self.mdd_uuid = self.db.get_mdd(node_name, self.mds_uuid) + else: + self.mdd_uuid = db.get_first_ref('active') + if not self.mdd_uuid: + panic("No MDSDEV found for MDS service:", self.mds_name) self.module_name = 'MDC' self.kmodule_list = [] self._server = None self._connected = 0 host = socket.gethostname() - self.name = 'MDC_%s' % (self.mds.name) + self.name = 'MDC_%s' % (self.mds_name) self.uuid = '%s_%05x_%05x' % (self.name, int(random.random() * 1048576), int(random.random() * 1048576)) - self.lookup_server(self.mds.uuid) + self.lookup_server(self.mdd_uuid) self.add_lustre_module('mdc', 'mdc') def prepare(self): if is_prepared(self.uuid): return - self.info(self.mds.uuid) + self.info(self.mds_uuid) srv = self.get_server() lctl.connect(srv.net_type, srv.nid, srv.port, srv.uuid, srv.send_mem, srv.recv_mem) lctl.newdev(attach="mdc %s %s" % (self.name, self.uuid), - setup ="%s %s" %(self.mds.uuid, srv.uuid)) + setup ="%s %s" %(self.mds_uuid, srv.uuid)) class OBD(Module): def __init__(self, db): @@ -1079,7 +1112,7 @@ class OBD(Module): self.devname = self.db.get_val('devpath', '') self.size = self.db.get_val_int('devsize', 0) self.fstype = self.db.get_val('fstype', '') - self.active_target = self.db.get_val('activetarget') + self.active_target = self.db.get_first_ref('active') # FIXME: if fstype not set, then determine based on kernel version self.format = self.db.get_val('autoformat', 'yes') if self.fstype == 'extN': @@ -1111,8 +1144,8 @@ class OBD(Module): class COBD(Module): def __init__(self, db): Module.__init__(self, 'COBD', db) - self.real_uuid = self.db.get_first_ref('real_obd') - self.cache_uuid = self.db.get_first_ref('cache_obd') + self.real_uuid = self.db.get_first_ref('realobd') + self.cache_uuid = self.db.get_first_ref('cacheobd') self.add_lustre_module('cobd' , 'cobd') # need to check /proc/mounts and /etc/mtab before @@ -1305,7 +1338,7 @@ class LustreDB: """ lookup returns a new LustreDB instance""" return self._lookup_by_uuid(uuid) - def lookup_name(self, name, class_name): + def lookup_name(self, name, class_name = ""): """ lookup returns a new LustreDB instance""" return self._lookup_by_name(name, class_name) @@ -1381,11 +1414,11 @@ class LustreDB: ret = 20 elif type in ('obd', 'mdd', 'cobd'): ret = 30 - elif type in ('mds','ost'): + elif type in ('mdsdev','ost'): ret = 40 elif type in ('mdc','osc'): ret = 50 - elif type in ('lov', 'lovconfig'): + elif type in ('lov',): ret = 60 elif type in ('mountpoint', 'echoclient'): ret = 70 @@ -1411,6 +1444,24 @@ class LustreDB: list.sort() return list + # Find the mdsdev attached to node_name that points to + # mds_uuid + # node->profiles->mdsdev_refs->mds + def get_mdd(self, node_name, mds_uuid): + node_db = self.lookup_name(node_name) + if not node_db: + return None + prof_list = node_db.get_refs('profile') + for prof_uuid in prof_list: + prof_db = node_db.lookup(prof_uuid) + mdd_list = prof_db.get_refs('mdsdev') + for mdd_uuid in mdd_list: + mdd = self.lookup(mdd_uuid) + if mdd.get_first_ref('mds') == mds_uuid: + return mdd_uuid + return None + + class LustreDB_XML(LustreDB): def __init__(self, dom, root_node): # init xmlfile @@ -1771,8 +1822,6 @@ def startService(db, module_flag): n = LDLM(db) elif type == 'lov': n = LOV(db) - elif type == 'lovconfig': - n = LOVConfig(db) elif type == 'network': n = Network(db) elif type == 'obd': @@ -1781,8 +1830,8 @@ def startService(db, module_flag): n = COBD(db) elif type == 'ost': n = OST(db) - elif type == 'mds': - n = MDS(db) + elif type == 'mdsdev': + n = MDSDEV(db) elif type == 'osc': n = VOSC(db) elif type == 'mdc': @@ -1883,7 +1932,7 @@ def parse_cmdline(argv): "help", "node=", "nomod", "nosetup", "dump=", "force", "minlevel=", "maxlevel=", "timeout=", "recovery_upcall=", - "ldapurl=", "config="] + "ldapurl=", "config=", "select="] opts = [] args = [] @@ -1921,18 +1970,21 @@ def parse_cmdline(argv): config.dump_file(a) if o in ("-f", "--force"): config.force(1) - if o in ("--minlevel",): + if o == "--minlevel": config.minlevel(a) - if o in ("--maxlevel",): + if o == "--maxlevel": config.maxlevel(a) - if o in ("--timeout",): + if o == "--timeout": config.timeout(a) - if o in ("--recovery_upcall",): + if o == "--recovery_upcall": config.recovery_upcall(a) - if o in ("--ldapurl",): + if o == "--ldapurl": config.ldapurl(a) - if o in ("--config",): + if o == "--config": config.config_name(a) + if o == "--select": + config.init_select(a) + return args def fetch(url): -- 1.8.3.1