[Feature Request] lxc snapshot [<remote>:]<instance>/<snapshot> --replace

As of now I have to run the following script to accomplish what could be built in:

#!/bin/bash

## Replace backup snapshots

echo 
echo "Container Name?"
read containername

sudo lxc storage volume delete ${containername}-pool mysql-volume/backup & \
sudo lxc delete ${containername}/backup

sleep 1

sudo lxc snapshot ${containername} backup & \
sudo lxc storage volume snapshot ${containername}-pool mysql-volume backup

I suggest that snapshots could be overwritten with:

lxc snapshot [<remote>:]<instance>/<snapshot> --replace

lxc storage volume snapshot [<remote>:]<pool> <volume>/<snapshot> --replace

Would this be possible?
Thank you very much for considering!

EDIT:
The feature was implemented and the commands are with the --reuse flag instead of --replace:

lxc snapshot [<remote>:]<instance>/<snapshot> --reuse

lxc storage volume snapshot [<remote>:]<pool> <volume>/<snapshot> --reuse
1 Like

Maybe more as a flag to lxc snapshot and lxc storage volume snapshot that would just have the client handle the delete and create of the snapshot.

1 Like

Changed it to a flag.

Implemented in LXD 4.8 has been released - News - Linux Containers Forum