<div dir="ltr"><div><div>This works fine with sdk4. Thanks.<br></div>Unfortunately I couldn't find away to update cpu_shares config: can't set any update option to update it now or later and no error from the API.<br></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 11, 2016 at 1:07 PM, Juan Hernández <span dir="ltr"><<a href="mailto:jhernand@redhat.com" target="_blank">jhernand@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 07/08/2016 04:09 PM, Sebastien Fuchs wrote:<br>
> Hi,<br>
><br>
> I'm developping (in JAVA) an automatic configuration manager to modify<br>
> memory and cpu allocation (cpushares for the moment) updated on a<br>
> calendar basis. It will also be used as a kind of enforcer/elastic<br>
> scheduler on top of the ovirt policy scheduler.<br>
><br>
> Because oVirt is not yet able to update memory and cpushares on live<br>
> guests like XenServer, my configurator needs to know the running config<br>
> and the next_run config as well, and force directly the config on live<br>
> guests (with virsh schedinfo --live arg ? ).<br>
><br>
> Unfortunately, the Host.getVMs().getById( "uuid" ) method returns only<br>
> the running config so there's no way I can check if the future config is<br>
> setup.<br>
><br>
> Any suggestion?<br>
><br>
<br>
</span>Version 3 of the SDK doesn't support GET parameters, unfortunately. If<br>
you are using version 4 of the engine then you may consider using<br>
version 4 of the SDK, which does support them:<br>
<br>
---8<---<br>
import static org.ovirt.engine.sdk4.ConnectionBuilder.connection;<br>
<br>
import org.ovirt.engine.sdk4.Connection;<br>
import org.ovirt.engine.sdk4.services.VmService;<br>
import org.ovirt.engine.sdk4.services.VmsService;<br>
import org.ovirt.engine.sdk4.types.Vm;<br>
<br>
// This example will connect to the server and start a virtual machine:<br>
public class GetVmNextRun {<br>
public static void main(String[] args) throws Exception {<br>
// Create the connection to the server:<br>
Connection connection = connection()<br>
.url("<a href="https://engine41.example.com/ovirt-engine/api" rel="noreferrer" target="_blank">https://engine41.example.com/ovirt-engine/api</a>")<br>
.user("admin@internal")<br>
.password("...")<br>
.trustStoreFile("truststore.jks")<br>
.build();<br>
<br>
// Get the reference to the "vms" service:<br>
VmsService vmsService = connection.systemService().vmsService();<br>
<br>
// Find the virtual machine (we need this in order to find<br>
// the identifier of the virtual machine given its<br>
// name):<br>
Vm vm = vmsService.list()<br>
.search("name=myvm")<br>
.send()<br>
.vms()<br>
.get(0);<br>
<br>
// Locate the service that manages the virtual machine:<br>
VmService vmService = vmsService.vmService(<a href="http://vm.id" rel="noreferrer" target="_blank">vm.id</a>());<br>
<br>
// Call the "get" method using the "next_run" parameter to<br>
// retrieve the configuration of the virtual machine that<br>
// will be used the next time it is started:<br>
vm = vmService.get()<br>
.nextRun(true)<br>
.send()<br>
.vm();<br>
<br>
// Print some details of the virtual machine:<br>
System.out.printf("cpu shares: %s", vm.cpuShares());<br>
<br>
// Close the connection to the server:<br>
connection.close();<br>
}<br>
}<br>
--->8---<br>
<br>
If this isn't an alternative for you, then please open a bug requesting<br>
that this support is added to version 3 of the SDK.<br>
<span><font color="#888888"><br>
--<br>
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta<br>
3ºD, 28016 Madrid, Spain<br>
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.<br>
</font></span></blockquote></div><br></div></div>