iddo.avneri

Reserve VMs using API into user Defined Segments

Blog Post created by iddo.avneri on Mar 25, 2016

In previous posts (Deployment recommendations by VMTurbo (Part 2)) we demonstrated how to use VMTurbo's rest API in order to reserve capacity for future workload.

VMTurbo UI (And the previous API example) enables you to reserve capacity in a data center or a cluster. However, in many cases, you might want to reserve capacity against a group of clusters or a group of hosts clusters or on separate ones. That capability is available via VMTurbo's API, where you can deploy to any segmentation group.

 

First thing we need to create those segmentation groups (where we want to deploy to, for example all TEST clusters) through the UI. Then we will be able to point to them when we make a reservation in our API.

 

Step 1: Creating the groups. You can follow this article: How to Create Custom Groups . You want to create the groups you deploy into (For example TEST clusters). This will be a group of Physical machines.

Step 2: Creating a placement policy group. You can follow this article on the Green Circle: How to Create Workload Placement Policies  . You want to select one of the clusters in the group (Doesn’t matter which one) and say the VMs on this cluster much sit on the group you created on step 1.

 

Once we do this, we can reserve VMs via the API using these placement policies. We can walk you through that.

 

 

-- Getting the UUID of the template you would want to deploy (in this case looking for the"Novell_SUSE-small" Template ):

 

vmturbo:~ # curl -X GET http://administrator:administrator@localhost/vmturbo/api/templates | grep "Novell_SUSE-small"

<TopologyElement accessSpeedConsumed="10.0" cpuConsumedFactor="0.1" creationClassName="VirtualMachineProfile" description="A small instance of the SUSE LAMP" displayName="Novell_SUSE-small" ioThroughputConsumed="1024.0" memConsumedFactor="0.2" model="SUSE-small" name="VirtualMachine::Novell_SUSE-small" networkThroughputConsumed="1024.0" numVCPUs="1" price="0.0" services="" storageConsumedFactor="1.0" uuid="_UKsnkJkSEeCHcOXEhzJExA" vMemSize="1048576.0" vStorageSize="5120.0" vendor="Novell"/>

 

-- Get related deployment profiles:

 

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api/deploymentprofiles" | grep -B3 -A1 "_UKsnkJkSEeCHcOXEhzJExA"

<TopologyElement creationClassName="ServiceCatalogItem" discovered="false" displayName="AllDatacenter" name="AllDatacenter" uuid="_y-pDgPHPEeWATNJr-yXgaA">

<uris/>

<scope>5cc2236698a6de0f645ebb5a397fd50731d1190f</scope>

<TopologyRelationship childrenUuids="_wIBz8Jj4EeC6nYMiQT1jqA|_29UisJj2EeCC5LboJXwW3g|_1CxZMJkEEeCdJOYu5_HwXg|_hxrskJkQEeCHcOXEhzJExA|_wlVHEJkQEeCHcOXEhzJExA|_Ekz30JkSEeCHcOXEhzJExA|_UKsnkJkSEeCHcOXEhzJExA|_tqkUMJkSEeCHcOXEhzJExA" name="RelatedProfiles"/>

</TopologyElement>

 

-- Get Server interface:

 

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api?geti&ServerInterface"

ServerInterface|_JpAsQfEYEeWATNJr-yXgaA

ServerInterface|_JkfYoPEYEeWATNJr-yXgaA

ServerInterface|_JkeKgPEYEeWATNJr-yXgaA

 

 

-- Get Server Segmentations:

 

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api?geti&Segmentation"

CommSegmentation|_sO59s_EiEeWATNJr-yXgaA

CommSegmentation|_pOmZMeuiEeWIJcgQuz2Bzg

CommSegmentation|_HzKTAvEaEeWATNJr-yXgaA

CommSegmentation|_H1DJYvEaEeWATNJr-yXgaA

CommSegmentation|_sO59sfEiEeWATNJr-yXgaA

CommSegmentation|_sOBz8vEiEeWATNJr-yXgaA

CommSegmentation|_HhURIeugEeWIJcgQuz2Bzg

CommSegmentation|_sO59tfEiEeWATNJr-yXgaA

CommSegmentation|_H2EdEvEaEeWATNJr-yXgaA

CommSegmentation|_sOBz9PEiEeWATNJr-yXgaA

CommSegmentation|_sO59t_EiEeWATNJr-yXgaA

CommSegmentation|_HxvWsfEaEeWATNJr-yXgaA

CommSegmentation|_Hhug0eugEeWIJcgQuz2Bzg

CommSegmentation|_sOBz8_EiEeWATNJr-yXgaA

CommSegmentation|_sOBz9fEiEeWATNJr-yXgaA

CommSegmentation|_HgmfceugEeWIJcgQuz2Bzg

 

 

-- Understand segmentation Names from UUIDs:

 

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api?inv.u&_JpAsQfEYEeWATNJr-yXgaA&get&CommSegmentation&_sO59s_EiEeWATNJr-yXgaA&displayName"

ALL TEST PHYSICAL MACHINES

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api?inv.u&_JpAsQfEYEeWATNJr-yXgaA&get&CommSegmentation&_pOmZMeuiEeWIJcgQuz2Bzg&displayName"

ALL PROD PHYSICAL MACHINES

etc...

 

-- Reserving the new workload:

 

vmturbo:~ # curl -X POST http://administrator:administrator@localhost/vmturbo/api/reservations?reservationName=Test1&count=1&templateName=_UKsnkJkSEeCHcOXEhzJExA&deploymentProfile=_y-pDgPHPEeWATNJr-yXgaA&deployDate=2016-07-07 12:00:00&reservationDate=2016-06-06 12:00:00&segmentationUuid%5B%5D=_sO59s_EiEeWATNJr-yXgaA

_SiGtcPHUEeWATNJr-yXgaA

 

 

--Check Status of reservation:

 

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api/reservations"

<?xml version="1.0" encoding="ISO-8859-1"?><TopologyElements>

<TopologyElement catalogItem="AllDatacenter" creationClassName="Reservation" displayName="Test1" expirationDate="Fri Sep 23 06:17:58 UTC 2016" name="Test1" profileName="_UKsnkJkSEeCHcOXEhzJExA" reservationDate="Thu Mar 24 15:22:58 UTC 2016" startDate="Fri Sep 23 06:17:58 UTC 2016" status="UNFULFILLED" uuid="_SiGtcPHUEeWATNJr-yXgaA"/>

</TopologyElements>

 

Check placement:

 

vmturbo:~ # curl -X GET "http://administrator:administrator@localhost/vmturbo/api/reservations/_SiGtcPHUEeWATNJr-yXgaA"

<?xml version="1.0" encoding="ISO-8859-1"?><VirtualMachines>

<VirtualMachine datastore="***" host="***" name="Test1_C0"/>

</VirtualMachines>

Outcomes