Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

23.17.16. ホストの物理マシンインターフェイス

キャラクターデバイスは、ホストの物理マシンに、次のいずれかの形式で表示されます。

表23.26 キャラクターデバイスの要素

パラメーター 説明 XML スニペット
ドメインログファイル キャラクターデバイスのすべての入力を無効にし、仮想マシンのログファイルに出力を送信します。
<devices>
   <console type='stdio'>
     <target port='1'/>
   </console>
</devices>
デバイスログファイル ファイルが開かれ、キャラクターデバイスに送信したすべてのデータがファイルに書き込まれます。この設定でゲストを正常に起動するには、移行先ディレクトリーに、ゲストの virt_log_t SELinux ラベルが必要です。
<devices>
   <serial type="file">
      <source path="/var/log/vm/vm-serial.log"/>
      <target port="1"/>
   </serial>
</devices>
仮想コンソール キャラクターデバイスを仮想コンソールのグラフィカルフレームバッファーに接続します。通常、これには "ctrl+alt+3" のような特別なホットキーシーケンスを使用してアクセスします。
<devices>
   <serial type='vc'>
      <target port="1"/>
   </serial>
</devices>
Null デバイス キャラクターデバイスをボイドに接続します。入力にデータが提供されることはありません。書き込まれたデータはすべて破棄されます。
<devices>
   <serial type='null'>
      <target port="1"/>
   </serial>
</devices>
擬似 TTY 疑似 TTY は、/dev/ptmx を使用して割り当てられます。virsh console などの適切なクライアントは、接続してローカルのシリアルポートと対話できます。
<devices>
   <serial type="pty">
      <source path="/dev/pts/3"/>
      <target port="1"/>
   </serial>
</devices>
NB 特殊ケース NB 特殊なケースで、<console type='pty'> の場合、TTY パスもトップレベルの <console> タグの属性 tty='/dev/pts/3' として複製されます。これにより、<console> タグの構文が簡略化されました。 
ホスト物理マシンのデバイスプロキシー キャラクターデバイスは、基本となる物理キャラクターデバイスに渡されます。エミュレートシリアルポートはホスト物理マシンのシリアルポートにのみ接続するなど、デバイスの種類が一致する必要があります。シリアルポートをパラレルポートに接続しないでください。
<devices>
   <serial type="dev">
      <source path="/dev/ttyS0"/>
      <target port="1"/>
   </serial>
</devices>
名前付きパイプ キャラクターデバイスは、名前付きパイプに出力を書き込みます。詳細は、man ページの pipe(7) を参照してください。
<devices>
   <serial type="pipe">
      <source path="/tmp/mypipe"/>
      <target port="1"/>
   </serial>
</devices>
TCP クライアントサーバー キャラクターデバイスは、リモートサーバーに接続する TCP クライアントとして機能します。
<devices>
   <serial type="tcp">
      <source mode="connect" host="0.0.0.0" service="2445"/>
      <protocol type="raw"/>
      <target port="1"/>
   </serial>
</devices>
または、クライアント接続を待機している TCP サーバーとして機能します。
<devices>
   <serial type="tcp">
      <source mode="bind" host="127.0.0.1" service="2445"/>
      <protocol type="raw"/>
      <target port="1"/>
   </serial>
</devices>
または、raw の TCP の代わりに telnet を使用できます。また、telnets (セキュアな telnet) および tls も使用できます。
<devices>
   <serial type="tcp">
      <source mode="connect" host="0.0.0.0" service="2445"/>
      <protocol type="telnet"/>
      <target port="1"/>
   </serial>
      <serial type="tcp">
      <source mode="bind" host="127.0.0.1" service="2445"/>
      <protocol type="telnet"/>
      <target port="1"/>
   </serial>
</devices>
UDP ネットワークコンソール キャラクターデバイスは UDP netconsole サービスとしてパケットの送受信を行います。これは不可逆のサービスです。
<devices>
   <serial type="udp">
      <source mode="bind" host="0.0.0.0" service="2445"/>
      <source mode="connect" host="0.0.0.0" service="2445"/>
      <target port="1"/>
   </serial>
</devices>
UNIX ドメインソケット client-server キャラクターデバイスは、UNIX ドメインソケットサーバーとして機能し、ローカルクライアントからの接続を受け入れます。
<devices>
   <serial type="unix">
      <source mode="bind" path="/tmp/foo"/>
      <target port="1"/>
   </serial>
</devices>