How to assign a server disk and nic profile via REST API?

Hello to everybody, for about an hour I have stuck my nose in the ovirt and rhev documentation, but I still can't understand how to use the REST API to change the disk profile and nothing the server profile. Ideally, how to set it for them when setting up a VM. Thank you so much for the advice.

Hi, You can use this one for adding a VM nic: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/add_vm_ni... *Regards,* *Shani Leviim* On Sun, Apr 4, 2021 at 5:10 PM <ovirt.org@nevim.eu> wrote:
Hello to everybody,
for about an hour I have stuck my nose in the ovirt and rhev documentation, but I still can't understand how to use the REST API to change the disk profile and nothing the server profile.
Ideally, how to set it for them when setting up a VM.
Thank you so much for the advice. _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/WK2XPICALNTXSL...

Thanks. Is it possible to do it like this via the REST-API? I can't find it in the documentation. :-( I don't use Python.

Yes, follow the example here: POST /ovirt-engine/api/vms/123/nics <nic> <name>mynic</name> <interface>virtio</interface> <vnic_profile id="456"/> </nic> http://ovirt.github.io/ovirt-engine-api-model/master/#services/vm_nics/metho... *Regards,* *Shani Leviim* On Wed, Apr 21, 2021 at 10:05 AM <ovirt.org@nevim.eu> wrote:
Thanks. Is it possible to do it like this via the REST-API? I can't find it in the documentation. :-( I don't use Python. _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/GBCOWSEHG6HR2F...

This is to add a secondary additional vnic. I don't need that. I want to change exist something primary vnic, not add it. Optional i need set this vnic while "create VM". I want set this from screenshot on create VM setting. https://prnt.sc/126trb8

Temporary solution for me is: PUT /ovirt-engine/api/vms/$serverID/nics/$nicID <nic> <name>ovirtmgmt_25</name> <interface>virtio</interface> <vnic_profile id="$profileID"/> </nic> But this solution is not optional, i need set this on "create VM". Ad this to: POST /ovirt-engine/api/vms <vm> <name>$hostname</name> <description>$description</description> <cluster> <name>$cluster</name> </cluster> <template> <name>$template</name> </template> <cpu> <topology> <cores>1</cores> <sockets>$cpu</sockets> <threads>1</threads> </topology> </cpu> <memory>$ramMB</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>$ramMBguaranteed</guaranteed> <max>$ramMBmax</max> </memory_policy> </vm> like this, but not workling: <vm> <name>$hostname</name> <description>$description</description> <cluster> <name>$cluster</name> </cluster> <template> <name>$template</name> </template> <nic> <name>ovirtmgmt_25</name> <interface>virtio</interface> <vnic_profile id='$profileID'/> </nic> <cpu> <topology> <cores>1</cores> <sockets>$cpu</sockets> <threads>1</threads> </topology> </cpu> <memory>$ramMB</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>$ramMBguaranteed</guaranteed> <max>$ramMBmax</max> </memory_policy> </vm>

For updating VMs, use PUT instead of POST http://ovirt.github.io/ovirt-engine-api-model/master/#services/vm/methods/up... *Regards,* *Shani Leviim* On Sun, May 2, 2021 at 10:29 AM <ovirt.org@nevim.eu> wrote:
Temporary solution for me is:
PUT /ovirt-engine/api/vms/$serverID/nics/$nicID
<nic> <name>ovirtmgmt_25</name> <interface>virtio</interface> <vnic_profile id="$profileID"/> </nic>
But this solution is not optional, i need set this on "create VM".
Ad this to:
POST /ovirt-engine/api/vms
<vm> <name>$hostname</name> <description>$description</description> <cluster> <name>$cluster</name> </cluster> <template> <name>$template</name> </template>
<cpu> <topology> <cores>1</cores> <sockets>$cpu</sockets> <threads>1</threads> </topology> </cpu> <memory>$ramMB</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>$ramMBguaranteed</guaranteed> <max>$ramMBmax</max> </memory_policy> </vm>
like this, but not workling:
<vm> <name>$hostname</name> <description>$description</description> <cluster> <name>$cluster</name> </cluster> <template> <name>$template</name> </template>
<nic> <name>ovirtmgmt_25</name> <interface>virtio</interface> <vnic_profile id='$profileID'/> </nic>
<cpu> <topology> <cores>1</cores> <sockets>$cpu</sockets> <threads>1</threads> </topology> </cpu> <memory>$ramMB</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>$ramMBguaranteed</guaranteed> <max>$ramMBmax</max> </memory_policy> </vm> _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/I3IHCJIR5N7M6O...

You can follow this example: http://ovirt.github.io/ovirt-engine-api-model/master/#_create_a_virtual_mach... Have you tried creating first the VM without the NIC and then creating its nic with POST /ovirt-engine/api/vms/#id/nics ? *Regards,* *Shani Leviim* On Sun, May 2, 2021 at 1:14 PM Shani Leviim <sleviim@redhat.com> wrote:
For updating VMs, use PUT instead of POST
http://ovirt.github.io/ovirt-engine-api-model/master/#services/vm/methods/up...
*Regards,*
*Shani Leviim*
On Sun, May 2, 2021 at 10:29 AM <ovirt.org@nevim.eu> wrote:
Temporary solution for me is:
PUT /ovirt-engine/api/vms/$serverID/nics/$nicID
<nic> <name>ovirtmgmt_25</name> <interface>virtio</interface> <vnic_profile id="$profileID"/> </nic>
But this solution is not optional, i need set this on "create VM".
Ad this to:
POST /ovirt-engine/api/vms
<vm> <name>$hostname</name> <description>$description</description> <cluster> <name>$cluster</name> </cluster> <template> <name>$template</name> </template>
<cpu> <topology> <cores>1</cores> <sockets>$cpu</sockets> <threads>1</threads> </topology> </cpu> <memory>$ramMB</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>$ramMBguaranteed</guaranteed> <max>$ramMBmax</max> </memory_policy> </vm>
like this, but not workling:
<vm> <name>$hostname</name> <description>$description</description> <cluster> <name>$cluster</name> </cluster> <template> <name>$template</name> </template>
<nic> <name>ovirtmgmt_25</name> <interface>virtio</interface> <vnic_profile id='$profileID'/> </nic>
<cpu> <topology> <cores>1</cores> <sockets>$cpu</sockets> <threads>1</threads> </topology> </cpu> <memory>$ramMB</memory> <memory_policy> <ballooning>true</ballooning> <guaranteed>$ramMBguaranteed</guaranteed> <max>$ramMBmax</max> </memory_policy> </vm> _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/I3IHCJIR5N7M6O...
participants (2)
-
ovirt.org@nevim.eu
-
Shani Leviim