差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン | |||
| linux:qemu-kvm:virsh [2023/09/07 09:08] – [ゲストの一覧表示] ともやん | linux:qemu-kvm:virsh [2023/09/07 09:16] (現在) – ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== virsh による仮想マシンの操作 ====== | ====== virsh による仮想マシンの操作 ====== | ||
| + | |||
| ===== ゲストの一覧表示 ===== | ===== ゲストの一覧表示 ===== | ||
| <WRAP color_term> | <WRAP color_term> | ||
| 行 16: | 行 17: | ||
| ===== ゲストの自動起動 ===== | ===== ゲストの自動起動 ===== | ||
| - | + | <WRAP color_term> | |
| - | <code> | + | <WRAP color_command>< | 
| - | $ sudo virsh autostart CentOS_6_x86_64_001 | + | <b class=GRN> | 
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 が自動起動に設定されました | ドメイン CentOS_6_x86_64_001 が自動起動に設定されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストの自動起動解除 ===== | ===== ゲストの自動起動解除 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh autostart --disable CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 が自動起動設定が解除されました | ドメイン CentOS_6_x86_64_001 が自動起動設定が解除されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストの起動 ===== | ===== ゲストの起動 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh start CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 が起動されました | ドメイン CentOS_6_x86_64_001 が起動されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストの休止 ===== | ===== ゲストの休止 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh suspend CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 は一時停止されました | ドメイン CentOS_6_x86_64_001 は一時停止されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストの復帰 ===== | ===== ゲストの復帰 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh resume CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 が再開されました | ドメイン CentOS_6_x86_64_001 が再開されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストの状態を保存して停止 ===== | ===== ゲストの状態を保存して停止 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh save CentOS_6_x86_64_001 savefile | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 が savefile に保存されました | ドメイン CentOS_6_x86_64_001 が savefile に保存されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストを保存ファイルから復帰 ===== | ===== ゲストを保存ファイルから復帰 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh restore savefile | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメインが savefile から復元されました | ドメインが savefile から復元されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストのシャットダウン ===== | ===== ゲストのシャットダウン ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh shutdown CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 をシャットダウンしています | ドメイン CentOS_6_x86_64_001 をシャットダウンしています | ||
| - | </code> | + | </pre></ | 
| + | </ | ||
| ===== ゲストの再起動 ===== | ===== ゲストの再起動 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh reboot CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 を再起動しています | ドメイン CentOS_6_x86_64_001 を再起動しています | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ゲストの強制停止 ===== | ===== ゲストの強制停止 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh destroy CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| ドメイン CentOS_6_x86_64_001 は強制停止されました | ドメイン CentOS_6_x86_64_001 は強制停止されました | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ドメインのディスプレイ接続URI ===== | ===== ドメインのディスプレイ接続URI ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh domdisplay CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| + | <b class=GRN> | ||
| + | </ | ||
| + | <WRAP color_result>< | ||
| spice:// | spice:// | ||
| - | </code> | + | </pre></ | 
| + | </WRAP> | ||
| ===== ドメインの編集 ===== | ===== ドメインの編集 ===== | ||
| - | <code> | + | <WRAP color_term> | 
| - | $ sudo virsh edit CentOS_6_x86_64_001 | + | <WRAP color_command>< | 
| - | </code> | + | <b class=GRN> | 
| + | </pre></ | ||
| + | <WRAP color_result>< | ||
| + | </ | ||
| + | </ | ||
| ==== ハイパーバイザーの変更 ==== | ==== ハイパーバイザーの変更 ==== | ||
| kvm -> qemu | kvm -> qemu | ||
| - | <code xml> | + | <WRAP color_term> | 
| + | <WRAP color_mincode> | ||
| <domain type=' | <domain type=' | ||
| < | < | ||
| 行 101: | 行 149: | ||
| < | < | ||
| <memory unit=' | <memory unit=' | ||
| - | </ | + | </code></ | 
| + | </WRAP> | ||
| ===== CPU モデルの表示 [cpu-models] ===== | ===== CPU モデルの表示 [cpu-models] ===== | ||
| <WRAP color_term> | <WRAP color_term> | ||
| <WRAP color_command>< | <WRAP color_command>< | ||
| - | $ virsh cpu-models x86_64 | + | <b class=GRN> | 
| </ | </ | ||
| <WRAP color_result_long>< | <WRAP color_result_long>< | ||
| 行 173: | 行 222: | ||
| <WRAP color_term> | <WRAP color_term> | ||
| <WRAP color_command>< | <WRAP color_command>< | ||
| - | $ virsh help | + | <b class=GRN> | 
| </ | </ | ||
| <WRAP color_result_long>< | <WRAP color_result_long>< | ||
