Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 168455

Re: using vCO to change the Lease time on a vRA VM

$
0
0

I'll just copy & paste the answer I allready provided here trying to spread the information in as many related threads as possible so if anyone comes around here he/she might find the information.

 

there seems to be a bug with the vCAC Plugin for vRO anyways. Tested this with the vCACCAFE plugin version 6.2.1 and vCAC plugin version 6.2.1.

I'm using a shared session for both plugins and the plugin user has sufficient permissions. Also I'm able to see the actions listed for each item when browsing the plugin inventory.

The results I found don't make sense (yet) but seem to indicate a bug.

 

// This works if the vCACCAFE:CatalogResource is provided as workflow input parameter
var ops = item.getOperations(); // will return a Array containing all operations
for each (op in ops)
{    System.log("Action: " + op.name);  // works
}


// But it fails, if the vCACCAFE:CatalogResource is dynamically collected using EntityFinder or other methods
bindingId = iaasVM.virtualMachineID;

cafeItems = vCACCAFEEntitiesFinder.getCatalogResources(cafeHost);
for each(item in cafeItems)
{
    if(item.getProviderBinding().getBindingId() == bindingId)    {        // The correct item is found and of type vCACCAFE:CatalogResource        var operations = item.getOperations(); // however, this will ALWAYS return an empty Array!    }
}

 

As you can see the plugin user seems to have sufficient permissions, because when calling item.getOperations() the array of operations is returned (first case). In the second case, where we dynamically search and find the item, the method will return an empty array.

Anyone at VMware has an eye on this?

 

As a workaround you may use somthing like this (removed exception handling for better readability) to get your operation object (took me 6 hours to find a working API call that is not bugged)

 

bindingId = iaasVM.virtualMachineID;
items = vCACCAFEEntitiesFinder.getCatalogResources(cafeHost);
for each(item in items)
{    var itemBindingId = item.getProviderBinding().getBindingId();    if(itemBindingId == bindingId)    {        var restClient = cafeHost.createRestClient(vCACCAFEServicesEnum.CATALOG_SERVICE);        var response = restClient.get("consumer/resources/"+item.getId()+"/actions");        var responseAsJSON = response.getBodyAsJson();        for each (action in responseAsJSON.content)        {            if(action.bindingId === "Infrastructure.Virtual.Action.Destroy")            {                ressourceOperation = vCACCAFEEntitiesFinder.getCatalogResourceAction(item, action.id);            }        }        break;    }
}

 

Hope this helps.


Viewing all articles
Browse latest Browse all 168455

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>