def get_archive_report(params): backupFreeSpace = None bkpPerFree = '' dev = devices.disk_report() removeOnly = False if params['BACKUP_DRIVE_PATH'] != 'None': for d in dev: if d.get_path() == params['BACKUP_DRIVE_PATH']: bkpPerFree = d.get_free_space() backupFreeSpace = int(d.get_available()*1024) if backupFreeSpace < last_exp_size: removeOnly=True #log.info('Archive drive is full, entering Remove Only Mode.') return backupFreeSpace, bkpPerFree, removeOnly else: removeOnly = True #log.info('No archive drive, entering Remove Only Mode.') return backupFreeSpace, bkpPerFree, removeOnly
def get_archive_report(params): backupFreeSpace = None bkpPerFree = '' dev = devices.disk_report() removeOnly = False if params['BACKUP_DRIVE_PATH'] != 'None': for d in dev: if d.get_path() == params['BACKUP_DRIVE_PATH']: bkpPerFree = d.get_free_space() backupFreeSpace = int(d.get_available() * 1024) if backupFreeSpace < last_exp_size: removeOnly = True #log.info('Archive drive is full, entering Remove Only Mode.') return backupFreeSpace, bkpPerFree, removeOnly else: removeOnly = True #log.info('No archive drive, entering Remove Only Mode.') return backupFreeSpace, bkpPerFree, removeOnly
def get_disk_usage(): disk_usage = [] paths = [] for fs_path, percentfull in FileServer.objects.order_by('pk').values_list('filesPrefix', 'percentfull'): if os.path.exists(fs_path): disk_usage.append((fs_path, percentfull)) paths.append(fs_path) mounted = is_mounted(os.path.realpath(fs_path)) if mounted: paths.append(mounted) archive_folders = devices.to_media(devices.disk_report()) for bdir, name in archive_folders: mounted = is_mounted(bdir) if mounted and bdir not in paths: disk_usage.append((bdir, get_disk_attributes_gb(bdir).get('percentfull'))) paths.append(bdir) return disk_usage
def get_disk_usage(): disk_usage = [] paths = [] for fs_path, percentfull in FileServer.objects.order_by("pk").values_list( "filesPrefix", "percentfull"): if os.path.exists(fs_path): disk_usage.append((fs_path, percentfull)) paths.append(fs_path) mounted = is_mounted(os.path.realpath(fs_path)) if mounted: paths.append(mounted) archive_folders = devices.to_media(devices.disk_report()) for bdir, name in archive_folders: mounted = is_mounted(bdir) if mounted and bdir not in paths: disk_usage.append( (bdir, get_disk_attributes_gb(bdir).get("percentfull"))) paths.append(bdir) return disk_usage
def get_dir_choices(): basicChoice = [(None, 'None')] for choice in devices.to_media(devices.disk_report()): basicChoice.append(choice) return tuple(basicChoice)