Hi Juan,

Thanks for your reply. I will check it with this solution.

-- 
Regards
Shanil


On Fri, Aug 29, 2014 at 5:12 PM, Juan Hernandez <jhernand@redhat.com> wrote:
On 08/29/2014 12:02 PM, Shanil S wrote:
> Hi Juan,
>
> These are the xml details which i used for the vm start function, please
> check it
>

Ok, this explains this problem and the other problem that you are having
with assigning profile.

It is important to understand that there are two sets of parameters
associated to a network interface:

1. Those that define the virtual hardware configuration, like the model,
interface, MAC and profile. Those are assigned when you create or update
the NIC. For example:

#!/bin/sh -x

url="https://ovirt.example.com/ovirt-engine/api"
user="admin@internal"
password="******"

curl \
--verbose \
--insecure \
--request POST \
--header "Accept: application/xml" \
--header "Content-Type: application/xml" \
--user "${user}:${password}" \
--data "
<nic>
  <interface>virtio</interface>
  <name>nic1</name>
  <mac address='00:1a:4a:16:01:53'/>
  <vnic_profile id='8d69b87d-a6df-4912-adb7-d498c2fdc8e3'/>
</nic>
" \
"${url}/vms/b848fc2e-5df2-4754-ae7c-98a20c0e373d/nics"

If you include in a request like this any IP information, like boot
protocol, address, etc, it will be just silently ignored.

2. Those that define the software device configuration. These are
managed by the guest OS, and you can set them using cloud-init, as you
are doing. But you can't change the hardware configuration with
cloud-init, that is why your <vnic_profile> element is ignored.

See some more comments below:

>
> <action>
>                 <vm>
>                     <os>
>                         <boot dev='cdrom'/>
>                     </os>
>                     <initialization>
>                          <cloud_init>
>
>                             <users>
>                                 <user>
>                                     <user_name>root</user_name>
>                                     <password></password>
>                                 </user>
>                             </users>
>                             <network_configuration>
>                                 <nics>
>                                     <nic>
>                                         <interface>virtio</interface>

This ^ line is ignored by cloud-init.

>                                         <name>eth0</name>
>
> <boot_protocol>static</boot_protocol>
>                                         <mac address='xx:xx:xx:xx:xx:xx'/>

This ^ line is ignored by cloud-init.

>                                         <network>
>                                             <ip address='xx.xx.xx.xx'
> netmask='255.255.255.0' gateway='xx.xx.xx.xx'/>
>                                         </network>
>                                         <on_boot>true</on_boot>
>                                         <vnic_profile
> id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' />

This ^ line is ignored by cloud-init. The vnic_profile is only used when
creating the NIC.

>                                     </nic>
>                                     <nic>
>                                         <interface>virtio</interface>

This ^ line is ignored by cloud-init.

>                                         <name>eth1</name>

You should add <boot_protocol>static</boot_protocol> here, like in eth0.

>                                         <mac address='xx:xx:xx:xx:xx:xx'/>

This ^ line is ignored by cloud-init.

>                                         <network>
>                                             <ip address='xx.xx.xx.xx'
> netmask='255.255.255.0' gateway=''/>
>                                     </network>
>                                         <on_boot>true</on_boot>
>                                         <vnic_profile
> id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' />

This ^ line is ignored by cloud-init. The vnic_profile is only used when
creating the NIC.

>                                     </nic>
>                                 </nics>
>                                 <dns>
>                                     <servers>
>                                         <host>
>                                             <address>8.8.8.8</address>
>                                         </host>
>                                     </servers>
>                                 </dns>
>                             </network_configuration>
>                          </cloud_init>
>                     </initialization>
>                 </vm>
>             </action>
>
>
>
> --
> Regards
> Shanil
>
>
> On Fri, Aug 29, 2014 at 2:15 PM, Juan Hernandez <jhernand@redhat.com
> <mailto:jhernand@redhat.com>> wrote:
>
>     On 08/29/2014 05:30 AM, Shanil S wrote:
>     > Hi Dan,
>     >
>     > Please ignore the previous screenshot and check this.
>     >
>     > --
>     > Regards
>     > Shanil
>     >
>     >
>     > On Fri, Aug 29, 2014 at 8:49 AM, Shanil S <xielesshanil@gmail.com
>     <mailto:xielesshanil@gmail.com>
>     > <mailto:xielesshanil@gmail.com <mailto:xielesshanil@gmail.com>>>
>     wrote:
>     >
>     >     Hi Dan,
>     >
>     >     I have attached the screenshot of the console, please check it.
>     >
>     >     --
>     >     Regards
>     >     Shanil
>     >
>     >
>     >     On Thu, Aug 28, 2014 at 4:46 PM, Dan Kenigsberg
>     <danken@redhat.com <mailto:danken@redhat.com>
>     >     <mailto:danken@redhat.com <mailto:danken@redhat.com>>> wrote:
>     >
>     >         On Thu, Aug 28, 2014 at 01:50:22PM +0530, Shanil S wrote:
>     >         > Hi Aill,
>     >         >
>     >         > We are creating two nics using the api, but it seems the
>     >         second network is
>     >         > not come up and the first one is working. The following
>     xml is
>     >         used to for
>     >         > the nic creation
>     >         >
>     >         > <nic>
>     >         >     <interface>virtio</interface>
>     >         >     <name>eth0</name>
>     >         >     <boot_protocol>static</boot_protocol>
>     >         >     <mac address='".$ip->mac_address."'/>
>     >         >     <network>
>     >         >      <ip address='".$ip->mac_ip."' netmask='255.255.255.0'
>     >         > gateway='".$ip->mac_gateway."'/>
>     >         >     </network>
>     >         >     <on_boot>true</on_boot>
>     >         >     <vnic_profile
>     id='bbabc471-667d-4221-bc8e-4ab30b3dcc34' />
>     >         >    </nic>
>     >         >
>     >         > <nic>
>     >         >     <interface>virtio</interface>
>     >         >     <name>eth1</name>
>     >         >     <boot_protocol>static</boot_protocol>
>     >         >     <mac address='".$ip->mac_address."'/>
>     >         >     <network>
>     >         >      <ip address='".$ip->mac_ip."' netmask='255.255.255.0'
>     >         > gateway='".$ip->mac_gateway."'/>
>     >         >     </network>
>     >         >     <on_boot>true</on_boot>
>     >         >     <vnic_profile
>     id='037d806f-d76b-4da3-84b6-ac7a5087f836' />
>     >         >    </nic>
>     >         >
>     >         > When i checked the configuration file
>     >         > (/etc/sysconfig/network-scripts/ifcfg-eth1) after
>     creating...i
>     >         find it
>     >         > seems the ONBOOT=no.....eventhough we set it true from the
>     >         api. Is this a
>     >         > bug ?
>     >
>     >         I do not know what "on_boot" means in oVirt API, but it
>     >         certainly is not
>     >         passed to Vdsm or the guest, and as such cannot control what's
>     >         in the
>     >         guest's /etc/sysconfig/network-scripts/ifcfg-eth1.
>     >
>     >         The guest may have ifcfg files, it may run NetworkManager,
>     or it
>     >         may be
>     >         Ubunto or Windows. oVirt is responsible to exposing a
>     (virtual)
>     >         NIC to
>     >         the guest, but does not interfere with its configuration.
>     >
>     >         Dan
>     >
>
>     The on_boot parameter that you pass when creating the NIC is completely
>     ignored, like all the other IP configuration parameters.
>
>     But looking at your screenshot it looks like you are already using
>     cloud-init to solve this. Are you using those <nic>...</nic> XML
>     documents as part of larger request to create a VM? In that case we need
>     to check the complete XML document in order to see if there is something
>     wrong. Can you share it?
>

--
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.