Roger Wilco
Explorer
- Joined
- Jul 17, 2014
- Messages
- 65
Hi,
the Periodic Snapshots depend only on the configured time.
There are scenarios where it would be useful to have the possibility to execute a script before taking a snapshot, as well as after a snapshot has been taken.
Example:
1. A Time Machine backup is in progress.
2. A snapshot is taken on Host_A and replicated to Host_B (by a snapshot task and a replication task)
3. Host_A explodes, and the Time Machine backup is restored from the replicated snapshot from Host_B.
4. The restored time machine backup is probably useless, as the snapshot has been taken in the middle of a backup process.
If there was a way to ask "May I take the snapshot?" before taking a snapshot, one could handle this scenario.
(There should also be the counterpart "May I keep the taken snapshot?" after a snapshot has been taken.)
In the above example both questions might have been answered by a functionality which would check whether there are any active AFP connections (and answer NO in case there are any).
So, basically a truth table for the functionality might look like this:
The implementation of this functionality would be quite straight forward.
FreeNAS side:
For each Periodic Snapshot task the existing Autosnap.py script would dynamically load the user configured module consisting of a class which would inherit from some base class (defined by ixsystems) and override the two methods for the pre-and postcondition. These two methods would return True or False, which would define the further workflow.
User side:
The user would create a Python module with a class inheriting from a base class and overriding two methods from the base class, one for the precondition and one for the postcondition.
The payload of the two methods would be in the responsibility of the administrative user (which of course might lead to a disaster, but that's life).
Motivation:
Currently it is not possible to make bulletproof time machine backups without quite a lot of effort. All of the above might be done manually through cron, but one would have to reimplement most of the replication code (handling of freenas:state, holds, ...), which would mean to reinvent the wheel.
The Time Machine scenario is the one I came across. Maybe it would also be nice to have the same for the Replication Tasks. I could imagine I would not like to replicate while running on UPS....
Bye,
Roger
the Periodic Snapshots depend only on the configured time.
There are scenarios where it would be useful to have the possibility to execute a script before taking a snapshot, as well as after a snapshot has been taken.
Example:
1. A Time Machine backup is in progress.
2. A snapshot is taken on Host_A and replicated to Host_B (by a snapshot task and a replication task)
3. Host_A explodes, and the Time Machine backup is restored from the replicated snapshot from Host_B.
4. The restored time machine backup is probably useless, as the snapshot has been taken in the middle of a backup process.
If there was a way to ask "May I take the snapshot?" before taking a snapshot, one could handle this scenario.
(There should also be the counterpart "May I keep the taken snapshot?" after a snapshot has been taken.)
In the above example both questions might have been answered by a functionality which would check whether there are any active AFP connections (and answer NO in case there are any).
So, basically a truth table for the functionality might look like this:
Code:
| No Script configured | Script says NO | Script says YES | Can take snapshot | yes | no | yes | Can keep snapshot | yes | no | yes |
The implementation of this functionality would be quite straight forward.
FreeNAS side:
For each Periodic Snapshot task the existing Autosnap.py script would dynamically load the user configured module consisting of a class which would inherit from some base class (defined by ixsystems) and override the two methods for the pre-and postcondition. These two methods would return True or False, which would define the further workflow.
User side:
The user would create a Python module with a class inheriting from a base class and overriding two methods from the base class, one for the precondition and one for the postcondition.
The payload of the two methods would be in the responsibility of the administrative user (which of course might lead to a disaster, but that's life).
Motivation:
Currently it is not possible to make bulletproof time machine backups without quite a lot of effort. All of the above might be done manually through cron, but one would have to reimplement most of the replication code (handling of freenas:state, holds, ...), which would mean to reinvent the wheel.
The Time Machine scenario is the one I came across. Maybe it would also be nice to have the same for the Replication Tasks. I could imagine I would not like to replicate while running on UPS....
Bye,
Roger