forked from third-party-mirrors/zfs_autobackup
fix: atomic snapshots can only be created per pool. now uses a seperate zfs snapshot command for each pool
This commit is contained in:
parent
cc45122e3e
commit
b0ffdb4893
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
|
||||
@ -165,12 +165,21 @@ test_snapshots={}
|
||||
|
||||
|
||||
|
||||
"""create snapshot on multiple filesystems at once (atomicly)"""
|
||||
"""create snapshot on multiple filesystems at once (atomicly per pool)"""
|
||||
def zfs_create_snapshot(ssh_to, filesystems, snapshot):
|
||||
|
||||
cmd=[ "zfs", "snapshot" ]
|
||||
|
||||
#collect per pool, zfs can only take atomic snapshots per pool
|
||||
pools={}
|
||||
for filesystem in filesystems:
|
||||
pool=filesystem.split('/')[0]
|
||||
if pool not in pools:
|
||||
pools[pool]=[]
|
||||
pools[pool].append(filesystem)
|
||||
|
||||
for pool in pools:
|
||||
cmd=[ "zfs", "snapshot" ]
|
||||
for filesystem in pools[pool]:
|
||||
cmd.append(filesystem+"@"+snapshot)
|
||||
|
||||
#in testmode we dont actually make changes, so keep them in a list to simulate
|
||||
|
Loading…
x
Reference in New Issue
Block a user