def getFileServer(self,name_or_ip,**kw): """ Retrieve Fileserver Object by hostname or IP or uuid and update DBCache, if enabled """ self.Logger.debug("Entering getFileServer with kw=%s" % kw) uuid=kw.get("uuid","") cached=kw.get("cached","") _user=kw.get("_user","") DNSInfo=afs.LookupUtil[self._CFG.CELL_NAME].getDNSInfo(name_or_ip) if DNSInfo["ipaddrs"][0] in self._CFG.ignoreIPList : return None if uuid != "" : if uuid != afs.LookupUtil[self._CFG.CELL_NAME].getFSUUID(name_or_ip,self._CFG, cached) : uuid=afs.LookupUtil[self._CFG.CELL_NAME].getFSUUID(name_or_ip,self._CFG, cached) else : uuid=afs.LookupUtil[self._CFG.CELL_NAME].getFSUUID(name_or_ip,self._CFG, cached) if cached : this_FileServer=self.DBManager.getFromCache(FileServer,uuid=uuid) if this_FileServer == None : # it's not in the cache. Log it and get it from live-system self.Logger.warn("getFileServer: FS with uuid=%s not in DB." % uuid) else : this_FileServer.parts = self.getPartitionsByUUID(uuid,name_or_ip=this_FileServer.servernames[0],cached=cached) return this_FileServer this_FileServer = FileServer() # get DNS-info about server DNSInfo = afs.LookupUtil[self._CFG.CELL_NAME].getDNSInfo(name_or_ip) this_FileServer.servernames = DNSInfo["names"] this_FileServer.ipaddrs = DNSInfo["ipaddrs"] # UUID this_FileServer.uuid=uuid this_FileServer.version,this_FileServer.builddate=self._rxDAO.getVersionandBuildDate(this_FileServer.servernames[0], 7000, _cfg=self._CFG, _user=_user) # Partitions this_FileServer.parts = self.getPartitions(name_or_ip,cached=cached) if self._CFG.DB_CACHE : self.DBManager.setIntoCache(FileServer,this_FileServer,uuid=this_FileServer.uuid) for p in this_FileServer.parts : part=Partition() self.Logger.debug("Setting part to %s" % this_FileServer.parts[p]) part.setByDict(this_FileServer.parts[p]) part.serv_uuid=this_FileServer.uuid self.DBManager.setIntoCache(Partition,part,serv_uuid=this_FileServer.uuid,name=p) # Projects # these we get directly from the DB_Cache this_FileServer.projects = [] self.Logger.debug("getFileServerByUUID: returning: %s" % this_FileServer) return this_FileServer