On 05/06/2016 05:20 PM, Fabrice Bacchella wrote:
> I'm following the example given
> in http://www.ovirt.org/develop/api/pythonapi/ for bonding interfaces.
> 
> I'm checking that the network is a plain configuration,
> exporting /api/hosts/<my host>/nics return :
> 
> <HostNIC
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/958c40cd-9ddb-4548-8bd8-79f454021c35"
> id="958c40cd-9ddb-4548-8bd8-79f454021c35">
>     <actions>
>         <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/958c40cd-9ddb-4548-8bd8-79f454021c35/attach"
> rel="attach"/>
>         <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/958c40cd-9ddb-4548-8bd8-79f454021c35/detach"
> rel="detach"/>
>     </actions>
>     <name>eth1</name>
>     <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/958c40cd-9ddb-4548-8bd8-79f454021c35/statistics"
> rel="statistics"/>
>     <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/958c40cd-9ddb-4548-8bd8-79f454021c35/labels"
> rel="labels"/>
>     <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/958c40cd-9ddb-4548-8bd8-79f454021c35/networkattachments"
> rel="networkattachments"/>
>     <host href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1"
> id="db240f83-9266-4892-a6d2-8ac406cadfb1"/>
>     <mac address="14:58:d0:b3:cc:f8"/>
>     <ip netmask="" address=""/>
>     <boot_protocol>none</boot_protocol>
>     <status>
>         <state>down</state>
>     </status>
>     <mtu>1500</mtu>
>     <bridged>false</bridged>
> </HostNIC>
> 
> <HostNIC
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/87a274e8-9633-45df-9205-1d188bd3ee4c"
> id="87a274e8-9633-45df-9205-1d188bd3ee4c">
>     <actions>
>         <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/87a274e8-9633-45df-9205-1d188bd3ee4c/attach"
> rel="attach"/>
>         <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/87a274e8-9633-45df-9205-1d188bd3ee4c/detach"
> rel="detach"/>
>     </actions>
>     <name>eth0</name>
>     <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/87a274e8-9633-45df-9205-1d188bd3ee4c/statistics"
> rel="statistics"/>
>     <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/87a274e8-9633-45df-9205-1d188bd3ee4c/labels"
> rel="labels"/>
>     <link
> href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/nics/87a274e8-9633-45df-9205-1d188bd3ee4c/networkattachments"
> rel="networkattachments"/>
>     <host href="/api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1"
> id="db240f83-9266-4892-a6d2-8ac406cadfb1"/>
>     <network href="/api/networks/f429c46c-fed4-4c88-a000-36c021f5d633"
> id="f429c46c-fed4-4c88-a000-36c021f5d633"/>
>     <mac address="14:58:d0:b3:cc:f0"/>
>     <ip netmask="255.255.240.0" gateway="10.83.31.254"
> address="10.83.17.24"/>
>     <boot_protocol>dhcp</boot_protocol>
>     <speed>10000000000</speed>
>     <status>
>         <state>up</state>
>     </status>
>     <mtu>9000</mtu>
>     <bridged>true</bridged>
>     <custom_configuration>false</custom_configuration>
>     <properties/>
> </HostNIC>
> 
> I send my configuration and get :
> 
>> POST /api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/setupnetworks
> HTTP/1.1
> ...
>> my configuration
> 
> < HTTP/1.1 200 OK
> 
> < <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> < <action>
> <     <host_nics>
> <         <host_nic>
> <             <name>bond0</name>
> <             <network>
> <                 <name>ovirtmgmt</name>
> <             </network>
> <             <ip address="10.83.17.24" netmask="10.83.16.0"
> gateway="10.83.31.254"/>
> <             <bonding>
> <                 <options>
> <                     <option name="miimon" value="100"/>
> <                     <option name="mode" value="4"/>
> <                     <option name="xmit_hash_policy" value="2+3"/>
> <                 </options>
> <                 <slaves>
> <                     <host_nic>
> <                         <name>eth0</name>
> <                         <network/>
> <                         <ip address="*" netmask="*" gateway=""/>
> <                         <boot_protocol>none</boot_protocol>
> <                         <mtu>9000</mtu>
> <                     </host_nic>
> <                     <host_nic>
> <                         <name>eth1</name>
> <                         <network/>
> <                         <ip address="*" netmask="*" gateway=""/>
> <                         <boot_protocol>none</boot_protocol>
> <                         <mtu>9000</mtu>
> <                     </host_nic>
> <                 </slaves>
> <             </bonding>
> <             <boot_protocol>static</boot_protocol>
> <             <mtu>9000</mtu>
> <             <override_configuration>true</override_configuration>
> <         </host_nic>
> <     </host_nics>
> <     <check_connectivity>true</check_connectivity>
> <     <force>false</force>
> <     <job href="/api/jobs/859bc27c-2060-4349-a0f5-dc1dd6333e6c"
> id="859bc27c-2060-4349-a0f5-dc1dd6333e6c"/>
> <     <status>
> <         <state>complete</state>
> <     </status>
> < </action>
> 
> 
> So every thing is fine, I applied my configuration.
> 
> But in the log, I get :
> 2016-05-06 17:13:22,481 INFO
>  [org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand]
> (default task-20) [30e54e04] Lock Acquired to object
> 'EngineLock:{exclusiveLocks='[db240f83-9266-4892-a6d2-8ac406cadfb1=<HOST_NETWORK,
>  ACTION_TYPE_FAILED_SETUP_NETWORKS_IN_PROGRESS>]',
> sharedLocks='null'}'
> 2016-05-06 17:13:22,555
> INFO  [org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand]
> (default task-20) [30e54e04] Running command: HostSetupNetworksCommand
> internal: false. Entities affected :  ID:
> db240f83-9266-4892-a6d2-8ac406cadfb1 Type: VDSAction group
> CONFIGURE_HOST_NETWORK with role type ADMIN
> 2016-05-06 17:13:22,555
> INFO  [org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand]
> (default task-20) [30e54e04] No changes were detected in setup networks
> for host 'nb0101' (ID: 'db240f83-9266-4892-a6d2-8ac406cadfb1')
> 2016-05-06 17:13:22,563
> INFO  [org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand]
> (default task-20) [30e54e04] Lock freed to object
> 'EngineLock:{exclusiveLocks='[db240f83-9266-4892-a6d2-8ac406cadfb1=<HOST_NETWORK,
>  ACTION_TYPE_FAILED_SETUP_NETWORKS_IN_PROGRESS>]',
> sharedLocks='null'}'
> 
> And indeed my configuration is not changed.
> 
> What am I missing ?
> 

The example that you mention describes the old and deprecated
/hosts/{host:id}/nics/setupnetworks action, but you are sending the
request to /hosts/{host:id}/setupnetworks, which just ignores the
"host_nics" elements that you are sending. There is an example of how to
use the newer action here:


https://jhernand.fedorapeople.org/ovirt-api-explorer/#/services/host/methods/setup-networks

-- 
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.
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users

Reply via email to