Forum Discussion

gabigart_31229's avatar
gabigart_31229
Icon for Nimbostratus rankNimbostratus
Jun 19, 2012

Java adding a pool member with a custom name

Hi,

 

 

I' am adding a pool member with LocalLBPool.add_member_v2() but it don't let me to set a custom name to the member.

 

However with LocalLBNodeAddressV2.create() i can set the name.

 

So I wanted to know how to add a member setting the name if it's posible.

 

  • You didn't say, but perhaps you are experiencing one of these two error messages:

     

     

    >>> b.LocalLB.Pool.create_v2(['p2'],['LB_METHOD_ROUND_ROBIN'],[[{'port': 80, 'address': 'roger'}]])

     

    Traceback (most recent call last):

     

    File "", line 1, in ?

     

    File "/vol/3/user/cromwell/bigsuds.py", line 344, in __call__

     

    result = self._method(*args, **kwargs)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 542, in __call__

     

    return client.invoke(args, kwargs)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 602, in invoke

     

    result = self.send(soapenv)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 657, in send

     

    result = self.failed(binding, e)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 712, in failed

     

    r, p = binding.get_fault(reply)

     

    File "/usr/lib/python2.4/site-packages/suds/bindings/binding.py", line 265, in get_fault

     

    raise WebFault(p, faultroot)

     

    bigsuds.ServerError: Server raised fault: 'Exception caught in LocalLB::urn:iControl:LocalLB/Pool::create_v2()

     

    Exception: Common::OperationFailed

     

    primary_error_code : 16908342 (0x01020036)

     

    secondary_error_code : 0

     

    error_string : 01020036:3: The requested node (/Common/roger) was not found.'

     

    >>> b.LocalLB.Pool.create(['p2'],['LB_METHOD_ROUND_ROBIN'],[[{'port': 80, 'address': 'roger'}]])

     

    Traceback (most recent call last):

     

    File "", line 1, in ?

     

    File "/vol/3/user/cromwell/bigsuds.py", line 344, in __call__

     

    result = self._method(*args, **kwargs)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 542, in __call__

     

    return client.invoke(args, kwargs)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 602, in invoke

     

    result = self.send(soapenv)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 657, in send

     

    result = self.failed(binding, e)

     

    File "/usr/lib/python2.4/site-packages/suds/client.py", line 712, in failed

     

    r, p = binding.get_fault(reply)

     

    File "/usr/lib/python2.4/site-packages/suds/bindings/binding.py", line 265, in get_fault

     

    raise WebFault(p, faultroot)

     

    bigsuds.ServerError: Server raised fault: 'Exception caught in LocalLB::urn:iControl:LocalLB/Pool::create()

     

    Exception: Common::OperationFailed

     

    primary_error_code : 16908320 (0x01020020)

     

    secondary_error_code : 0

     

    error_string : 01020020:3: The text string cannot be converted to an IP address.'

     

     

     

    Perhaps you want something like this:

     

     

    >>> b.LocalLB.NodeAddressV2.create(['roger'],['1.1.1.1'],[0])

     

    >>> b.LocalLB.Pool.create_v2(['p2'],['LB_METHOD_ROUND_ROBIN'],[[{'port': 80, 'address': 'roger'}]])

     

     

    So we create a node, then use that in the pool create in the members argument.

     

    That yields this pool and node:

     

     

    [root@regent:Active:Standalone] iControl tmsh list ltm pool p2

     

    ltm pool p2 {

     

    members {

     

    roger:http {

     

    address 1.1.1.1

     

    }

     

    }

     

    }

     

    [root@regent:Active:Standalone] iControl tmsh list ltm node roger

     

    ltm node roger {

     

    address 1.1.1.1

     

    }

     

     

    If we get an address we can convert in the AddressPort structure you pass, we create the node automatically:

     

     

    >>> b.LocalLB.Pool.create_v2(['p3'],['LB_METHOD_ROUND_ROBIN'],[[{'port': 80, 'address': '2.2.2.2'}]])

     

     

    That gets us a node named "2.2.2.2" and creates the pool with that as a member.

     

     

    [root@regent:Active:Standalone] iControl tmsh list ltm pool p3

     

    ltm pool p3 {

     

    members {

     

    2.2.2.2:http {

     

    address 2.2.2.2

     

    }

     

    }

     

    }

     

    [root@regent:Active:Standalone] iControl tmsh list ltm node 2.2.2.2

     

    ltm node 2.2.2.2 {

     

    address 2.2.2.2

     

    }