VM run once API required

This is a multipart message in MIME format. --=_alternative 0022817E65257E74_= Content-Type: text/plain; charset="US-ASCII" Hi Experts, We are integrating RHEV(M) with our internal cloud portal using RHEV(M) API, we are able to provision Linux VM using API. But IP and Hostname not getting reflected on vm first boot. If we boot VM manually using run once its working fine. We are not able to find any run once API on RHEV end. Requested your help on this. Thanks & Regards Chandrahasa S =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you --=_alternative 0022817E65257E74_= Content-Type: text/html; charset="US-ASCII" <font size=2 face="sans-serif">Hi Experts,</font> <br> <br><font size=2 face="sans-serif">We are integrating RHEV(M) with our internal cloud portal using RHEV(M) API, we are able to provision Linux VM using API. But IP and Hostname not getting reflected on vm first boot. If we boot VM manually using run once its working fine. We are not able to find any run once API on RHEV end. </font> <br> <br><font size=2 face="sans-serif">Requested your help on this.</font> <br> <br> <br><font size=2 face="sans-serif">Thanks & Regards<br> Chandrahasa S<br> </font><p>=====-----=====-----=====<br> Notice: The information contained in this e-mail<br> message and/or attachments to it may contain <br> confidential or privileged information. If you are <br> not the intended recipient, any dissemination, use, <br> review, distribution, printing or copying of the <br> information contained in this e-mail message <br> and/or attachments to it are strictly prohibited. If <br> you have received this communication in error, <br> please notify us by reply e-mail or telephone and <br> immediately and permanently delete the message <br> and any attachments. Thank you</p> <p></p> --=_alternative 0022817E65257E74_=--

On 06/30/2015 08:16 AM, Chandrahasa S wrote:
Hi Experts,
We are integrating RHEV(M) with our internal cloud portal using RHEV(M) API, we are able to provision Linux VM using API. But IP and Hostname not getting reflected on vm first boot. If we boot VM manually using run once its working fine. We are not able to find any run once API on RHEV end.
Requested your help on this.
Assuming that you already installed cloud-init in the VM and that you want to specify the cloud-init parameters as part of the request to start the VM, then you will need something like this: ---8<--- !/bin/sh -ex url="https://engine.example.com/ovirt-engine/api" user="admin@internal" password="..." curl \ --insecure \ --user "${user}:${password}" \ --request POST \ --header "Content-Type: application/xml" \ --header "Accept: application/xml" \ --data ' <action> <vm> <initialization> <cloud_init> <host> <address>myhost.example.com</address> </host> <network_configuration> <nics> <nic> <name>eth0</name> <network> <ip netmask="255.255.255.0" gateway="10.10.10.1" address="10.10.10.1"/> </network> <boot_protocol>static</boot_protocol> <on_boot>true</on_boot> </nic> </nics> </network_configuration> </cloud_init> </initialization> </vm> </action> ' \ "${url}/vms/0f3c320-a409-4e9f-918e-3172818d54ed/start --->8--- If you prefer the Python SDK (which is much better the moment you want to do something more complicated) then it should be something like this: ---8<--- #!/usr/bin/python from ovirtsdk import api from ovirtsdk.xml import params api = api.API( url="https://engine.example.com/ovirt-engine/api", username="admin@internal", password="...", insecure=True ) vm = api.vms.get(name="myvm") action = params.Action( vm=params.VM( initialization=params.Initialization( cloud_init=params.CloudInit( host=params.Host( address="myhost.example.com" ), network_configuration=params.NetworkConfiguration( nics=params.Nics( nic=[ params.NIC( name="eth0", boot_protocol="static", on_boot=True, network=params.Network( ip=params.IP( address="10.10.10.1", netmask="255.255.255.0", gateway="10.10.10.1" ) ) ) ] ) ) ) ) ) ) vm.start(action) api.disconnect() --->8--- You can also use the Java SDK, let me know if you need an example of that.
Thanks & Regards Chandrahasa S
=====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
-- Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
participants (2)
-
Chandrahasa S
-
Juan Hernández