Change in vdsm[master]: Don't down bonds and nics when adding vlan or resizing

asegurap at redhat.com asegurap at redhat.com
Sat Aug 10 07:41:11 UTC 2013


Antoni Segura Puimedon has posted comments on this change.

Change subject: Don't down bonds and nics when adding vlan or resizing
......................................................................


Patch Set 7:

(1 comment)

There are two ways of testing it, if you mean functional tests. Both require
the use of a thread that monitors the operstate.

One thread version could be:

from Queue import Queue

@contextmanager
def operstate_monitor(device)
    def changed(dev, changes)
        result = True
        status = open('/sys/class/net/%s/operstate' % dev).read()
        while not end:
            new_status = open('/sys/class/net/%s/operstate' % dev).read()
            if status != new_status:
                changes.append(new_status)
                status = new_status

    try:
        done = False
        changes = []
        monitoring_t = threading.Thread(targed=changed, name='operstate_mon',
                                        args=(device, changes))
        monitoring_t.start()
    finally:
        done = True
        if changes:
            raise ValueError('%s operstate changed: %r', % (device, changes))

We'd have to make sure that updating of sysfs is fast enough to detect the
changes in the case it goes down and up very fast. Otherwise, we can have
a test time dependency on pyroute2 (it wouldn't go to the spec.in file) that
if it is missing we skip the test. Pyroute2 would allow us to register to the
netlink events and after the test check that there were no link state changes.

....................................................
File lib/vdsm/netinfo.py
Line 218: 
Line 219: def bondOpts(bonding):
Line 220:     opts = []
Line 221:     for path in iglob(BONDING_OPTS % bonding):
Line 222:         if os.path.isfile(path):
To avoid try catching when this information is needed. It could be changed though.
Line 223:             with open(path) as optFile:
Line 224:                 optName = os.path.basename(path)
Line 225:                 for optValue in optFile.read().rstrip().split(' '):
Line 226:                     opts.append((optName, optValue))


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3075a2e65f06416c840c6a98689b77555b22e5d
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Livnat Peer <lpeer at redhat.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Petr Ĺ ebek <psebek at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list