The following example outlines how to perform actions on a resource. In this example, a virtual machine with the name 'test' is started.

  1. Declare an instance of the resource:

     VM vm = api.getVMs().get("test");
  2. 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();
  3. 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());