76guill
Contributor
Contributor

XAAS action to reconfigure

Hi

I have an error that I can not understand.

when I just deployed a VM and that it and start well. I have an error when I execute an XAAS action to reconfigure: "java.lang.reflect.InvocationTargetExceptione".

but if I restart the XAAS action reconfigures.

it works.

here is the code I'm using:

input parameter:

vcaccafeHost->vCACCAFE:VCACHost

vm -> VC:Virtualmachine

#-------

var catalogResource = vCACCAFEEntitiesFinder.findCatalogResources(vcaccafeHost, vm.name)[0];

var operations = catalogResource.getOperations();

for each(var op in operations){

System.log(op.name)

if (op.getName() == "Reconfigure"){

return op;

break;

}

}

throw ("error : Another reconfigure action is pending");

#-------

thank you.

0 Kudos
2 Replies
daphnissov
Immortal
Immortal

What is "operations" and where are you setting it?

0 Kudos
76guill
Contributor
Contributor

Hi

operations?

it is the list of all the actions available on the virtual machine.

and I'm looking for the action "reconfigure" in this list

here are another ways to do it:

var service = host.createCatalogClient().getCatalogConsumerResourceService();

var filter = new Array();

filter[0] = vCACCAFEFilterParam.equal("name", vCACCAFEFilterParam.string(vm.name));

var query = vCACCAFEOdataQuery.query().addFilter(filter);

var catalogueResources = service.getResourcesList(new vCACCAFEPageOdataRequest(query));

for each(var catalogueResource in catalogueResources){

     var operations =catalogueResource.getOperations();

     for each(var operation in operations){

           if (operation.name === "Reconfigure"){

                 return operation;

                 break;

            }

      }

}

throw ("error : Another reconfigure action is pending");

I return an object of type :vCACCAFE:ConsumerResourceOperation

0 Kudos