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

16.5. Adding a Resource to a Collection


The add method adds a resource to a collection. The resource to be added is created based on the parameters provided. Parameters are provided to the add method using an instance of an object from the ovirtsdk.xml.params module. Selecting the specific class from the module to use varies based on the type of resource being created.

Example 16.8. Adding a Resource to a Collection

In this example, a brick is added to the GlusterBricks collection.
    br_param = params.GlusterBrick(
        brick_dir='/exports/music_2',
        server_id='0f5a7016-bb36-4f2b-a226-3b16c3eeca0c')

    bricksParam = params.GlusterBricks()
    bricksParam.add_brick(br_param)
Copy to Clipboard Toggle word wrap
While the brick created in this example is not yet ready to run, it illustrates the process for creating any Red Hat Gluster Storage resource:

Procedure 16.1. Creating a Red Hat Gluster Storage Resource

  1. Create an instance of the parameter object for the type of resource being created.
  2. Identify the collection to which the resource will be added.
  3. Call the add method of the collection passing the parameter object as a parameter.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat