2020-04-16 19:19:21 +00:00
|
|
|
from . import btrfs, mounts
|
|
|
|
from .. import utils
|
|
|
|
|
|
|
|
|
|
|
|
async def create_snapshot(name:str, user:str):
|
|
|
|
# Find home path and mount
|
|
|
|
user_path = await utils.get_user_home(user)
|
|
|
|
candidates = []
|
|
|
|
for i in await mounts.list_mounts():
|
|
|
|
if user_path.startswith(i.target):
|
|
|
|
candidates.append(i)
|
|
|
|
candidates = sorted(candidates, key=lambda x: len(x.target))
|
|
|
|
mount = candidates[-1]
|
|
|
|
|
|
|
|
# List subvolumes
|
|
|
|
subvols = btrfs.list_path_subvolumes(mount, user_path)
|
|
|
|
print(repr(subvols))
|
2020-04-16 20:21:29 +00:00
|
|
|
raise NotImplementedError()
|