Show Table of Contents
2.7. Performing Actions on Resources
The following example outlines how to perform actions on a resource. In this example, a virtual machine with the name 'test' is started.
Procedure 2.3. Performing an Action on a Resource
- Declare an instance of the resource:
VM vm = api.getVMs().get("test"); - Declare action parameters to send to the resource:
Action actionParam = new Action(); org.ovirt.engine.sdk.entities.VM vmParam = new org.ovirt.engine.sdk.entities.VM(); actionParam.setVm(vmParam);
- Perform the action:
Action res = vm.start(actionParam);
Alternatively, you can perform the action as an inner method:
Action res = vm.start(new Action()
{
{
setVm(new org.ovirt.engine.sdk.entities.VM());
}
});

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.