I am attempting to create a workflow where certain steps will not run if a volume is offline or doesn't exist. To achieve this, I was trying to the use "Execute this command" on the advanced tab of the workflow step, but I can't seem to get the syntax correct. Or, maybe it's because I'm trying to use a previously defined object? The dropdown allows me to select the object, so it seems like it should work. I've tried putting the "online" word in single quotes, double quotes, and no quotes. All give me the same error.
snapmirror1.volume.state == 'online'
When I do a preview, I get the error message: Failed to evaluate the conditional execution expression 'snapmirror1.volume.state = "online"'. Illegal expression: snapmirror1.volume.state = "online"
I don't know if this reply is too late, but here goes:
One thing that comes to my mind is to search for the SnapMirror source volume before this step, using a "Search or define" block. Then reference this object's state in the advanced tab of the workflow step. I suspect the cause of your issue that you're referring to an object defined in that step, something I've seen before. It's a frustrating problem, for sure.
Please update this thread if you get a chance to try my suggestion.
Thanks, @Girton. Thankfully, this got put on the back burner for right now, but I'm sure I'm going to start getting pressured for it again soon, so any help is definitely appreciated.
Unfortunately, I think I'm already doing what you are suggesting. The first step of the workflow is to find and define a Snapmirror relationship based on a given volume name that the user enters:
Then, it will wait until any running Snapmirrors are finished before continuing on. This part works as long as I don't have a condition in the Advanced tab. So, I know it's defining it correctly. It will even let me use the dropdowns to create the condition (see screenshot), I'm just not sure what the syntax is after defining the parameter I want to look at to judge the condition. Is snapmirror1.volume.state == 'online' the correct syntax? I only want it to wait for the Snapmirror update to complete if the source volume is online.
As best I can tell snapmirror1.volume.state == 'online' is the correct syntax.
As a test, I cloned the "Remove SnapMirror relationship" certified workflow, and added a condition in the parameter section of 2nd command block ("Remove SnapMirror - Perl"), using a similar conditional expression (snapmirror.volume.state == 'online'), and it worked as expected.
The only additional thing I can think of to look at is the filter you used to find the SnapMirror. Are you using a custom filter? It appears that you might be, as all of the certified filters I can see in WFA require more than the source volume to find a SnapMirror relationship. If you're using a custom filter, is it possible that the filter isn't returning the state of the source volume? If so, then such would cause the error you're seeing.
Thanks, @Girton, it looks like that syntax was correct after all. After not looking at it for all this time, I went back and checked on it with fresh eyes. It looks like I set the correct syntax on an early step of the workflow, but didn't set it correctly on later steps. So, the error message was coming from steps later in the workflow. Doh! Sorry for the wild goose chase, but I think I have it working now.