Change in vdsm[master]: Don't reconfigure vlan devs unless necessary.

psebek at redhat.com psebek at redhat.com
Thu Aug 8 10:16:40 UTC 2013


Petr Šebek has posted comments on this change.

Change subject: Don't reconfigure vlan devs unless necessary.
......................................................................


Patch Set 4:

(1 comment)

....................................................
File vdsm/netmodels.py
Line 186:                frozenset(netinfo.slaves(self.name))):
Line 187:             self.configurator.configureBond(self, **opts)
Line 188: 
Line 189:     def _are_options_applied(self):
Line 190:         active_opts = netinfo.bondOpts(self.name)
I tried it and with one quarter of opts (9/34) it runs less than twice faster:

Original:

  >>> timeit vn.bondOpts('bond4')
  1000 loops, best of 3: 1.42 ms per loop

Reduced:
def bondndOpts2(bonding, optNames):
    opts = []
    for path in iglob(BONDING_OPTS % bonding):
        optName = os.path.basename(path)
        if os.path.isfile(path) and optName in optNames:
            with open(path) as optFile:
                for optValue in optFile.read().rstrip().split(' '):
                    opts.append((optName, optValue))
    return frozenset(opts)

  >>> len(l2)
  17

  >>> timeit bondndOpts2('bond4', l2)
  1000 loops, best of 3: 1.03 ms per loop

  >>> len(l4)
  9

  >>> timeit bondndOpts2('bond4', l4)
  1000 loops, best of 3: 807 us per loop

It is faster, but I think it will add unnecessary complexity to this code. And I think adding parameters to check would open gate for forgeting some name and thus errors. I would keep it like it is.
Line 191:         return all(tuple(opt.split('=', 1)) in active_opts for
Line 192:                    opt in self.options.split(' '))
Line 193: 
Line 194:     def remove(self):


-- 
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: 4
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: 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