VM Pool management via API

Latest response

I'm currently working on a project to be able to create VM pools, and manage them completely from a perl written API.

 

The problem I'm facing, is once I've created a pool of x amount of VM's, I don't see any way to control them or get any information about them when using the API. It doesn't appear that the vm's created in a pool have vm id's.

 

Basically what I need to be able to do is create a pool with 50 VM's for example, start these VM's (and stop), and get the mac addresses of each one. Is this possible?

Responses

Hello Tyler,

 

Any VM's that are assigned to a pool will have a <vmpool> tag in the XML output from the API.  As an example, here is the relevant XML of one of my VM's that is a member of a pool:

 

<vmpool href="/api/vmpools/c412b6f4-28da-11e2-80ff-00259030d7c4" id="c412b6f4-28da-11e2-80ff-00259030d7c4"/>

 

You can then verify that the vmpool id matches the pool you are targeting.

 

Also, the search capability of the vms collection might be useful.  My pool is called "Test", it has 2 VM's each called Test-1 and Test-2.  If I run my API query on api/vms?search=Test it returns the XML for Test-1 and Test-2.

 

Hope this helps.

 

Tony

Great post, Tony. Thanks for helping out.

Great, thank you! This is exactly what I needed