Bug 619783
Summary: | Add hooks mechanism to VDSM | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Barak <bazulay> | |
Component: | vdsm | Assignee: | Dan Kenigsberg <danken> | |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Oded Ramraz <oramraz> | |
Severity: | medium | Docs Contact: | ||
Priority: | low | |||
Version: | 6.1 | CC: | iheim, Rhev-m-bugs, rvaknin, syeghiay, ykaul | |
Target Milestone: | rc | Keywords: | FutureFeature | |
Target Release: | --- | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | vdsm-4.9-14.el6 | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 620951 (view as bug list) | Environment: | ||
Last Closed: | 2011-08-19 15:10:50 UTC | Type: | --- | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | 620951 | |||
Bug Blocks: | 588854, 620097, 655920, 682791 |
Description
Barak
2010-07-30 14:28:04 UTC
The plan --------- 1. The VDSM hold a hook directory per hook 2. These directories will reside under /usr/share/vdsm/hooks dir 3. Each time a hook should be called the vdsm will: - iterate through the hook directory's files (hence order of hook executionis order by name order) - check whether the file is executable + the right permissions [1] - executes the script and passes it all params required [2] - block on the before* hooks - script should support standard exit codes - vdms collects stdout and stderr and logs accordingly - on err of before* hook execution [3] 4. The vdsm assumes the VM_START hook can alter the xml passed to it and assume that some params are not changed by the hook (e.g. vmid)[4] open issues: ------------ [1] what if the hook requires root permissions - we can simply rely on the vdsm sudo include file and instruct the user to add the specific script there, or ... [2] The exact paramss will be specified according to the hook type: - should rhevm send additional custom params per action? - should the vdsm save the initial params sent in the create hook and pass them to the rest of the hooks? [3] Should we prevent the action ???? use standard err exits code to enable indication to continue or to stop? [4] specific list will be provided (In reply to comment #1) ... > - block on the before* hooks I think that if you run multiple hooks in the post, you should block on them as well if possible, to make sure they are serialized. Updated hook list: - vdsm_start - vdsm_stop - vm_before_start - vm_after_start - vm_before_source_migration - vm_after_source_migration - vm_before_dest_migration - vm_after_dest_migration - vm_before_pause - vm_after_pause - vm_before_continue - vm_after_continue Verified with vdsm-4.9-49.el6.x86_64. All hooks were entered into /usr/share/vdsm/hooks.py, although not in the directory mentioned above (/usr/share/vdsm/hooks) and not in the exact names (the vm string is not the first in the hook's name). [root@rhev-i24c-01 vdsm]# cat hooks.py | grep def def _scriptsPerDir(dir): def _runHooksDir(domxml, dir, vmconf={}, raiseError=True): def before_vm_start(domxml, vmconf={}): def after_vm_start(domxml, vmconf={}): def before_vm_cont(domxml, vmconf={}): def after_vm_cont(domxml, vmconf={}): def before_vm_pause(domxml, vmconf={}): def after_vm_pause(domxml, vmconf={}): def before_vm_migrate_source(domxml, vmconf={}): def after_vm_migrate_source(domxml, vmconf={}): def before_vm_migrate_destination(domxml, vmconf={}): def after_vm_migrate_destination(domxml, vmconf={}): def before_vm_hibernate(domxml, vmconf={}): def after_vm_hibernate(domxml, vmconf={}): def before_vm_dehibernate(domxml, vmconf={}): def after_vm_dehibernate(domxml, vmconf={}): def after_vm_destroy(domxml, vmconf={}): def before_vdsm_start(): def after_vdsm_stop(): def _getScriptInfo(path): def _getHookInfo(dir): def scripthead(script): def installed(): def usage(): [root@rhev-i24c-01 vdsm]# |