Change in vdsm[ovirt-3.6]: net: Fix dhcp reporting

edwardh at redhat.com edwardh at redhat.com
Mon Feb 22 13:10:49 UTC 2016


Edward Haas has uploaded a new change for review.

Change subject: net: Fix dhcp reporting
......................................................................

net: Fix dhcp reporting

DHCP functional tests failed when running in ifcfg configuration mode.
(testSetupNetworksAddDelDhcp)

Main issue is with the dhcp status report: It is not faked like with the
unified configuration mode, but checked in the dhcp lease.
It is now faked from the ifcfg interface file.

Change-Id: I7879ff488d26bc9993416b1af9635d5e882d9123
Bug-Url: https://bugzilla.redhat.com/1310410
Signed-off-by: Edward Haas <edwardh at redhat.com>
---
M lib/vdsm/netinfo.py
M lib/vdsm/utils.py
2 files changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/53827/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index ad35072..70bf10c 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -46,7 +46,7 @@
 from .netlink import link as nl_link
 from .netlink import addr as nl_addr
 from .netlink import route as nl_route
-from .utils import memoized
+from .utils import memoized, is_persistence_unified
 
 
 NET_CONF_DIR = '/etc/sysconfig/network-scripts/'
@@ -451,6 +451,17 @@
 def _dhcp_used(iface, ifaces_with_active_leases, net_attrs, family=4):
     if net_attrs is None:
         logging.debug('There is no VDSM network configured on %s.' % iface)
+        if not is_persistence_unified():
+            cfg = getIfaceCfg(iface)
+            return ((family == 4 and
+                     cfg.get('BOOTPROTO', 'none') == 'dhcp') or
+                    (family == 6 and
+                     cfg.get('IPV6INIT', 'no') == 'yes' and
+                     cfg.get('BOOTPROTO', 'none') == 'dhcp') or
+                    (family == 6 and
+                     cfg.get('IPV6INIT', 'no') == 'yes' and
+                     cfg.get('DHCPV6C', 'no') == 'yes'))
+
         return iface in ifaces_with_active_leases
     else:
         try:
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index c67581b..f1bacee 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -1313,3 +1313,7 @@
         return func(inst, *args, **kwargs)
 
     return wrapper
+
+
+def is_persistence_unified():
+    return config.get('vars', 'net_persistence') == 'unified'


-- 
To view, visit https://gerrit.ovirt.org/53827
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7879ff488d26bc9993416b1af9635d5e882d9123
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Edward Haas <edwardh at redhat.com>


More information about the vdsm-patches mailing list