Bug 911957 - Cannot add Network to interface without static IP (None or DHCP fail)
Summary: Cannot add Network to interface without static IP (None or DHCP fail)
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-webadmin
Version: 3.2
Hardware: All
OS: All
unspecified
high
Target Milestone: ---
: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact:
URL:
Whiteboard: network
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-16 23:34 UTC by Yamakasi
Modified: 2013-07-26 14:12 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-07-26 14:12:00 UTC
oVirt Team: ---
Embargoed:


Attachments (Terms of Use)

Description Yamakasi 2013-02-16 23:34:40 UTC
Description of problem:

Add a network to an interface and set the IP to NONE or DHCP. In both cases you get the following error while saving the made settings:

Error while executing action Setup Networks: Illegal or Incomplete IP Address

When setting a static IP things are fine.


Version-Release number of selected component (if applicable):

3.2

How reproducible:


Steps to Reproduce:
1. Create a Network
2. Add Network to an interface of a host
3. Set IP to None or DHCP.

  
Actual results:

 eth2 {id=713f2687-6d84-4010-9076-fbfc67cf6831, vdsId=033febb8-4f52-4253-bb6d-a8807816affd, name=eth2, macAddress=00:1c:c4:d8:cb:36, networkName=LAN_TEST, bondName=null, bootProtocol=NONE, address=, subnet=, gateway=null, mtu=0, bridged=false, speed=1000, type=0, networkImplementationDetails=null}],
    removedNetworks=[],
    removedBonds=[]), log id: 7a99dbd1
2013-02-12 23:31:08,783 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.SetupNetworksVDSCommand] (ajp--127.0.0.1-8702-10) [7289062c] FINISH, SetupNetworksVDSCommand, log id: 7a99dbd1
2013-02-12 23:31:09,796 ERROR [org.ovirt.engine.core.vdsbroker.vdsbroker.BrokerCommandBase] (ajp--127.0.0.1-8702-10) [7289062c] org.ovirt.engine.core.vdsbroker.vdsbroker.VDSNetworkException: VDSGenericException: VDSNetworkException: Specified netmask or gateway but not ip
2013-02-12 23:31:09,797 ERROR [org.ovirt.engine.core.vdsbroker.VDSCommandBase] (ajp--127.0.0.1-8702-10) [7289062c] Command SetupNetworksVDS execution failed. Exception: VDSNetworkException: VDSGenericException: VDSNetworkException: Specified netmask or gateway but not ip
2013-02-12 23:31:09,798 ERROR [org.ovirt.engine.core.bll.network.host.SetupNetworksCommand] (ajp--127.0.0.1-8702-10) [7289062c] Command org.ovirt.engine.core.bll.network.host.SetupNetworksCommand throw Vdc Bll exception. With error message VdcBLLException: org.ovirt.engine.core.vdsbroker.vdsbroker.VDSNetworkException: VDSGenericException: VDSNetworkException: Specified netmask or gateway but not ip


Expected results:

No Error!


Additional info:

Comment 1 Kapetanakis Giannis 2013-02-20 16:29:11 UTC
We had the same problem with vdsm-4.10.3-0.28.18.el6.x86_64

I guess it comes from:
/usr/share/vdsm/configNetwork.py:878

if not netmask:
   netmask = "255.255.255.0"

???

A change like the following solves this problem:
    if ipaddr and not netmask:
        netmask = "255.255.255.0"

Giannis

Comment 2 Yuriy Demchenko 2013-02-26 11:24:19 UTC
Same problem with vdsm.x86_64 4.10.3-0.30.19.el6

It seems the root of the problem from this: "bootProtocol=NONE, address=, subnet=, gateway=null", every operand but "gateway" set as "", while "gateway" set as "null"
and in /usr/share/vdsm/configNetwork.py:813 :
        if netmask or gateway:
            raise ConfigNetworkError(ne.ERR_BAD_ADDR,
                        "Specified netmask or gateway but not ip")
i presume "null" counts as word, so evaluation "if exist" gateway resolved as "true", so exception is raised.

So solution to this would be either pass "gateway=" (without "null" word, as other operands) in engine or change configNetwork.py check to count "null" as false.

Comment 3 Dan Kenigsberg 2013-02-26 12:22:23 UTC
(In reply to comment #1)
> We had the same problem with vdsm-4.10.3-0.28.18.el6.x86_64
> 
> I guess it comes from:
> /usr/share/vdsm/configNetwork.py:878
> 
> if not netmask:
>    netmask = "255.255.255.0"
> 
> ???
> 
> A change like the following solves this problem:
>     if ipaddr and not netmask:
>         netmask = "255.255.255.0"
> 
> Giannis

This piece of code does not come from stock vdsm, but from http://www.dreyou.org/ovirt/vdsm32.patch. Do you see any problem if you revert the following patch?

diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 53debfa..c8a80f1 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -873,6 +873,11 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None,
     _netinfo = netinfo.NetInfo()
     bridged = utils.tobool(bridged)
 
+    # Hack here, netmask may be not defined, if this happen,
+    # set netmask to 255.255.255.0
+    if not netmask:
+        netmask = "255.255.255.0"
+
     if mtu:
         mtu = int(mtu)

Comment 4 Pavel Zhukov 2013-02-26 12:36:59 UTC
From my opinion 
In the command: eth2 {id=713f2687-6d84-4010-9076-fbfc67cf6831, vdsId=033febb8-4f52-4253-bb6d-a8807816affd, name=eth2, macAddress=00:1c:c4:d8:cb:36, networkName=LAN_TEST, bondName=null, bootProtocol=NONE, address=, subnet=, gateway=null, mtu=0, bridged=false, speed=1000, type=0, networkImplementationDetails=null}],
    removedNetworks=[],

gateway=null
Should be:
gateway=
to follow format of address and subnet parameters. So it's ovirt-engine side, not vdsm.

Comment 5 Yuriy Demchenko 2013-02-26 12:42:11 UTC
(In reply to comment #3)
Yes - reverted patch did the job, without it I was able to add network with bootproto=none. 
sorry for wrong assumptions...

Comment 6 Dan Kenigsberg 2013-07-26 14:12:00 UTC
Given comment 5, closing notabug.


Note You need to log in before you can comment on or make changes to this bug.