This question has been asked numerous times and Its been long existing pain that if a command execution fails, the reservation of the elements don't don't get cleared automatically. Users need to manually find out the reservation of the failed comamnd and the subsequent commands that didn't run and delete then. WFA hasn't provided any feature to do this. Till they do here is how you can solve it.
I'm giving solution on how to make the command do it on its own. Its a smart command. I'll also explain the logic I've used.
Prerequisties:
You need PowerShell 3.0 on your WFA server. I could have done it for PoSH2.0 as well, but life for web interfaces using PowerShell is so much easier with Posh3.0. Posh3.0 is a big jump from 2.0. WFA is fully supported to work on Posh3.0. Its available by default in Win2012, Win2008 can be upgraded, Win2003 users can't use it. If I get time, I'll post one for Posh2.0 as well.
Add credentials of a WFA Admin/Architect in you WFA itself with Name/IP: localhost
Match: Exact
Type: Other
Name/IP: localhost
Username: <WFA Admin/Architect Username>
Password: <User Password>

That's all.
- Define a trap for your command and it becomes a smart command. Trap is very useful error handling utility in powershell. Just copy paste the below code at the end of your command. That's all.
trap {
Get-WFALogger -Info -message "Clearing the Reservation on this job for the Failed Command and the commands which haven't been executed."
$myWfaCreds = Get-WfaCredentials -Host "localhost"
$workflowName = Get-WfaRestParameter "workflowName"
$jobId = Get-WfaRestParameter "jobId"
#Get the WFA http port
$REGISTRY = "HKLM:\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\NA_WFA_SRV\Parameters\Java"
$httpPort = (Get-ItemProperty $REGISTRY |select -ExpandProperty Options|where {$_ -match "-Dhttp.port"}).split("=")[1]
$Url= 'http://localhost:' + $httpPort + '/rest/workflows?name=' + $WorkflowName
#Get UUID of the workflow
$uuid=(Invoke-RestMethod -Method get -Uri $url -Credential $myWfaCreds).collection.workflow.uuid
#Prepare the new URL to clean reservation
$Url2="http://localhost:" + $httpPort +"/rest/workflows/"+ $uuid + "/jobs/" + $jobId +"/reservation"
#Invoke REST api.
Invoke-RestMethod -Method Delete -Uri $Url2 -Credential $myWfaCreds
Get-WfaLogger -Info -Messag "Reservation cleaned successfully"
}
This code will work for any command without the need of any change. The Logic: If the command fails, the trap section of the code is executed. I get the current job ID, the workflow's UUID and call the api to clean up the reservation. If the comamnd passed, trap is not executed and things work as before.
An Example:
1. I have a workflow with 3 commands, Create Qtree, Create Volume and Create Lun. For Create Volume, I've provide size= 1 MB so that it failes during execution, But Planning and hence reservations for all 3 will pass. Execute it now.

Verify it in Execution->Reservation. Our job ID was as below.

Reservation existing for the passed comand "Create Qtree". But Reservations for "Create Volume" and the unexecuted command "Create Lun" have been deleted.

Adding a sample command .dar file with command " Create Volume with auto clean reservation upon failure" which can be downloaded in WFA2.2 or above. Also in txt format.
sinhaa
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.