diff options
-rwxr-xr-x | snap.py | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -24,14 +24,14 @@ def waitchildren(): | |||
24 | children.remove(waitpid) | 24 | children.remove(waitpid) |
25 | 25 | ||
26 | 26 | ||
27 | def borg_lv(lv, size_percent, target, archive_prefix, dry_run, **args): | 27 | def borg_lv(lv, target, archive_prefix, dry_run, **args): |
28 | vgp = lv.split('/') | 28 | vgp = lv.split('/') |
29 | lvn = vgp[-1] | 29 | lvn = vgp[-1] |
30 | snn = f'{lvn}_snap_{datetime.utcnow().strftime("%Y%m%dT%H%MZ")}' | 30 | snn = f'{lvn}_snap_{datetime.utcnow().strftime("%Y%m%dT%H%MZ")}' |
31 | sn = "/".join([*vgp[:-1], snn]) | 31 | sn = "/".join([*vgp[:-1], snn]) |
32 | 32 | ||
33 | try: | 33 | try: |
34 | subprocess.run(['lvcreate', f'-l{size_percent}%ORIGIN', '-s', '-n', snn, lv], stdin=subprocess.DEVNULL, check=True) | 34 | subprocess.run(['lvcreate', f'-l100%FREE', '-s', '-n', snn, lv], stdin=subprocess.DEVNULL, check=True) |
35 | 35 | ||
36 | creation_time = None | 36 | creation_time = None |
37 | with subprocess.Popen(['lvs', '--reportformat=json', '-olv_time', sn], stdout=subprocess.PIPE) as proc: | 37 | with subprocess.Popen(['lvs', '--reportformat=json', '-olv_time', sn], stdout=subprocess.PIPE) as proc: |
@@ -105,7 +105,6 @@ def main(): | |||
105 | 105 | ||
106 | parser = argparse.ArgumentParser() | 106 | parser = argparse.ArgumentParser() |
107 | parser.add_argument('lv', metavar='LV') | 107 | parser.add_argument('lv', metavar='LV') |
108 | parser.add_argument('--size-percent', metavar='PERCENT', type = float, default=10) | ||
109 | parser.add_argument('--target', metavar='REPO', default='borg.vidhar:.') | 108 | parser.add_argument('--target', metavar='REPO', default='borg.vidhar:.') |
110 | parser.add_argument('--archive-prefix', metavar='REPO', default='yggdrasil.niflheim.ymir.') | 109 | parser.add_argument('--archive-prefix', metavar='REPO', default='yggdrasil.niflheim.ymir.') |
111 | parser.add_argument('--dry-run', action='store_true') | 110 | parser.add_argument('--dry-run', action='store_true') |