Forum Discussion

Steven_Le_Roux_'s avatar
Icon for Nimbostratus rankNimbostratus
Feb 27, 2012

How to set priority/ratio on a pool member




Here is my issue.




The iControl documentation give the arguments as (for priority) :




pool_names String[]




priorities long[][]







so for example setting a pool and a member sequence as follow :




p = lb.LocalLB.Pool




members = p.typefactory.create('Common.AddressPortSequence')


member1 = p.typefactory.create('Common.AddressPort')


member2 = p.typefactory.create('Common.AddressPort')


member1.address = 'member1'


member2.address = 'member2'

member1.port = '80'


member2.port = '80'




members.item = [member1,member2]




p.get_member_priority(pool_names=['myPool'], members=[members])




=> [[10L, 0L]]




wich is ok with the type I should obtain.




so now, I want to set a different priority, i should be able to give the answer i just got as argument, since it the same type ( long [] [] )




p.set_member_priority(pool_names=['myPool'], members=[members], priorities= [[10L, 0L]])




=> suds.WebFault: Server raised fault: 'Error de-serializing array. Too many values in array. Array specified 1, found 2.'




I guess here we should use a typefactory to build the priorities, but the only thing I found is a 'Common.LongSequence' (from sdk aliases in common) :




test = p.typefactory.create('Common.LongSequence')


=> suds.TypeNotFound: Type not found: 'Common.LongSequence'





niether for Long64...




So here's the question, how to build the long[][] object that can be handle by suds in order to adjust a ratio or a priority for a set of pool ?





1 Reply

  • Hi,



    the only way I've found to manage this is without using any typefactory but the syntax is a little bit osbure so here is it :



    p.set_member_priority(pool_names=['pool'],members= [members], priorities= [{'long':[10L,0L]}])



    members is a (Common.AddressPortSequence) struct.



    then, as priority, I pass a list of a struc defined as long and containing a list. It works.