Forum Discussion
Scot_Beery_8237
Nimbostratus
Mar 26, 2010poolmember set_ratio
I'm having troubles trying to set the poolmember ratio. This is my code:
Dim m_interfaces As iControl.Interfaces = New iControl.Interfaces
m_interfaces.initialize("171.21.1.150", "username", "pwd")
Dim pm As iControl.LocalLBPoolMember
pm = m_interfaces.LocalLBPoolMember
Dim memberinfo As New iControl.LocalLBPoolMemberMemberRatio
Dim member As New iControl.CommonIPPortDefinition
Dim ratios(0) As iControl.LocalLBPoolMemberMemberRatio
member.address = "IPAddress"
member.port = "8399"
memberinfo.member = member
memberinfo.ratio = 99
ratios(0) = memberinfo
Dim pool(0) As String
pool(0) = "POOLName"
pm.set_ratio(pool, ratios)
I keep getting the compile error below. If I switch ratios to type "object" then it doesn't error out till runtime. I cannot figure out the syntax of this call...can someone help.
Value of type '1-dimensional array of iControl.LocalLBPoolMemberMemberRatio' cannot be converted to '1-dimensional array of 1-dimensional array of iControl.LocalLBPoolMemberMemberRatio' because 'iControl.LocalLBPoolMemberMemberRatio' is not derived from '1-dimensional array of iControl.LocalLBPoolMemberMemberRatio'.
1 Reply
- The function definition for the LocalLB.PoolMember.set_ratio method is
set_ratio( in String [] pool_names, in LocalLB__PoolMember__MemberRatio [] [] ratios );
It takes as parameters a 1-d array of pool names and then a 2-d parameter of member ratios (first dimension for each pool in param 1 and the second dimension for the pool members for that entry).
You are passing in a 1-d array for the ratios parameter and thus getting the error that you it cannot be converted from a 1-d array to a 1-d array of 1-d array.
You'll need to do something like this' Allocate poolNameA parameter of size 1 with single entry of "poolname" Dim poolNameA() As String = New String() {"poolname"} ' Allocate ratioAofA parameter of size 1,1 (one pool for first param, and one member for that pool). Dim ratioAofA()() As iControl.LocalLBPoolMemberMemberRatio ratioAofA = New iControl.LocalLBPoolMemberMemberRatio(0)() {} ' Allocate 2nd dimension of the array to be of size 1 ratioAofA(0) = New iControl.LocalLBPoolMemberMemberRatio(0) {} ' Allocate the structure in array value [0][0] ratioAofA(0)(0) = New iControl.LocalLBPoolMemberMemberRatio() ' Allocate the the member CommonIPPortDefinition structure ratioAofA(0)(0).member = New iControl.CommonIPPortDefinition() ' Fill in array value [0][0] ratioAofA(0)(0).member.address = "10.10.10.10" ratioAofA(0)(0).member.port = 8399 ratioAofA(0)(0).ratio = 99 m_interfaces.LocalLBPoolMember.set_ratio(poolNameA, ratioAofA)
The reason we do multi-dim arrays is so that you could configure something like this in one shotpool_1 10.10.10.10:80, 99 20.20.20.20:80, 50 pool_2 30.30.30.30:80, 25 40.40.40.40:80, 30 50.50.50.50:80, 40
In that case you would need the first array to be of size 2 with entries of "pool_1" and "pool_2" and the ratios parameter would have 2 and 3 entries for the 2nd dimensions.
Hope this clears things up...
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects