Change in vdsm[master]: VmStatsThread: make _getNicStats testable

asegurap at redhat.com asegurap at redhat.com
Fri Mar 21 14:12:25 UTC 2014


Antoni Segura Puimedon has posted comments on this change.

Change subject: VmStatsThread: make _getNicStats testable
......................................................................


Patch Set 1: Code-Review-1

(3 comments)

Minor things. -1 for visibility

http://gerrit.ovirt.org/#/c/25982/1/tests/vmTests.py
File tests/vmTests.py:

Line 761:     def testGetNicStats(self):
Line 762:         GBPS = 10 ** 9 / 8
Line 763:         with FakeVM() as fake:
Line 764:             mock_stats_thread = vm.VmStatsThread(fake)
Line 765:             res = mock_stats_thread._getNicStats(
This method has soooooo many parameters that I would appreciate passing them as keyword arguments.
Line 766:                 'vnettest', 'virtio', '00:11',
Line 767:                 (2 ** 64 - 15 * GBPS, 1, 2, 3, 0, 4, 5, 6),
Line 768:                 (0, 7, 8, 9, 5 * GBPS, 10, 11, 12),
Line 769:                 15.0)


Line 762:         GBPS = 10 ** 9 / 8
Line 763:         with FakeVM() as fake:
Line 764:             mock_stats_thread = vm.VmStatsThread(fake)
Line 765:             res = mock_stats_thread._getNicStats(
Line 766:                 'vnettest', 'virtio', '00:11',
why use a wrongly formatted mac?
Line 767:                 (2 ** 64 - 15 * GBPS, 1, 2, 3, 0, 4, 5, 6),
Line 768:                 (0, 7, 8, 9, 5 * GBPS, 10, 11, 12),
Line 769:                 15.0)
Line 770:             self.assertEqual(res, {


http://gerrit.ovirt.org/#/c/25982/1/vdsm/vm.py
File vdsm/vm.py:

Line 584:             self._log.debug("CPU stats not available: %s", e)
Line 585:             stats['cpuUser'] = 0.0
Line 586:             stats['cpuSys'] = 0.0
Line 587: 
Line 588:     def _getNicStats(self, name, model, mac, sInfo, eInfo, sampleInterval):
could we have start_sample/startSample and end_sample/endSample and s/sampleInterval/interval?
Line 589:         ifSpeed = [100, 1000][model in ('e1000', 'virtio')]
Line 590: 
Line 591:         ifStats = {'macAddr': mac,
Line 592:                    'name': name,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibd6ffa12341b814775bea96a47365645b571f3a8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list