I think this is another easy one but here it goes. I want to Create a snapshot on a selected volume (Done) then expire or delete that snapshot at a specified date. Any suggestions for doing this? I'm not sure if I should send the Workflow into a wait state as it may be days of waiting or if I should approach it some other way... Suggestions?
Yeah, this one is not going to be cut and dry. In theory, you could enable snapshot caching (disabled by default) and use the snapshot dates as the precursor. The challenge here is that you would need to create a windows scheduled task to execute a workflow via PoSH using the REST interface ( I posted a simple script a few days ago on doing this). The workflow would age out snapshots based on a pre-set time stamp. Now the real challenge would be on figuring out a way to not age out EVERYTHING. There are a couple of methods that oyu can follow.
Leverage the playground database to track volume names and retentions
Add a user input for the snapshot age and the volume and then when you call the workflow, pass those variables for aging (this would require a CSV of some sort to run the process.
The easiest solution.... SnapCreator. Leverage the configuration to set the individual retention policies and then execute a single workflow against the configuration to age out. I assume that since you are looking for a different route that you are likely trying to perform a one time snapshot and then remove it after a certain period. If that is the case, then you might be able to create the snapshot with a specific naming convention that will allow your outside workflow to find the volumes with a certain naming convention. Again, retention for multi-use would be tricky.
Actually that gives me a few good ideas. Since I am creating the snapshot I can tag it however I want then I can schedule a reoccurring workflow that deletes snapshots with that tag older than x number of days. The only tricky bit if going to be coding the date determination. Say for example I wanted to delete all snapshots older than 2 days and with a particular tag... Then run the workflow each morning.
EPOCH will be your friend on this one. Since you would be able to determine epoch prior to executing (add it into the script that you use for calling the workflow), you can use that as part of your filter to find snapshots. You would need to convert the column timestamp to UNIX_TIMESTAMP(timestamp) and filter on a specific snapshot naming convention. This is all theoretical on my part but should work.