2015-12-04 05:03 AM
I want to execute a snapmirror update before shrinking a snapmirror destination. The workflow resizes (primary)volumes with or without snapmirror relationships.
So, the commands executed are:
- Search & define all needed objects
- Vol resize on the primary volume
- IF the volume has a snapmirror relationship AND the new primary volume size is smaller than the current primary volume size: do a snapmirror update
- IF the volume has a snapmirror relationship : vol resize on the secondary volume
The expression I'm using for the conditional execution of the 3rd step is:
SNAPMIRROR ? (VOLUME_SIZE_IN_MB < vol_pri.size_mb) : false
- SNAPMIRROR is a Boolean constant indicating the existence of a snapmirror relationship. This constant is also used for conditional execution of the 4th step and is working correctly
- VOLUME_SIZE_IN_MB is an integer specifying the new (primary) volume size
- vol_pri.size_mb is the size in MB property of the primary volume object
So, when both SNAPMIRROR is true and the new size is smaller than the current size, the command is still not executed. My guess is that vol_pri.size_mb is already reduced (due to reservation?) before the comparison happened, but I'm not sure where to check this.
- Where can I see the value of the variables used in the expression? Can't find them in the logging, is there a way to show their values at the moment of doing the comparison in the expression?
- If vol_pri.size_mb is indeed set to the new value prior to the comparison, how should I do this instead? I've tried using the snapmirror destination volume object, but that's not available when there's no snapmirror relationship, so the expression fails.
2015-12-07 05:48 AM
I've been experimenting a bit more with this. When I deselect "Consider Reserved Elements" in the workflow, the conditional execution works as expected. So it's indeed the reservation process that updates the volume size (vol_pri.size_mb) before the condition is evaluated.
How do I access the value of vol_pri.size_mb BEFORE the reservation is applied?
2015-12-07 10:35 AM - edited 2015-12-07 12:31 PM
I think I understand and was able to replicate what you're seeing. I have a workaround that may help here I've been using for other problems...but its not the most elegant solution around.
- Create new dictionary item with N-number of fields (you might want more than a single distinct field to reference or store text in later)
- Create new command referencing the new dictionary. Map parameters to the dictionary fields. Do *NOT* add any reservation or verification code; we're just looking to store text/info within a single workflow and not store this information in WFA's DB anywhere.
- When the command is used in a workflow you can reference the command parameters in a variety of ways to store text, make comparisions with, etc.
I've attached a sample workflow that somewhat mimics what you're attempting. The workflow first resizes a volume; and if that new size is less than the original volume's size it will also modify the volume with a new comment. Using this custom command value I can properly get the conditional statement to function as intended.
I've had a lot of success using this method for other problems but never really used it for anything involving reservations before. This seems to work okay but might be worth a solid round of testing to make sure the behavior matches what you'd expect.
Hope this helps.