Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
gerrit-hooks has posted comments on this change. Change subject: net: Relocating wait-for-event under its own module. .. Patch Set 2: * update_tracker: OK * Set MODIFIED::bug 1379115#1379115IGNORE, not all related patches are closed, check 64403 -- To view, visit https://gerrit.ovirt.org/64393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Edward HaasGerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
Dan Kenigsberg has submitted this change and it was merged. Change subject: net: Relocating wait-for-event under its own module. .. net: Relocating wait-for-event under its own module. Creating waitfor module under the netlink package. To be used as a context manager that waits for a specific event to arrive (using monitor module) before proceeding with the context body. Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Signed-off-by: Edward HaasBug-Url: https://bugzilla.redhat.com/1379115 Reviewed-on: https://gerrit.ovirt.org/62876 Continuous-Integration: Jenkins CI Reviewed-by: Petr Horáček Reviewed-by: Dan Kenigsberg Reviewed-on: https://gerrit.ovirt.org/64393 --- M lib/vdsm/network/configurators/ifcfg.py M lib/vdsm/network/link/iface.py M lib/vdsm/network/netlink/Makefile.am A lib/vdsm/network/netlink/waitfor.py M vdsm.spec.in 5 files changed, 102 insertions(+), 47 deletions(-) Approvals: Jenkins CI: Passed CI tests Petr Horáček: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved Edward Haas: Verified -- To view, visit https://gerrit.ovirt.org/64393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Edward Haas Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
Dan Kenigsberg has posted comments on this change. Change subject: net: Relocating wait-for-event under its own module. .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.ovirt.org/64393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Edward HaasGerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
Petr Horáček has posted comments on this change. Change subject: net: Relocating wait-for-event under its own module. .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/64393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Edward HaasGerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
Edward Haas has posted comments on this change. Change subject: net: Relocating wait-for-event under its own module. .. Patch Set 1: Verified+1 Func tests passed -- To view, visit https://gerrit.ovirt.org/64393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Edward HaasGerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Edward Haas Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
gerrit-hooks has posted comments on this change. Change subject: net: Relocating wait-for-event under its own module. .. Patch Set 1: * #1379115::Update tracker: OK * Check Bug-Url::OK * Check Public Bug::#1379115::OK, public bug * Check Product::#1379115::OK, Correct classification oVirt * Check TM::#1379115::OK, correct target milestone ovirt-4.0.5 * Check merged to previous::OK, change not open on any previous branch -- To view, visit https://gerrit.ovirt.org/64393 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-4.0 Gerrit-Owner: Edward HaasGerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Petr Horáček Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org
Change in vdsm[ovirt-4.0]: net: Relocating wait-for-event under its own module.
Hello Petr Horáček, Dan Kenigsberg, I'd like you to do a code review. Please visit https://gerrit.ovirt.org/64393 to review the following change. Change subject: net: Relocating wait-for-event under its own module. .. net: Relocating wait-for-event under its own module. Creating waitfor module under the netlink package. To be used as a context manager that waits for a specific event to arrive (using monitor module) before proceeding with the context body. Change-Id: Ie99c93083fd4db7a2d20518c06e70da5bc333a71 Signed-off-by: Edward HaasBug-Url: https://bugzilla.redhat.com/1379115 Reviewed-on: https://gerrit.ovirt.org/62876 Continuous-Integration: Jenkins CI Reviewed-by: Petr Horáček Reviewed-by: Dan Kenigsberg --- M lib/vdsm/network/configurators/ifcfg.py M lib/vdsm/network/link/iface.py M lib/vdsm/network/netlink/Makefile.am A lib/vdsm/network/netlink/waitfor.py M vdsm.spec.in 5 files changed, 102 insertions(+), 47 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/64393/1 diff --git a/lib/vdsm/network/configurators/ifcfg.py b/lib/vdsm/network/configurators/ifcfg.py index ea09dc3..1d4d6fc 100644 --- a/lib/vdsm/network/configurators/ifcfg.py +++ b/lib/vdsm/network/configurators/ifcfg.py @@ -51,7 +51,7 @@ from vdsm.network.netinfo import (bonding as netinfo_bonding, mtus, nics, vlans, misc, NET_PATH) from vdsm.network.netinfo.cache import ifaceUsed -from vdsm.network.netlink import monitor +from vdsm.network.netlink import waitfor if utils.isOvirtNode(): from ovirt.node.utils import fs as node_fs @@ -854,12 +854,11 @@ else: if not iface.master and (iface.ipv4 or iface.ipv6): if iface.ipv4: -expected_event = {'label': iface.name, 'family': 'inet', - 'scope': 'global'} +wait_for_ip = waitfor.waitfor_ipv4_addr elif iface.ipv6: -expected_event = {'label': iface.name, 'family': 'inet6', - 'scope': 'global'} -with _wait_for_event(iface, expected_event): +wait_for_ip = waitfor.waitfor_ipv6_addr + +with wait_for_ip(iface.name): _exec_ifup(iface, cgroup) else: _exec_ifup(iface, cgroup) @@ -986,31 +985,3 @@ ifcfgs.add(ROUTE_PATH % top_level_device) return ifcfgs - - -def _is_subdict(subdict, superdict): -return all(item in frozenset(superdict.items()) - for item in frozenset(subdict.items())) - - -@contextmanager -def _wait_for_event(iface, expected_event, timeout=10): -with monitor.Monitor(groups=('ipv4-ifaddr', 'ipv6-ifaddr'), - timeout=timeout) as mon: -try: -yield -finally: -caught_events = [] -try: -for event in mon: -caught_events.append(event) -if _is_subdict(expected_event, event): -return -except monitor.MonitorError as e: -if e[0] == monitor.E_TIMEOUT: -logging.warning('Expected event "%s" of interface "%s" ' -'was not caught within the given timeout. ' -'Caught events: %s', expected_event, iface, -caught_events) -else: -raise diff --git a/lib/vdsm/network/link/iface.py b/lib/vdsm/network/link/iface.py index e2c4d3c..011d7de 100644 --- a/lib/vdsm/network/link/iface.py +++ b/lib/vdsm/network/link/iface.py @@ -18,12 +18,10 @@ # from __future__ import absolute_import -import logging - from vdsm.network import ipwrapper from vdsm.network.netlink import link from vdsm.network.netlink.link import get_link, is_link_up -from vdsm.network.netlink.monitor import Monitor +from vdsm.network.netlink.waitfor import waitfor_linkup STATE_UP = 'up' @@ -64,14 +62,6 @@ return bool(get_link(dev)['flags'] & link.IFF_PROMISC) -def _up_blocking(dev, oper_blocking): -iface_up_check = is_oper_up if oper_blocking else is_up -with Monitor(groups=('link',), timeout=2, silent_timeout=True) as mon: +def _up_blocking(dev, link_blocking): +with waitfor_linkup(dev, link_blocking): ipwrapper.linkSet(dev, [STATE_UP]) -if iface_up_check(dev): -return -mon_device = (e for e in mon if e.get('name') == dev) -for event in mon_device: -logging.info('Monitor event: %s', event) -if is_link_up(event.get('flags', 0), oper_blocking): -return diff --git a/lib/vdsm/network/netlink/Makefile.am b/lib/vdsm/network/netlink/Makefile.am index 5cf018a..cc4ca26 100644 --- a/lib/vdsm/network/netlink/Makefile.am +++