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.

snapshot.py 531B

il y a 4 ans
123456789101112131415161718
  1. from zfs import *
  2. def new_snapshot(base, fun, name):
  3. type_ = zfs_get_type(base)
  4. if type_ != 'snapshot':
  5. raise ValueError('Provided base dataset is not a snapshot')
  6. if '/' not in name:
  7. root = '/'.join(base.split('/')[:-1])
  8. name = root + '/' + name
  9. zfs_run(['zfs', 'clone', base, name])
  10. try:
  11. fun()
  12. except:
  13. zfs_run(['zfs', 'destroy', name])
  14. raise
  15. zfs_run(['zfs', 'set', 'readonly=on', name])
  16. zfs_run(['zfs', 'snapshot', name + '@1'])