IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

1234567891011121314151617181920212223242526272829303132333435363738
  1. from .misc import random_sha256_hexdigest
  2. from .zfs import *
  3. from tabulate import tabulate
  4. def command_volume_create(args):
  5. sha256 = random_sha256_hexdigest()
  6. poolname = zfs_poolname()
  7. for pre in range(7, 64):
  8. name = poolname + '/focker/volumes/' + sha256[:pre]
  9. if not zfs_exists(name):
  10. break
  11. zfs_run(['zfs', 'create', '-o', 'focker:sha256=' + sha256, name])
  12. zfs_tag(name, args.tags)
  13. def command_volume_prune(args):
  14. zfs_prune(focker_type='volume')
  15. def command_volume_list(args):
  16. poolname = zfs_poolname()
  17. lst = zfs_parse_output(['zfs', 'list', '-o', 'name,refer,focker:sha256,focker:tags,mountpoint', '-H', '-r', poolname + '/focker/volumes'])
  18. lst = list(filter(lambda a: a[2] != '-', lst))
  19. lst = list(map(lambda a: [ a[3], a[1],
  20. a[2] if args.full_sha256 else a[2][:7],
  21. a[4] ], lst))
  22. print(tabulate(lst, headers=['Tags', 'Size', 'SHA256', 'Mountpoint']))
  23. def command_volume_tag(args):
  24. name, _ = zfs_find(args.reference, focker_type='volume')
  25. zfs_untag(args.tags, focker_type='volume')
  26. zfs_tag(name, args.tags)
  27. def command_volume_untag(args):
  28. zfs_untag(args.tags, focker_type='volume')