[Users] bonding setup with python sdk

Louis Coilliot louis.coilliot at think.fr
Wed Feb 13 11:54:35 UTC 2013


Hello,  thanks for your feedback.

The version is : rhevm-sdk-3.1.0.16-1.el6ev.noarch and latest from RHN.

About the nullify with or without params.Network() : this was from
Moti's blog example. I changed it with :

nic0 = params.HostNIC(name = 'eth0', network = params.Network(),
boot_protocol='none', ip=params.IP(address='', netmask='',
gateway=''))
nic1 = params.HostNIC(name = 'eth4', network = params.Network(),
boot_protocol='none', ip=params.IP(address='', netmask='',
gateway=''))

Same error message.

The NICS exist on the host :
# ip a | grep eth[0-9]
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq
state UP qlen 1000
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
6: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
7: eth5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
8: eth6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
9: eth7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000

The rhevm network exists before applying the script :
# ip a | grep rhevm
21: rhevm: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UNKNOWN
    inet 10.0.1.212/24 brd 10.0.1.255 scope global rhevm

Louis Coilliot


2013/2/13 Michael Pasternak <mpastern at redhat.com>:
>
> Louis,
>
> what is your sdk version? (make sure you have latest)
> here is your code (from http://kermit.fr/lofic/snipper/16/) with couple of comments inline
>
> #!/usr/bin/python
> from ovirtsdk.api import API
> from ovirtsdk.xml import params
>
> RHEVM='10.0.1.251'
> PORT='443'
> LOGIN='admin at internal'
> PASSWORD='nottherealpw'
>
> from ovirtsdk.api import API
> from ovirtsdk.xml import params
>
> baseurl = "https://%s:%s" % (RHEVM,PORT)
> api = API(url=baseurl, username=LOGIN, password=PASSWORD, insecure=True)
>
> nic0 = params.HostNIC(name = 'eth0', network = params.Network(), boot_protocol='none', ip=params.IP(address='', netmask='', gateway=''))
> nic1 = params.HostNIC(name = 'eth4', network = None)
>
> ==> this is ^ not correct, network should be overridden by the 'params.Network()'
>     (moti already submitted a patch preventing such syntax in the backend)
>
> ===> does both eth0/eth4 exist on your host?
>
> # bond0 definition on top of eth0 and eth4
> bond = params.Bonding(
>    slaves = params.Slaves(host_nic = [ nic0, nic1 ]),
>             options = params.Options(
>                         option = [
>                           params.Option(name = 'miimon', value = '100'),
>                           params.Option(name = 'mode', value = '1'),
>                           params.Option(name = 'primary', value = 'eth0')]
>                         )
>                       )
>
> # Configure the management network on top of the bond
> managementNetwork = params.HostNIC(network = params.Network(name = 'rhevm'),
>                       name = 'bond0',
>                       boot_protocol = 'static',
>                           ip = params.IP(
>                           address = '10.0.1.212',
>                           netmask = '255.255.255.0',
>                           gateway = '10.0.1.253'),
>                       override_configuration = 1,
>                       bonding = bond)
>
> # Now apply the configuration
> host = api.hosts.get('h1')
>
> host.nics.setupnetworks(params.Action(force = 0,
>                                       check_connectivity = 1,
>                                       host_nics = params.HostNics(host_nic = [ managementNetwork ])))
>
>
> On 02/13/2013 12:27 PM, Louis Coilliot wrote:
>> Thanks.
>>
>> The proper link is :
>> http://motiasayag.wordpress.com/2013/02/13/creating-networks-on-top-of-a-bond/
>>
>> Is it supposed to work for RHEV 3.1 ?
>>
>> I get :
>>
>> Traceback (most recent call last):
>>   File "./setbond.py", line 46, in <module>
>>     host_nics = params.HostNics(host_nic = [ managementNetwork ])))
>>   File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py",
>> line 2659, in setupnetworks
>>     headers={"Correlation-Id":correlation_id})
>>   File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py",
>> line 129, in request
>>     last=last)
>>   File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py",
>> line 158, in __doRequest
>>     raise RequestError, response
>> ovirtsdk.infrastructure.errors.RequestError:
>> status: 400
>> reason: Bad Request
>> detail: Entity not found: null
>>
>> From this test script :
>> http://kermit.fr/lofic/snipper/16/
>>
>> Louis Coilliot
>>
>> 2013/2/13 Michael Pasternak <mpastern at redhat.com>:
>>>
>>> Moti,
>>>
>>> Can you please add your setupnetworks example for bonds to the sdk wiki? (and post it on this thread)
>>>
>>> thanks.
>>>
>>> On 02/12/2013 06:40 PM, Louis Coilliot wrote:
>>>> Hello,
>>>>
>>>> do you have examples or hints on setting the bonding of some NICS on
>>>> hypervisor hosts ? With the python SDK ?
>>>>
>>>> Thanks in advance.
>>>>
>>>> Louis Coilliot
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at ovirt.org
>>>> http://lists.ovirt.org/mailman/listinfo/users
>>>
>>>
>>> --
>>>
>>> Michael Pasternak
>>> RedHat, ENG-Virtualization R&D
>>> _______________________________________________
>>> Users mailing list
>>> Users at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/users
>
>
> --
>
> Michael Pasternak
> RedHat, ENG-Virtualization R&D
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users



More information about the Users mailing list