Forum Discussion

smp_86112's avatar
smp_86112
Icon for Cirrostratus rankCirrostratus
Dec 16, 2010

GlobalLB set_limit() Fail

I'm developing some Perl automation to "rename" GTM Pools. Obviously part of that process has to get of the properties of the old pool and apply them to the new pool. And I seem to be having some trouble with the set_limit() function.

 

Here's the code for get_limit():

 

 

$soapResponse = $Pool->get_limit(SOAP:: Data->name(pool_names => [$old_pool]));
&checkResponse($soapResponse);
my $limit = $soapResponse->result->[0];

 

 

It seems to get the limit properties OK:

 

 

  DB<2> x $limit
0  GlobalLB:: Pool:: PoolMetricLimit=HASH(0xa4774f8)
   'metric_limits' => ARRAY(0xa4784fc)
      0  GlobalLB::MetricLimit=HASH(0xa475490)
         'type' => 'METRIC_LIMIT_BITS_PER_SECOND'
         'value' => 14600
   'pool_name' => 'smptest'

 

 

However when I try apply that same $limit to the new pool with iControl, the limits are not saved.

 

 

$soapResponse = $Pool->set_limit(SOAP:: Data->name(limits => [$limit]));
&checkResponse($soapResponse);

 

Looking closer at the iControl doc, the set_limit() function doesn't appear to take pool name as input, which makes me wonder how it could possibly know which pool to apply the limits to? However I also tried adding the pool_list parameter, and that didn't seem to have any effect. Am I not using these limit properties correctly?

 

2 Replies

  • The GlobalLB.Pool.set_limit() method is defined as follows

    http://devcentral.f5.com/wiki/default.aspx/iControl/GlobalLB__Pool__set_limit.html

    enum GlobalLB.MetricLimitType {
       METRIC_LIMIT_CPU_USAGE,
      METRIC_LIMIT_MEMORY_AVAILABLE,
      METRIC_LIMIT_BITS_PER_SECOND,
      METRIC_LIMIT_PACKETS_PER_SECOND,
      METRIC_LIMIT_CONNECTIONS,
      METRIC_LIMIT_CONNECTIONS_PER_SECOND
    };
    struct GlobalLB.MetricLimit {
      MetricLimitType type;
      long value;
    };
    struct GlobalLB.Pool.PoolMetricLimit {
      string pool_name;
      MetricLimit [] metric_limits;
    };
    GlobalLB.Pool.set_limit(
      in GlobalLB.Pool.PoolMetricLimit [] limits
    );

    From the debug output from the $limit variable it seems the value is appropriate and you are casting it to the correct array type in the call. You'll have to get a SOAP trace on the client side to see what's serialized out in the set_limit request. What were you doing with the $limit variable before you passed it back into the set_limit() method? Were you changing the metric value in the metric_limits array?

    -Joe

  • "Were you changing the metric value in the metric_limits array?"

     

     

    Uh, no. But I wasn't changing the 'pool_name' value either. Silly me...that's what I get for being a novice...

     

     

    Thanks for pointing me in the right direction.