<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 2, 2017 at 4:09 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 class="">On 06/02/2017 03:56 PM, Bruno Rodriguez wrote:<br>
> Hello everyone,<br>
><br>
> I have some scripts that create VMs, which are in perl using libcurl and<br>
> oVirt REST API. They work quite fine but I'm experiencing something unusual.<br>
><br>
> After I create the machine (let's suppose it's called <a href="http://server.pic.es" rel="noreferrer" target="_blank">server.pic.es</a><br>
</span>> <<a href="http://server.pic.es" rel="noreferrer" target="_blank">http://server.pic.es</a>>) with UUID 123abc I post the following REST API<br>
<span class="">> call to https://... /vms/123abc/nics<br>
><br>
> <nic><br>
> <name>server.pic.es_nic1</<wbr>name><br>
> <interface>virtio</interface><br>
> <network><name>VLANXXX</name><<wbr>/network><br>
> </nic><br>
><br>
> The NIC is created and attached to the VM but it's network field is<br>
> empty, not in the VLANXXX. I don't know if I'm missing something but<br>
> this worked flawlessly with 3.6.9 REST API.<br>
><br>
> Some people could say: "it's because you're using Perl". Yup, that's<br>
> probably a mental issue of mine and I should visit a doctor about using<br>
> it, but it doesn't work even using a fancy REST browser extension to<br>
> send requests (ARC for chromium), anyways the REST reply is a "201:<br>
> Created" that looks OK...<br>
><br>
> Any idea or suggestion will be welcome. Thanks in advance!<br>
><br>
<br>
</span>It is not because of Perl :-) .<br>
<br>
In version 4 of the API it is mandatory to specify the NIC profile, as<br>
the network may have multiple profiles. So you need to find the<br>
identifier of that NIC profile and then send a request like this:<br>
<span class=""><br>
<nic><br>
<name>server.pic.es_nic1</<wbr>name><br>
<interface>virtio</interface><br>
</span> <vnic_profile id="the_id_of_the_profile"/><br>
</nic><br>
<br>
You can find the identifiers of the profiles like this:<br>
<br>
GET /ovirt-engine/api/networks/<wbr>the_identifier_of_the_network/<wbr>vnicprofildes<br>
<br>
If you want the old behavior, the behavior of version 3 of the API, you<br>
can just add to your request the 'Version: 3' HTTP header. But note that<br>
version 3 of the API is deprecated since version 4.0 of the engine, and<br>
it will be removed with version 4.2 of the engine.<br>
</blockquote></div><div><br></div><div>Thank you very much, I'll probably have to check that and add an "if" because I already was having problems with the APIv4 disks creation...</div><div><br></div><div>Thanks again!</div>
</div></div>