Hi Micheal, After updating the sdk I see change in documentation for hostnic addition and see bonding as a optional parameter, but I dont see it behaving it that way. When I try running the code to create and add NIC with Static IP assigned, I am facing same error where it is asking for bonding parameter and failing due to the same.
Also, I made sure I removed the previous sdk and ensured my program is using the latest sdk. The error that I get is mentioned below : *Traceback (most recent call last):* * File "rtest.py", line 51, in <module>* * host.nics.add(params.HostNIC(name = new_hostnic_name, network=network, boot_protocol = 'static', ip= new_ip))* * File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 2393, in add* * body=ParseHelper.toXml(hostnic))* * File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 117, in add* * return self.request('POST', url, body, headers)* * File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 128, in request* * last=last)* * File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 154, in __doRequest* * raise RequestError, response* *ovirtsdk.infrastructure.errors.RequestError:* *status: 400* *reason: Bad Request* *detail: HostNIC [bonding.slaves.id|name] required for add* * * * * The piece of code that I am using to do this is : *hostid = 0* *address = ip_start* *new_hostnic_name = 'em3.'+str(vlanId)* *for host in hosts :* * if host.cluster.id == cluster.id :* * hostid = hostid + 1* * add_splits = address.split('.')* * add_splits[3] = str(200 + hostid)* * address= '.'.join(add_splits)* * new_ip = params.IP(address = address , netmask = '255.255.255.0' )* * host.nics.add(params.HostNIC(name = new_hostnic_name, network=network, boot_protocol = 'static', ip= new_ip))* * * * host.commitnetconfig()* * * My requirement is that I do not want to using bonding while addition of a new NIC to the host, Also , I want to add the ip address to the new NIC at the time of creation itself. Regards, Rahul. On Fri, Jul 6, 2012 at 12:33 PM, Rahul Upadhyaya <rak...@gmail.com> wrote: > > Thanks Michael, > > I had a older version of the python-binding which had bonding in #1 as > a compulsory parameter... Seeing your options I updated the sdk and now the > error is resolved. I see bonding as an optional param. > > Regards, > Rahul. > > > ---------- Forwarded message ---------- > From: Michael Pasternak <mpast...@redhat.com> > Date: Thu, Jul 5, 2012 at 7:22 PM > Subject: Re: [Users] HostNic Addition with IP Address > To: Rahul Upadhyaya <rak...@gmail.com> > Cc: users@ovirt.org > > > > Hi Rahul, > > #1 is the right place for doing this, see method __doc__ [1] > #2 used for attaching network to NIC, see __doc__ is [2] > > * note all methods in sdk well documented describing what > parameters-holder to use and how to fill it. > > [1] > ''' > @type HostNIC: > > @param hostnic.network.id|name: string > @param hostnic.name: string > [@param hostnic.bonding.slaves.host_nic: collection] > { > [@ivar host_nic.id|name: string] > } > [@param hostnic.bonding.options.option: collection] > { > [@ivar option.name: string] > [@ivar option.value: string] > [@ivar type: string] > } > [@param hostnic.ip.gateway: string] > [@param hostnic.boot_protocol: string] > [@param hostnic.mac: string] > [@param hostnic.ip.address: string] > [@param hostnic.ip.netmask: string] > > @return HostNIC: > ''' > > [2] > ''' > @type Action: > > @param action.network.id|name: string > [@param action.async: boolean] > [@param action.grace_period.expiry: long] > > @return Response: > ''' > > On 07/05/2012 03:00 PM, Rahul Upadhyaya wrote: > > Hi Folks, > > > > I am facing issues while adding NIC with Static I.P. to > host using the oVirt Python-Bindings. There are two api's > > > > 1) HostNics.add :Here it requires binding param for > interface bonding as a compulsory param. I dont want to bond more than one > interfaces for a network > > while creating network each time. > > > > 2) HostNic.attach: This lets me attach the NIC but > does not let me put static IP address to it as soon as I add it. I am using > a workaround of updating > > the NIC with the IP information, but it requires me to put all the hosts > on maintenance and shut-down all the running VMs which again is not the > best way of doing it. > > > > > > Is it not supported by the API that at the time of addition of the > hostNIC we can specify the IP address or is it something that I am missing ? > > Also,I see that this operation is supported from the manager UI . > > > > > > -- > > Regards, > > Rahul > > ======================================================= > > > > > > > > _______________________________________________ > > Users mailing list > > Users@ovirt.org > > http://lists.ovirt.org/mailman/listinfo/users > > > -- > > Michael Pasternak > RedHat, ENG-Virtualization R&D > > > > -- > Regards, > Rahul > ======================================================= > > -- Regards, Rahul =======================================================
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users