Red Hat Training

A Red Hat training course is available for Red Hat Gluster Storage

3.2. Resources

3.2.1. List Resources in a Collection using list

Use the list command to display all resources of a specific type. Lists also include optional search queries to filter results.
# list [collection][options]

Table 3.2. Options for list

Option Description
--show-all Displays all non-empty properties for each listed resource. Without this option, only the id, name and description properties display.
--query [QUERY] Filters the list using a server-side query based on Red Hat Storage Console's query language. For more information about search query language, refer to Appendix E.1. Search of the Red Hat Storage Console Administration Guide.
--kwargs [QUERY] Filters the list using a client-side query.
--case_sensitive true|false Toggle case sensitive searches for search queries.
--max Maximum number of results to display.

Note

Options specific to resource types are listed in the definition pages for each resource type.

Example 3.3. Examples for list

List clusters:
[RHSC shell (connected)]# list clusters
List clusters with all properties listed:
[RHSC shell (connected)]# list clusters --show-all
List clusters which are named default:
[RHSC shell (connected)]# list clusters --query name=Default

3.2.2. Show a Resource Using show

Use the show command to display resource properties as follows:
# show [resource][id|name][options]

Table 3.3. show standard options

Option Description
--id [UUID] Identify resource with the resource's UUID value.
--name [NAME] Identify resource with the name value.

Note

Options specific to resource types are listed in the definition pages for each resource type.

Example 3.4. Examples for show

Show clusters based on id:
[RHSC shell (connected)]# show cluster --id fcadfd5f-9a12-4a1e-bb9b-2b9d5c2e04c3
Show clusters based on name:
[RHSC shell (connected)]# show cluster --name TestCluster

3.2.3. Update a Resource Using update

Use the update command to modify an existing resource as follows:
# update [resource][id|name][options]

Note

Options specific to resource types are listed in the definition pages for each resource type.

Example 3.5. Examples for update

Update a cluster:
[RHSC shell (connected)]# update cluster TestCluster --name Cluster1

3.2.4. Remove a Resource Using remove

Use the remove command to remove a resource as follows:
# remove [resource][id|name] [options]

Table 3.4. Options for remove

Option Description
--async Perform an asynchronous removal of the resource.
--force Forcefully remove the resource. This removes all database entries and associations for a particular resource.

Note

Options specific to resource types are listed in the definition pages for each resource type.

Example 3.6. Examples for remove

Remove a cluster:
[RHSC shell (connected)]# remove cluster TestCluster
Asynchronous removal of a cluster:
[RHSC shell (connected)]# remove cluster TestCluster --async
Force remove host:
[RHSC shell (connected)]# remove host Node1 --force true

3.2.5. Perform Action on a Resource Using action

Certain actions can be performed on resources with CLI commands.

Example 3.7. Examples of Performing Actions on a Resource

Activate a host:
[RHSC shell (connected)]# action host Node1 activate
Deactivate a host:
[RHSC shell (connected)]# action host Node1 deactivate

3.2.6. Using Sub-Resources with --RESOURCE-identifier

Certain resources act as sub-resources of other resources. This means there is a dependent relationship between the sub-resource and its parent resource. Use the --RESOURCE-identifier [name] option, where RESOURCE is the parent resource type used to target its sub-resource.

Example 3.8. Examples of Creating Sub-resources with add

To create a distributed volume:
RHSC shell (connected)]# add glustervolume --cluster-name TestCluster --name vol1 --volume_type DISTRIBUTE --bricks-brick "brick.server_id=35cfcaa5-1b1e-4be7-
b87d-5a018ea98d98,brick.brick_dir=/home/brickInfo/b10" --bricks-brick "brick.server_id=35cfcaa5-1b1e-4be7b87d-5a018ea98d98,brick.brick_dir=/home/brickInfo/b20"
Note the use of the --cluster-name option. This adds a Red Hat Storage volume to the cluster called TestCluster.