Change in vdsm[master]: network: synced configs

phoracek at redhat.com phoracek at redhat.com
Tue Nov 11 11:31:39 UTC 2014


Petr Horáček has uploaded a new change for review.

Change subject: network: synced configs
......................................................................

network: synced configs

TODO

Change-Id: Ic9b16cef3afba2c5b46efd45529823b879e98f1e
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M vdsm/network/configurators/ifcfg.py
1 file changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/35031/1

diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index 6c91455..5925d1f 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -18,6 +18,7 @@
 #
 from __future__ import absolute_import
 
+from contextlib import contextmanager
 import glob
 import logging
 import os
@@ -36,6 +37,7 @@
 from vdsm import netinfo
 from vdsm import utils
 from vdsm.netconfpersistence import RunningConfig
+from vdsm.netlink import monitor
 
 if utils.isOvirtNode():
     from ovirt.node.utils import fs as node_fs
@@ -832,3 +834,21 @@
                     ports.append(port)
                     break
     return ports
+
+
+ at contextmanager
+def sync_action(timeout=None, **kwargs):
+    mon = monitor.Monitor(groups=['link'], timeout=timeout)
+    mon.start()
+    try:
+        yield
+    finally:
+        for m in mon:
+            try:
+                # this is not the most efficient way, but it's beautiful
+                # on the other hand, to use a cycle would be probably faster
+                if all([kwargs[k] == m[k] for k in kwargs.keys()]):
+                    mon.stop()
+                    break
+            except KeyError:
+                pass


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9b16cef3afba2c5b46efd45529823b879e98f1e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>


More information about the vdsm-patches mailing list