Change in vdsm[ovirt-3.5]: unified_persistence: only consider bonds created/touched by ...

asegurap at redhat.com asegurap at redhat.com
Wed Sep 10 13:00:47 UTC 2014


Hello Dan Kenigsberg,

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

    http://gerrit.ovirt.org/32769

to review the following change.

Change subject: unified_persistence: only consider bonds created/touched by vdsm
......................................................................

unified_persistence: only consider bonds created/touched by vdsm

When upgrading a system to unified persistence we were considering
any non empty bond as a bond to persist under unified persistence.
This was not consistent with our implementation of ifcfg.flush that
only considers ifcfg files with the vdsm authoring header.

The patch fixes the behavior by making ifcfg flush and
unified_persistence upgrade consistent in it's ownership semantics,
i.e., we will not touch nor consider for persistence files not
markedly authored by vdsm.

A side effect of the lack of consistency was that a bond that was
providing connectivity to a machine could be made to be onboot no
if it was not immediately the backing device of ovirtmgmt.

Change-Id: Ic7f65546c55396ddf7022f5ffe17540ce0680d22
Bug-Url: https://bugzilla.redhat.com/1128140
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/32703
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/tool/unified_persistence.py
1 file changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/32769/1

diff --git a/lib/vdsm/tool/unified_persistence.py b/lib/vdsm/tool/unified_persistence.py
index c59531c..1733c97 100644
--- a/lib/vdsm/tool/unified_persistence.py
+++ b/lib/vdsm/tool/unified_persistence.py
@@ -16,13 +16,13 @@
 #
 # Refer to the README and COPYING files for full details of the license
 #
-
+import errno
 import logging
 
 from .. import utils
 from ..config import config
 from ..netconfpersistence import RunningConfig
-from ..netinfo import NetInfo, getIfaceCfg, getDefaultGateway
+from ..netinfo import NET_CONF_PREF, NetInfo, getIfaceCfg, getDefaultGateway
 from . import expose
 from .upgrade import apply_upgrade
 
@@ -116,7 +116,7 @@
         bondings = {}
         for bonding, bondingParams in netinfo.bondings.iteritems():
             # If the bond is unused, skip it
-            if not bondingParams['slaves']:
+            if not bondingParams['slaves'] or not _owned(bonding):
                 continue
 
             bondings[bonding] = {'nics': bondingParams['slaves']}
@@ -145,6 +145,20 @@
     runningConfig.store()
 
 
+def _owned(devname):
+    try:
+        with open(NET_CONF_PREF + devname) as conf:
+            content = conf.read()
+    except IOError as ioe:
+        if ioe.errno == errno.ENOENT:
+            return False
+        else:
+            raise
+    else:
+        return (content.startswith('# Generated by VDSM version') or
+                content.startswith('# automatically generated by vdsm'))
+
+
 def isNeeded():
     return config.get('vars', 'net_persistence') == 'unified'
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7f65546c55396ddf7022f5ffe17540ce0680d22
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list