Change in vdsm[master]: hooks: Add hook for fake VM stats

danken at redhat.com danken at redhat.com
Wed Apr 9 13:24:31 UTC 2014


Dan Kenigsberg has posted comments on this change.

Change subject: hooks: Add hook for fake VM stats
......................................................................


Patch Set 12: Code-Review-1

(4 comments)

partial review.

http://gerrit.ovirt.org/#/c/25927/12//COMMIT_MSG
Commit Message:

Line 8: 
Line 9: Added a hook to intercept calls of getAllVmStats, and insert fake guest
Line 10: information.
Line 11: 
Line 12: There is a before and an after hook, before added purely for symmetry.
If you do not see a use case of "before", it's not required.

in any case, please document the new hooks in vdsmd.8.
Line 13: 
Line 14: Change-Id: I6a6d13f43495170a5cb86ae0b0efc1ae85ef05ab


http://gerrit.ovirt.org/#/c/25927/12/vdsm.spec.in
File vdsm.spec.in:

Line 1067: %dir %{_libexecdir}/%{vdsm_name}/hooks/before_network_setup
Line 1068: %dir %{_libexecdir}/%{vdsm_name}/hooks/after_network_setup
Line 1069: %dir %{_libexecdir}/%{vdsm_name}/hooks/before_set_num_of_cpus
Line 1070: %dir %{_libexecdir}/%{vdsm_name}/hooks/after_set_num_of_cpus
Line 1071: %dir %{_libexecdir}/%{vdsm_name}/hooks/before_get_all_vm_stats
debian should be taken care of, too.
Line 1072: %dir %{_libexecdir}/%{vdsm_name}/hooks/after_get_all_vm_stats
Line 1073: %{_datadir}/%{vdsm_name}/addNetwork
Line 1074: %{_datadir}/%{vdsm_name}/configNetwork.py*
Line 1075: %{_datadir}/%{vdsm_name}/delNetwork


http://gerrit.ovirt.org/#/c/25927/12/vdsm/API.py
File vdsm/API.py:

Line 1201:         """
Line 1202:         vms = self.getVMList()
Line 1203:         statsList = []
Line 1204:         for s in vms['vmList']:
Line 1205:             response = VM(s['vmId']).getStats()
where does the before_* hook being called?

I am a bit worried about the fact that the per-Vm getVmStats() is not sifted through the very same hook. It may be a bit more expensive, but cleaner, to have a hookpoint (only) in the per-Vm case. the multi-VM case would take care of itself.
Line 1206:             if response:
Line 1207:                 statsList.append(response['statsList'][0])
Line 1208:         statsList = hooks.after_get_all_vm_stats(statsList)
Line 1209:         return {'status': doneCode, 'statsList': statsList}


http://gerrit.ovirt.org/#/c/25927/12/vdsm/hooks.py
File vdsm/hooks.py:

Line 339:                         raiseError=False, hookType=_JSON_HOOK)
Line 340: 
Line 341: 
Line 342: def before_get_all_vm_stats():
Line 343:     return _runHooksDir({}, 'before_get_all_vm_stats', raiseError=False,
before_* hooks usually need raiseError=True, in order to be able to fail the hooked action.

It makes sense here, too, as someone may want to see how Engine behaves if getAllVmStats fails.
Line 344:                         hookType=_JSON_HOOK)
Line 345: 
Line 346: 
Line 347: def after_get_all_vm_stats(stats):


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