Active IQ Unified Manager Discussions

Trying to create a LUN and datastore using WFA

PeteK001
3,085 Views

We're trying to use WFA to create a new LUN on a Netapp FAS array and then a new VMware datastore on that LUN via a remote call from Ansible. I created a first workflow where we just created a LUN with a call from Ansible and that is working. I now have the workflow for the datastore and LUN creation done, but I'm getting an error regarding the "LogicalUnitNumber" field in the "Other Parameters" tab for the "Create VMware VMFS datastore" command. How do I know what the LUN value should be when the workflow hasn't created or mapped the LUN yet since that's part of the worflow? How do I tell it to use the LUN number that was assigned to the LUN in the "Map LUN" command portion of the workflow? When I put "$LUN_number" as the value for the LogicalUnitNumber field which makes the workflow ask for a value, the preview succeeds that way. I tried using the title of the "Create LUN" or "Map LUN" steps though, and I get "Found variable - expected literal / Location: 'Create VMware VMFS datastore' command > 'Other Parameters' tab > 'LogicalUnitNumber' property" error. Isn't there away to tell WFA to use the LUN number that was specified in the "Map LUN" step? I'm actually not sure what the difference is between the "LunId" field in the "Map LUN" step and the "LogicalUnitNumber" field in the "Create VMware VMFS datastore" step is? To clarify, when I say LUN number, I'm referring to the host facing LUN number which is usually 0-255. Thanks. 

3 REPLIES 3

mbeattie
2,989 Views

Hi Pete,

 

There are a number of options, you can create a custom command and use the "Add-WFAReturnParameter" and "Get-WFAReturnParameter" cmdlets to pass variables between commands in your workflow. Alternately you could add a "search" command step after the "Map LUN" then derive the LUN ID from the search command variable. If you don't set the LUN ID to map the LUN to in the "Map LUN" command then the reservation will set 0 as the default for the "lun_map_value" field in the "lunmap" table in the "cm_storage database.

 

        IF('${LunId}' IS NOT NULL,
        '${LunId}',
        0) -- lun_map_value

 

Try adding a "search" command after the "Map LUN" command. EG if you called the variable name for the search command as "mapped_lun" then in the "Create VMware VMFS datastore" command in the > 'Other Parameters' tab > 'LogicalUnitNumber' property you'd set the value to "mapped_lun.lun_map_value"

 

Alternately you could set the $LunID paramater in the "Map LUN" command by using an MVEL function i posted here: http://community.netapp.com/t5/OnCommand-Storage-Management-Software-Discussions/Return-LunId-from-Map-LUN-in-WFA/td-p/138732

 

Hope that helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

PeteK001
2,971 Views

Hello and thanks for the reply. I didn't realize WFA would use LUN 0 by default. I was hoping it would use the next available LUN number that wasn't already in use. We use Netapp VSC in the vSphere client to create datastores and LUNs and that takes care of the LUN numbers automatically. Is there a way to tell WFA to simply use the the next available LUN number? If the remote call from Ansible simply picks a random number for the LUN, there's no way to gaurantee that it's not already in use. I realize that vSphere doesn't really care if there are duplicate LUN numbers and it's the UUID being unique that really matters. For troubleshooting and other purposes though, it would be great to have each LUN with its own unique LUN number. I'm just not sure how to get WFA to do that when it adds the new LUN to the initiator group in the "Map LUN" step? I'll go ahead and attach the .dar file in case that helps. Thanks.

PeteK001
2,960 Views

Update: scratch the part about using a random number. Of course the number matters because the workflow has to tell vSphere what LUN to use when it goes to create the new datastore. The correct LUN number must be supplied, and it must be unique so that vSphere know which LUN to put the datastore on. Even if vSphere is ok with duplicate LUN numbers, if WFA tells it to create a new datastore on LUN 5 for instance, and there's three LUN 5s, how does it know which one to put the new datastore on? (I'm not asking for an answer there, just pointing it out as a potential issue.)

Public