3.5.6.2 Python

The serverPoolCreate method exposed by the SOAP API expects a complex argument of type serverPool. Suds provides a facility to construct these complex argument types using the factory namespace within the client object. We can use the Suds client factory namespace to create the serverPool object that the method expects as an argument:

serverPool=client.factory.create('serverPool')

Suds uses the WSDL to define how these objects are created. This makes it easy for you to see what parameters can be populated:

print serverPool
(serverPool){
   description = None
   generation = None
   id = 
      (id){
         name = None
         type = None
         uri = None
         value = None
      }
   locked = None
   name = None
   resourceGroupIds[] = <empty>
   userData[] = <empty>
   affinityGroupIds[] = <empty>
...
   unassignedVmIds[] = <empty>
   virtualIp = None
   vmIds[] = <empty>
   vmStartPolicy = 
      (vmStartPolicy){
         value = None
      }
   zoneId = 
      (id){
         name = None
         type = None
         uri = None
         value = None
      }
 }

In this case, we only need to populate some very basic attributes to create a simple server pool:

serverPool.name="MyServerPool"
serverPool.virtualIp="10.172.77.196"

If you need to configure other parameters for your server pool, you can set the attributes now or edit the server pool later. For now, setting the name and virtualIp parameters are sufficient for this example. Once this is complete, you can call the serverPoolCreate method:

job=client.service.serverPoolCreate(serverPool)
svrpool_id=wait_for_job(client,job.id)

As before, the response content returned by Oracle VM Manager, contains a SOAP object describing the job that is created to add the server pool. See Track Job Status for more information on how to handle this content.