Change in vdsm[master]: mom: add mom balloon functional tests for running vms

wudxw at linux.vnet.ibm.com wudxw at linux.vnet.ibm.com
Wed Apr 10 06:28:44 UTC 2013


Mark Wu has posted comments on this change.

Change subject: mom: add mom balloon functional tests for running vms
......................................................................


Patch Set 3: I would prefer that you didn't submit this

(3 inline comments)

....................................................
File tests/functional/Makefile.am
Line 26: 	xmlrpcTests.py \
Line 27: 	$(NULL)
Line 28: 
Line 29: dist_vdsmfunctests_DATA = \
Line 30:        60_test_balloon_shrink.policy \
you should use tab instead of whitespace
Line 31:        70_test_balloon_grow.policy \


....................................................
File tests/functional/momTests.py
Line 75:             except KeyError:
Line 76:                 pass
Line 77:         return candidateStats
Line 78: 
Line 79:     def _prepareTarget(self, operation, vmsOldStats):
I suggest you merge _prepareTarget and _filterVmsStats into one function, return a list of 'vmId'.  after you set policy, you can just check result of vm in this list.  It could avoid the nested loop in line 111
Line 80:         # Set the balloon target to max before shrink operation.
Line 81:         # Set the balloon target to 0.9*max before grow operation.
Line 82:         func = {"Shrink": lambda x: x, "Grow": lambda x: 0.9 * x}
Line 83:         for vmOldStats in vmsOldStats:


Line 106:         # Check the new balloon_cur in the proper range.
Line 107:         lower_bound_func = {'Shrink': lambda x: floor(0.9 * x),
Line 108:                             'Grow': lambda x: floor(0.99225 * x)}
Line 109:         upper_bound_func = {'Shrink': lambda x: ceil(0.9025 * x),
Line 110:                             'Grow': lambda x: ceil(x)}
it could be cleaner to define a namedtuple like this:
BalloonRatio = namedtuple('BalloonRatio', ['target', 'low', 'high')
shrinkRatio = BalloonRatio(1, 0.9, 0.9025)
growRatio = BalloonRatio(0.9, 0.99225, 1)
then you can use it in this way:
balloonCur >= balloonMax * shrinkRatio.low
balloonCur <= balloonMax * shrinkRatio.high
Line 111:         for vmNewStats in vmsNewStats:
Line 112:             for vmOldStats in vmsOldStats:
Line 113:                 if vmOldStats['vmId'] == vmNewStats['vmId']:
Line 114:                     balloonMax = vmOldStats['balloonInfo']['balloon_max']


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I922568233dc769d83e2fdffe1c24439d13d03d7e
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mei Liu <liumbj at linux.vnet.ibm.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Mei Liu <liumbj at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list