此内容没有您所选择的语言版本。

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
NameArgumentDescription

tobool

string

Converts a string "true" or "false" to a Boolean value

read_domxml

-

Reads the virtual machine’s libvirt XML into a DOM object

write_domxml

DOM object

Writes the virtual machine’s libvirt XML from a DOM object

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.