Change in vdsm[master]: hooks: Add hook for fake VM stats
mtayer at redhat.com
mtayer at redhat.com
Wed Apr 2 14:38:36 UTC 2014
mooli tayer has posted comments on this change.
Change subject: hooks: Add hook for fake VM stats
......................................................................
Patch Set 10:
(3 comments)
http://gerrit.ovirt.org/#/c/25927/10/vdsm/API.py
File vdsm/API.py:
Line 1204: for s in vms['vmList']:
Line 1205: response = VM(s['vmId']).getStats()
Line 1206: if response:
Line 1207: statsList.append(response['statsList'][0])
Line 1208: statsList = hooks.after_get_all_vm_stats(statsList)
before hook?
Line 1209: return {'status': doneCode, 'statsList': statsList}
Line 1210:
Line 1211: def getStats(self):
Line 1212: """
http://gerrit.ovirt.org/#/c/25927/10/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
File vdsm_hooks/fakevmstats/after_get_all_vm_stats.py:
Line 73: 'used': str(used)}
Line 74:
Line 75:
Line 76: def randomizeRuntimeStats(stats):
Line 77: cpuTotal = random.random() * 100.0
Not sure if even distribution is important here,
but if it is you should use random.uniform(0,100)
instead of all the random.random() * x
Line 78: cpuUser = random.random() * cpuTotal
Line 79: stats['cpuUser'] = '%.2f' % (cpuUser)
Line 80: stats['cpuSys'] = '%.2f' % (cpuTotal - cpuUser)
Line 81: stats['memUsage'] = str(random.randint(0, 100))
Line 116: diskUsage = []
Line 117: diskUsage.append(createDiskUsage('/', 'ext4', 20 * GB))
Line 118: diskUsage.append(createDiskUsage('/boot', 'ext4', 1 * GB))
Line 119: diskUsage.append(createDiskUsage('/home', 'ext4', 50 * GB))
Line 120: for i in xrange(random.randint(0, MAX_DYNAMIC_MOUNTS)):
why max? DYNAMIC_MOUNTS?
Line 121: diskUsage.append(createDiskUsage('/mount/dynamic-%d' % i, 'ext4'))
Line 122: stats['diskUsage'] = diskUsage
Line 123:
Line 124: stats['appsList'] = APP_LIST
--
To view, visit http://gerrit.ovirt.org/25927
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6a6d13f43495170a5cb86ae0b0efc1ae85ef05ab
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Dima Kuznetsov <dkuznets at redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: mooli tayer <mtayer at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list