Hello Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/28133

to review the following change.

Change subject: network: publish and honor blockingdhcp setting
......................................................................

network: publish and honor blockingdhcp setting

blockingdhcp is an old unpublished network option that allows the
user to specify that the network configuring should wait for the
result of upping a dhcp configured interface. When moving to the
packed (as oposed to unpacked, i.e., **opts) options for
objectivizeNetworks, this option stopped reaching the network
models, and thus, stopped being applied.

This patch re-enables blockingdhcp, publishing it in the API so
that we continue to honor it.

Bug-Url: https://bugzilla.redhat.com/1101326
Change-Id: Id20bdf848dd0ace8d958a1665b3a54b3c18c9b23
Signed-off-by: Antoni S. Puimedon <asegu...@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/28048
Reviewed-by: Dan Kenigsberg <dan...@redhat.com>
---
M tests/functional/networkTests.py
M vdsm/configNetwork.py
M vdsm/netmodels.py
M vdsm_api/vdsmapi-schema.json
4 files changed, 22 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/28133/1

diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index b8028e8..141b47b 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -1695,7 +1695,8 @@
             veth.setLinkUp(left)
             with dnsmasqDhcp(left):
                 network = {NETWORK_NAME: {'nic': right, 'bridged': False,
-                                          'bootprot': 'dhcp'}}
+                                          'bootproto': 'dhcp',
+                                          'blockingdhcp': True}}
 
                 status, msg = self.vdsm_net.setupNetworks(network, {}, NOCHK)
                 self.assertEqual(status, SUCCESS, msg)
@@ -1762,3 +1763,14 @@
             bonds[BONDING_NAME] = {'remove': True}
             status, msg = self.vdsm_net.setupNetworks({}, bonds, NOCHK)
             self.assertEqual(status, SUCCESS, msg)
+
+    @cleanupNet
+    @ValidateRunningAsRoot
+    def testHonorBlockingDhcp(self):
+        status, msg = self.vdsm_net.setupNetworks(
+            {NETWORK_NAME: {'bridged': True, 'bootproto': 'dhcp',
+                            'blockingdhcp': True}}, {}, NOCHK)
+        # Without blocking dhcp, the setupNetworks command would return
+        # reporting success before knowing if dhclient succeeded. With blocking
+        # it must not report success
+        self.assertNotEqual(status, SUCCESS, msg)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 2b3ebe6..98f6c10 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -225,7 +225,7 @@
                ipv6addr=None, ipv6gateway=None, force=False,
                configurator=None, bondingOptions=None, bridged=True,
                _netinfo=None, qosInbound=None, qosOutbound=None,
-               defaultRoute=None, **options):
+               defaultRoute=None, blockingdhcp=False, **options):
     nics = nics or ()
     if _netinfo is None:
         _netinfo = netinfo.NetInfo()
@@ -283,7 +283,8 @@
                                 bondingOptions, nics, mtu, ipaddr, netmask,
                                 gateway, bootproto, ipv6addr, ipv6gateway,
                                 defaultRoute=defaultRoute, _netinfo=_netinfo,
-                                configurator=configurator, **options)
+                                configurator=configurator,
+                                blockingdhcp=blockingdhcp, **options)
 
     netEnt.configure(**options)
     configurator.configureLibvirtNetwork(network, netEnt,
diff --git a/vdsm/netmodels.py b/vdsm/netmodels.py
index f718670..de30c26 100644
--- a/vdsm/netmodels.py
+++ b/vdsm/netmodels.py
@@ -422,7 +422,7 @@
         self.inet4 = inet4
         self.inet6 = inet6
         self.bootproto = bootproto
-        self.async = bootproto == 'dhcp' and blocking
+        self.async = bootproto == 'dhcp' and not blocking
         self.ipv6autoconf = ipv6autoconf
         self.dhcpv6 = dhcpv6
 
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index a7cc1fe..3140378 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -57,6 +57,10 @@
 # @bootproto:       #optional Interface autoconfiguration protocol (typically
 #                   'dhcp' or 'static')
 #
+# @blockingdhcp:    #optional whether ifaces that have 'dhcp' as bootproto
+#                   should wait to get an address before returning creation
+#                   success. If not set, the default is False.
+#
 # @bondingOptions:  #optional A string of space-separated <option>=<value> 
pairs
 #
 # @qosInbound:      #optional BandwidthParams for incoming traffic.
@@ -68,7 +72,7 @@
 {'type': 'NetworkOptions',
  'data': {'*ipaddr': 'str', '*netmask': 'str', '*gateway': 'str',
           '*bootproto': 'str', '*bondingOptions', 'str',
-          '*qosInbound': 'BandwidthParams',
+          '*blockingdhcp': 'bool', '*qosInbound': 'BandwidthParams',
           '*qosOutbound': 'BandwidthParams'}}
 
 ##


-- 
To view, visit http://gerrit.ovirt.org/28133
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id20bdf848dd0ace8d958a1665b3a54b3c18c9b23
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Antoni Segura Puimedon <asegu...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to