Forum Discussion

Stoyan_263592's avatar
Stoyan_263592
Icon for Nimbostratus rankNimbostratus
May 12, 2016

how to check if given pool exists using IControl

Hello,

 

I am trying to check if given pool exists or not. As I didn't find proper operation in iControlAPI I decided to ask you what is the prefered way to do this. As a workaround I can use some of the following:

 

  1. Get list of all pools and check if it contains the pool
  2. Try to execute some get operation on the pool and check if it will fail with error like this one:

Exception caught in GlobalLB::urn:iControl:GlobalLB/Pool::create() Exception: Common::OperationFailed primary_error_code : 16908390 (0x01020066) secondary_error_code : 0 error_string : 01020066:3: The requested Pool (/XXX/test.mydomain.com) already exists in partition XXX.

 

Can I use some of the error codes in the error message to identify that this error is "Not found"?

 

thanks Stoyan

 

1 Reply

  • We never included "exists" methods to the APIs. The procedures you listed are the ways to go and it depends on the size of your configuration and or how much processing you want to do. You can either get a list of pools and look for a match, or perform a get_* on your pool name and look for a SOAP exception. get_description() is probably a good one to use. Unfortunately all of the error codes are not fully documented so you'll have to test it out and use the returned error string as a match. The error returned for object not found will be the same moving forward.

     

    -Joe