<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Value manipulation question in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43409#M8912</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to build an add-LUN-to-a-volume workflow (with WFA 1.1.1) and am running into a coding issue when trying to resize the containing volume. In essence, I need to add an amount of space to the volume which is proportional to the size of a new volume and alter the autosize parameters as well. I've tried two approaches to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(The command being used is the certified "resize volume" command. I've found the volume and packed it into the "vol" array, and $lun_01_size is defined as a number between 1-1999):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;version 1:&lt;/P&gt;&lt;P&gt;autosize_grow_mb --&amp;gt; vol.autosize_grow_mb + (int)($lun_01_size * 1024 * 1.01 / 0.8 / 5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-and-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;version 2:&lt;/P&gt;&lt;P&gt;autosize_grow_mb --&amp;gt; add(vol.autosize_grow_mb,($lun_01_size * 1024 * 1.01 / 0.8 / 5)) , where the add(a,b) function is defined as: def add(a,b) {(int)a + (int)b;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Problem: Both approaches are performing a string addition when the workflow is executed, however: 1000 + 1000 = 10001000 and not the 2000 that I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone figured out a means of performing integer math on an existing array value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Sorry if this has already been answered - I'm working at a customer site whose Internet filters disable almost all functionality of the communities site, including the ability to reasonably search for anything)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer my own question, the form add((int)vol.autosize_grow_mb,(int)($lun_00_size *1024 * 1.01 / 0.8 / 0.5)) works, with def add(a,b) {a+b;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2025 06:16:58 GMT</pubDate>
    <dc:creator>jont</dc:creator>
    <dc:date>2025-06-05T06:16:58Z</dc:date>
    <item>
      <title>Value manipulation question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43409#M8912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to build an add-LUN-to-a-volume workflow (with WFA 1.1.1) and am running into a coding issue when trying to resize the containing volume. In essence, I need to add an amount of space to the volume which is proportional to the size of a new volume and alter the autosize parameters as well. I've tried two approaches to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(The command being used is the certified "resize volume" command. I've found the volume and packed it into the "vol" array, and $lun_01_size is defined as a number between 1-1999):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;version 1:&lt;/P&gt;&lt;P&gt;autosize_grow_mb --&amp;gt; vol.autosize_grow_mb + (int)($lun_01_size * 1024 * 1.01 / 0.8 / 5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-and-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;version 2:&lt;/P&gt;&lt;P&gt;autosize_grow_mb --&amp;gt; add(vol.autosize_grow_mb,($lun_01_size * 1024 * 1.01 / 0.8 / 5)) , where the add(a,b) function is defined as: def add(a,b) {(int)a + (int)b;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Problem: Both approaches are performing a string addition when the workflow is executed, however: 1000 + 1000 = 10001000 and not the 2000 that I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone figured out a means of performing integer math on an existing array value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Sorry if this has already been answered - I'm working at a customer site whose Internet filters disable almost all functionality of the communities site, including the ability to reasonably search for anything)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer my own question, the form add((int)vol.autosize_grow_mb,(int)($lun_00_size *1024 * 1.01 / 0.8 / 0.5)) works, with def add(a,b) {a+b;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 06:16:58 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43409#M8912</guid>
      <dc:creator>jont</dc:creator>
      <dc:date>2025-06-05T06:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Value manipulation question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43414#M8913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I have done this in the past and will paste the code examples for the functions that I used.&amp;nbsp; The examples are based around building or modifying a SAN application based on user inputs.&amp;nbsp; I put a lot of effort into developing a single workflow that can be used to create net-new or modify an existing deployment.&amp;nbsp; Due to this requirement, I needed a double duty function to provide the full details.&amp;nbsp; I will explain each piece in detail.&lt;/P&gt;&lt;P&gt;============================================&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;In the size portion of the FindChart, I added the following entry - detGrowthNeeded(exist_userDB_vol1,exist_userDB_vol1_Lun2,userDB_vol1,$userDB_vol1_Lun2_size,$rateOfChange)&lt;/P&gt;&lt;P&gt;The Variables indicate:&lt;/P&gt;&lt;P&gt;exist_userDB_vol1 = boolean (true/false) and is set to determine if the volume already exists&lt;/P&gt;&lt;P&gt;exist_userDB_vol1_Lun2 = boolean (true/false) and is set to determine if the Lun already exists in the volume&lt;/P&gt;&lt;P&gt;userDB_vol1 = This is the define for the Volume and is used as a Reference variable&lt;/P&gt;&lt;P&gt;$userDB_vol1_Lun2_size = New Lun size&lt;/P&gt;&lt;P&gt;$rateOfChange = Rate of change used to determine snapshot space required in the addition to space&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Function &lt;STRONG&gt;&lt;EM&gt;detGrowthNeeded&lt;/EM&gt;&lt;/STRONG&gt; is used to evaluate the values being passed.&amp;nbsp; Specifically, this workflow gave the option to add multiple Luns after the fact and therefore, I didn't want to mistakenly resize a Volume if not required.&amp;nbsp; Based on the first two parameters passed, a second function (setNewVolSize) was called to execute the sizing changes:&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt; def detGrowthNeeded(createVolume,createLun,jctPoint,newLunSize,pctOfChange) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (createVolume=='false') {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (createLun=='false') return (int)setNewVolSize(jctPoint,'',pctOfChange);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else return (int) setNewVolSize(jctPoint,newLunSize,pctOfChange);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (int) setNewVolSize(jctPoint,newLunSize,pctOfChange);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the Function &lt;STRONG&gt;&lt;EM&gt;setNewVolSize&lt;/EM&gt;&lt;/STRONG&gt; to actually do all of the calculations.&amp;nbsp; I could have placed this into a single function with the previous, but I wanted modularize the process to allow for easier use of code.&amp;nbsp; This is likely the piece you are most in need of.&amp;nbsp; Notice that I declare the value as an Integer (int).&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt; def setNewVolSize(growVolume, addSize, rateOfChange) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (addSize=='') &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (int)(growVolume.size_mb); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (int)(growVolume.size_mb + (convertToGB(addSize) * (1.1+(rateOfChange/100)))); &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because I only wanted to provide sizes in Gigabytes, I created a third function (&lt;STRONG&gt;&lt;EM&gt;convertToGB&lt;/EM&gt;&lt;/STRONG&gt;) which is as it's name implies&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;def convertToGB(size) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (int)(size *1024); &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;============================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This approach can be modified to meet your customer's needs and likely you can just use &lt;STRONG&gt;&lt;EM&gt;setNewVolSize&lt;/EM&gt;&lt;/STRONG&gt; and &lt;STRONG&gt;&lt;EM&gt;convertToGB&lt;/EM&gt;&lt;/STRONG&gt; functions in your workflow without using the &lt;STRONG&gt;&lt;EM&gt;detGrowthNeeded &lt;/EM&gt;&lt;/STRONG&gt;function.&amp;nbsp; I hope this helps.&amp;nbsp; If you run into any snags let me know.&amp;nbsp; I haven't used this one in a while (1.0.2) so if there are any syntax issues, then let me know and I will make changes.&amp;nbsp; I did restore my old backup into 1.1.1 and ran a quick preview.&amp;nbsp; It looks like everything added up correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeremy Goodrum, NetApp&lt;/P&gt;&lt;P&gt;The Pirate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2012 13:34:47 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43414#M8913</guid>
      <dc:creator>goodrum</dc:creator>
      <dc:date>2012-10-19T13:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Value manipulation question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43422#M8914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not use a function for the calculation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def increment_to_vol (lun_size)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;return (&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;(int)(lun_size * 1024 * 1.01 / 0.8 / 5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;Since you put that value into a new volume variable you can set new_vol.&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;autosize_grow_mb &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #454545; background-color: #ffffff; font-family: Arial, Helvetica, Verdana, sans-serif;"&gt;to "vol.&lt;SPAN style="color: #454545; font-family: Arial, Helvetica, Verdana, sans-serif; background-color: #ffffff;"&gt;autosize_grow_mb &lt;/SPAN&gt;+ increment_to_vol($Lun_Size)"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yaron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Oct 2012 13:19:21 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43422#M8914</guid>
      <dc:creator>yaronh</dc:creator>
      <dc:date>2012-10-28T13:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Value manipulation question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43425#M8915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Goodrum,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pretty cool stuff... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As to why I didn't use a function: I tend to do simple arithmetic out in the open and logic within functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But to the hart of my original posting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It appears that there is a difference to how MVEL or WFA treats the values of the variables, depending on if they are in a function or used directly in the workflow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add((int)vol.autosize_grow_mb,(int)($lun_00_size *1024 * 1.01 / 0.8 / 0.5)) &lt;/P&gt;&lt;P&gt;def add(a,b) {a+b;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;adds two integers together, while &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(int)vol.autosize_grow_mb + (int)($lun_00_size *1024 * 1.01 / 0.8 / 0.5))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;catenates the two string values of the variables. The essence of my question is why does the type casting work when the variable is passed to a subroutine, but not work when the variable is directly cast (actually, it does work as (int)($i)+(int)($j), but I run into problems with arrays like (int)(volume1.size_mb)+(int)(volume2.size_mb). It seems almost as if the addition operator has precendence over the casting operator in MVEL, which would surprise me... so I was wondering if anyone could clue me in as to what is really going on above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2012 15:56:11 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Value-manipulation-question/m-p/43425#M8915</guid>
      <dc:creator>jont</dc:creator>
      <dc:date>2012-11-06T15:56:11Z</dc:date>
    </item>
  </channel>
</rss>

