fester/backend/storage/qcow2_freeze.py

26 lines
481 B
Python

import subprocess
from pathlib import Path
def freeze_to_qcow2(workdir, output_path):
"""
Creates a frozen snapshot of a build workspace.
"""
out = Path(output_path)
out.parent.mkdir(parents=True, exist_ok=True)
cmd = [
"qemu-img",
"create",
"-f", "qcow2",
str(out),
"10G"
]
subprocess.run(cmd, check=True)
# NOTE:
# Real implementation would rsync or tar into mounted image
return str(out)