def update_diskusage(fs): if os.path.exists(fs.filesPrefix): try: fs.percentfull=percent_full(fs.filesPrefix) fs.save() #logger.debug("Used space: %s %0.2f%%" % (fs.filesPrefix,fs.percentfull)) except Exception as e: logger.warning ("could not update size of %s" % fs.filesPrefix) logger.error(e) else: logger.warning("directory does not exist on filesystem: %s" % fs.filesPrefix) fs.percentfull=0 fs.save()
def update_diskusage(fs): if os.path.exists(fs.filesPrefix): try: fs.percentfull = percent_full(fs.filesPrefix) except: logger.exception("Failed to compute percent full") fs.percentfull = None if fs.percentfull is not None: fs.save() #logger.debug("Used space: %s %0.2f%%" % (fs.filesPrefix,fs.percentfull)) else: logger.warning ("could not determine size of %s" % fs.filesPrefix) else: logger.warning("directory does not exist on filesystem: %s" % fs.filesPrefix)
def update_diskusage(fs): if os.path.exists(fs.filesPrefix): try: fs.percentfull = percent_full(fs.filesPrefix) except: logger.exception("Failed to compute percent full") fs.percentfull = None if fs.percentfull is not None: fs.save() #logger.debug("Used space: %s %0.2f%%" % (fs.filesPrefix,fs.percentfull)) else: logger.warning("could not determine size of %s" % fs.filesPrefix) else: logger.warning("directory does not exist on filesystem: %s" % fs.filesPrefix)
def _partitions(file_servers, report_storages): partitions = [] for fs in file_servers: if os.path.exists(fs['filesPrefix']): partitions.append({ 'path': fs['filesPrefix'], 'diskusage': fs['percentfull'], 'devid': getdeviceid(fs['filesPrefix']), }) for rs in report_storages: if os.path.exists(rs['dirPath']): partitions.append({ 'path': rs['dirPath'], 'diskusage': rs.get('percentfull', percent_full(rs['dirPath'])), 'devid': getdeviceid(rs['dirPath']), }) return partitions
def _partitions(file_servers,report_storages): partitions = [] for fs in file_servers: if os.path.exists(fs['filesPrefix']): partitions.append( { 'path':fs['filesPrefix'], 'diskusage':fs['percentfull'], 'devid':getdeviceid(fs['filesPrefix']), } ) for rs in report_storages: if os.path.exists(rs['dirPath']): partitions.append( { 'path':rs['dirPath'], 'diskusage':rs.get('percentfull',percent_full(rs['dirPath'])), 'devid':getdeviceid(rs['dirPath']), } ) return partitions
def _partitions(file_servers, report_storages): '''Returns list of partitions''' partitions = [] for fileserver in file_servers: if os.path.exists(fileserver['filesPrefix']): partitions.append( { 'path':fileserver['filesPrefix'], 'diskusage':fileserver['percentfull'], 'devid':getdeviceid(fileserver['filesPrefix']), } ) for reportstorage in report_storages: if os.path.exists(reportstorage['dirPath']): partitions.append( { 'path':reportstorage['dirPath'], 'diskusage':reportstorage.get('percentfull',percent_full(reportstorage['dirPath'])), 'devid':getdeviceid(reportstorage['dirPath']), } ) return partitions
def _partitions(file_servers, report_storages): '''Returns list of partitions''' partitions = [] for fileserver in file_servers: if os.path.exists(fileserver['filesPrefix']): partitions.append( { 'path': fileserver['filesPrefix'], 'diskusage': fileserver['percentfull'], 'devid': getdeviceid(fileserver['filesPrefix']), } ) for reportstorage in report_storages: if os.path.exists(reportstorage['dirPath']): partitions.append( { 'path': reportstorage['dirPath'], 'diskusage': reportstorage.get('percentfull', percent_full(reportstorage['dirPath'])), 'devid': getdeviceid(reportstorage['dirPath']), } ) return partitions
def _partitions(file_servers, report_storages): """Returns list of partitions""" partitions = [] for fileserver in file_servers: if os.path.exists(fileserver["filesPrefix"]): partitions.append({ "path": fileserver["filesPrefix"], "diskusage": fileserver["percentfull"], "devid": getdeviceid(fileserver["filesPrefix"]), }) for reportstorage in report_storages: if os.path.exists(reportstorage["dirPath"]): partitions.append({ "path": reportstorage["dirPath"], "diskusage": reportstorage.get("percentfull", percent_full(reportstorage["dirPath"])), "devid": getdeviceid(reportstorage["dirPath"]), }) return partitions