A.10. Using the VDSM Hooking Module
VDSM ships with a Python hooking module, providing helper functions for VDSM hook scripts. This module is provided as an example, and is only relevant to VDSM hooks written in Python.
The hooking module supports reading of a virtual machine’s libvirt XML into a DOM object. Hook scripts can then use Python’s built in xml.dom library (http://docs.python.org/release/2.6/library/xml.dom.html) to manipulate the object.
The modified object can then be saved back to libvirt XML using the hooking module. The hooking module provides the following functions to support hook development:
Table A.2. Hooking module functions
Name | Argument | Description |
---|---|---|
| string | Converts a string "true" or "false" to a Boolean value |
| - | Reads the virtual machine’s libvirt XML into a DOM object |
| DOM object | Writes the virtual machine’s libvirt XML from a DOM object |
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.