Example #1
0
def sections():
    if not args.verbose:
        for i in settings.sections:
            print(i)
    else:
        for i in settings.sections:
            x = Section(settings.config[i])
            r = 'readonly' if x.readonly else 'writable'
            print(x.name + ':',
                  str(x.snapshot_count()) + '/' + str(x.quota),
                  r, 'from', x.subvolume)
Example #2
0
def subvolume_sections():
    sub = args.subvolume_sections
    if sub != '/':  # Prevent strip filesystem root.
        sub = sub.rstrip('/')

    found = False
    for i in settings.sections:
        if sub == settings.config[i]['subvolume']:
            found = True
            x = Section(settings.config[i])
            if not args.verbose:
                print(x.name)
            else:
                print(x.name + ':', x.snapshot_count())
    if not found:
        clean_exit('No section manages the subvolume: ' + sub, BADSUB)