Example #1
0
File: tasks.py Project: LBragg/TS
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()
Example #2
0
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)
Example #3
0
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)
Example #4
0
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
Example #5
0
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
Example #6
0
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
Example #7
0
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
Example #8
0
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