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!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

39 lignes
1.2KB

  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)
  26. zfs_tag(name, args.tags)
  27. def command_volume_untag(args):
  28. zfs_untag(args.tags)