def getFSUUID(self,name_or_ip,_user="",cached=True): """ returns UUID of a fileserver, which is used as key for server-entries in other tables. This does not silently update the Cache """ if cached : # local Cache first if name_or_ip in self.localCache["FSUUIDs"].keys() : return self.localCache["FSUUIDs"][name_or_ip] else : name_or_ip =self.getDNSInfo(name_or_ip)["names"][0] if name_or_ip in self.localCache["FSUUIDs"].keys() : return self.localCache["FSUUIDs"][name_or_ip] # then DB if self._CFG.DB_CACHE: from DBManager import DBManager from afs.model.FileServer import FileServer self.Logger.debug("looking up FSUUID in DB_Cache for serv=%s" % name_or_ip) DNSInfo=self.getDNSInfo(name_or_ip) thisDBManager=DBManager(self._CFG) fs=thisDBManager.getFromCacheByListElement(FileServer,FileServer.servernames_js,DNSInfo["names"][0]) if fs != None : # store it in localCache self.localCache["FSUUIDs"][name_or_ip] = fs.uuid return fs.uuid # not found in local cache and not in DB Cache, get it from live-system from afs.dao.VLDbDAO import VLDbDAO self.Logger.debug("getFSUUID: called with %s" % name_or_ip) DNSInfo=self.getDNSInfo(name_or_ip) uuid="" _vlDAO=VLDbDAO() try : uuid=_vlDAO.getFsUUID(DNSInfo["names"][0],_user=_user,_cfg=self._CFG) except : return None # store it in localCache self.localCache["FSUUIDs"][name_or_ip] = uuid return uuid