Forum Discussion

Stefano_L__8562's avatar
Stefano_L__8562
Icon for Nimbostratus rankNimbostratus
Jul 25, 2012

Help on create GTM Pool

Hello everybody,

 

I'm trying to create a GTM Pool using Powershell and iControl v11.

 

 

I can create a GTM VirtualServer and a GTM Pool with one VirtualServer.

 

When I try to create a new Pool, passing two Virtual Server, only the first one is

 

associated, the other is not associated to that Pool.

 

 

I don't receive any error message.

 

 

If later, I try to add the second Virtual Server to the same pool, then it is correctly

 

assigned to that pool.

 

 

Any ideas ?

 

Is it possibile that when a new GTM Pool is created, only one Virtual Server is recognized ?

 

 

Code:

 

 

[string[]]$MemberList = @("192.168.131.20","192.168.131.21");

 

 

$poolFullName = "PoolF20GTM80";

 

 

$MemberDef = New-Object -TypeName iControl.GlobalLBPoolPoolMemberDefinition;

 

$MemberDef.member = New-Object -TypeName iControl.CommonIPPortDefinition;

 

$MemberDef.member.address = $MemberList[1];

 

$MemberDef.member.port = $memberPort;

 

 

$MemberDef1 = New-Object -TypeName iControl.GlobalLBPoolPoolMemberDefinition;

 

$MemberDef1.member = New-Object -TypeName iControl.CommonIPPortDefinition;

 

$MemberDef1.member.address = $MemberList[0];

 

$MemberDef1.member.port = $memberPort;

 

 

$MB = ($MemberDef,$MemberDef1);

 

 

$(Get-F5.iControl).GlobalLBPool.create(

 

(,$poolFullName),

 

(,"LB_METHOD_ROUND_ROBIN"),

 

$MB

 

 

);

 

 

Thanks in advance

 

 

Stefano

 

3 Replies

  • Stefano, It looks like you've given only a snippet of code here rather than your entire sub-routine or whatever it's called in powershell because there are variables that I see being used that have no corresponding declaration.

     

    I can tell you honestly that it's highly likely the problem is in your code, not the API. At the same time, while I can generally read powershell, if not write it, I can't look something over without a full blurb. I'd be happy to look it over if you could modify your post to include all relevant code.

     

    This bigsuds command will create a pool with the proper members on any box using code higher than 9.3, even though the GlobalLB.Pool.create command is deprecated as of v11 (create_v2 should be used instead).

     

    b.GlobalLB.Pool.create(['www.example.com'],['LB_METHOD_GLOBAL_AVAILABILITY'],[[{'member': {'port': 80, 'address': '2.2.2.2'}, 'order': 1}, {'member': {'port': 80, 'address': '1.1.1.1'}, 'order': 0}]])

     

    Note: The entire GlobalLB.Pool section has been deprecated as of v12 and should not be used with that code branch. GlobalLB.PoolV2 should be used in its place.

     

    Hope that the bigsuds snippet gives you something to compare your own code to. Alternatively, you could enable SOAP debugging and confirm that properly formed XML is being sent, which might help you identify the snag. Doing a get_member on an existing pool should give you the data you need for comparison with the XML that you're sending.

     

  • Check out this codeshare entry I posted a few weeks ago that shows how to create various GTM object. https://devcentral.f5.com/codeshare/globallb-dns-create-and-state-examples-using-powershell-960

     

    It includes an example of creating GTM Pools... The trick is in allocating the arrays properly and not having PowerShell guess what you want them to be. The pool name parameter is a 1-D array but the member def is a 2-D array. You are passing in 1-D arrays for both parameters.