此内容没有您所选择的语言版本。
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.
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
- Create an instance of the parameter object for the type of resource being created.
- Identify the collection to which the resource will be added.
- Call the
addmethod of the collection passing the parameter object as a parameter.