3.2. リソース
3.2.1. コレクション内のリソースを表示 (list)
list コマンドを使用して特定のタイプのリソースをすべて表示します。また、list コマンドにはオプションの検索クエリーが含まれており結果のフィルタリングを行います。
list [collection] [options]
表3.2 list の標準オプション
| オプション | 説明 |
|---|---|
--show-all | リストしたリソース別に、空でないプロパティーをすべて表示します。このオプションを指定しなかった場合は、id、name、description プロパティーのみが表示されます。 |
--query [QUERY] | Red Hat Virtualization Manager のクエリー言語をベースとするサーバー側のクエリーを使用して、一覧をフィルタリングします。 |
--kwargs [QUERY] | クライアント側のクエリーを使用して一覧をフィルタリングします。 |
--case_sensitive true|false | 大文字小文字を区別した検索クエリーを行います。 |
--max | 結果の最大表示件数 |
注記
例3.3 list の例
[RHEVM shell (connected)]# list vms
[RHEVM shell (connected)]# list vms --show-all
[RHEVM shell (connected)]# list vms --query "status=up"
[RHEVM shell (connected)]# list users --query "usrname=jsmith@*" --case_sensitive false
[RHEVM shell (connected)]# list --help
3.2.2. リソースの表示 (show)
show コマンドを使ってリソースのプロパティーを表示します。
show [resource] [id|name] [options]
表3.3 show の標準オプション
| オプション | 説明 |
|---|---|
--id [UUID] | リソースの UUID 値でリソースを識別します。 |
--name [NAME] | name の値でリソースを識別します。 |
注記
例3.4 show の例
id ベースで仮想マシンを表示します。
[RHEVM shell (connected)]# show vm fcadfd5f-9a12-4a1e-bb9b-2b9d5c2e04c3
name ベースで仮想マシンを表示します。
[RHEVM shell (connected)]# show vm RHEL6-Server
3.2.3. リソースの追加 (add)
add コマンドを使用して新しいリソースを追加します。
add [resource] [options]
注記
例3.5 add の例
[RHEVM shell (connected)]# add vm [vm-options]
[RHEVM shell (connected)]# add user [user-options]
add コマンドは、expect オプションを使用することで同期処理が可能となります (サポートされている場合)。
[RHEVM shell (connected)]# add vm [vm-options] --expect '201-created'
3.2.4. リソースの更新 (update)
update コマンドを使って既存のリソースを変更します。
update [resource] [id|name] [options]
注記
例3.6 update の例
[RHEVM shell (connected)]# update vm RHEL6-Server [vm-options]
3.2.5. リソースの削除 (remove)
remove コマンドを使用してリソースを削除します。
remove [resource] [id|name] [options]
表3.4 remove の標準オプション
| オプション | 説明 |
|---|---|
--async | リソースの非同期削除を行います。 |
--force | リソースの強制削除を行います。これにより、データベースのエントリーと特定のリソースへの関連性すべてを削除します。このアクションは、datacenter と vm リソースのみに適用されます。 |
注記
例3.7 remove の例
[RHEVM shell (connected)]# remove vm RHEL6-Server
[RHEVM shell (connected)]# remove vm RHEL6-Server --async true
[RHEVM shell (connected)]# remove vm RHEL6-Server --force
3.2.6. リソースに対するアクションの実行 (action)
action コマンドを使い、リソースタイプに関連する特別な関数を実行します。
action [resource] [id|name] [action] [options]
注記
例3.8 action の例
[RHEVM shell (connected)]# action vm RHEL6-Server start
[RHEVM shell (connected)]# action vm RHEL6-Server stop
action コマンドは、async オプションを使用することで同期処理が可能となります (サポートされている場合)。
[RHEVM shell (connected)]# action vm [vm-options] --async false
3.2.7. Sub-Resources の使用方法 (--RESOURCE-identifier)
--RESOURCE-identifier [name] オプションを使い、親リソースのサブリソースの部分を指定します。RESOURCE には、親のリソースタイプを入れてください。
例3.9 add を用いたサブリソースの作成例
[RHEVM shell (connected)]# add nic --vm-identifier RHEL6-Server [nic-options]
--vm-identifier RHEL6-Server オプションを使用している点に注意してください。このコマンドにより、RHEL6-Server 仮想マシンに NIC が追加されます。
[RHEVM shell (connected)]# add disk --vm-identifier RHEL6-Server [user-options]
--vm-identifier RHEL6-Server オプションを使用している点に注意してください。このコマンドにより、RHEL6-Server 仮想マシンにストレージディスクが作成されます。

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.