検索

7.3. 仮想マシンの XML 設定例

download PDF

仮想マシンの XML 設定 (ドメイン XML とも呼ばれる) は、仮想マシンの設定およびコンポーネントを決定します。以下の表は、仮想マシンの XML 設定例の各セクションと、コンテンツについて説明しています。

仮想マシンの XML 設定を取得するには、virsh dumpxml コマンドの後に仮想マシンの名前を指定します。

# virsh dumpxml testguest1
表7.1 XML 設定のサンプル
ドメイン XML セクション説明
<domain type='kvm'>
 <name>Testguest1</name>
 <uuid>ec6fbaa1-3eb4-49da-bf61-bb02fbec4967</uuid>
 <memory unit='KiB'>1048576</memory>
 <currentMemory unit='KiB'>1048576</currentMemory>

これは、1024 MiB のメモリーが割り当てられている KVM 仮想マシン Testguest1 です。

 <vcpu placement='static'>1</vcpu>

仮想マシンには、仮想 CPU (vCPU) が 1 つ割り当てられます。

vCPU の設定に関する詳細は、仮想マシンの CPU パフォーマンスの最適化 を参照してください。

 <os>
  <type arch='x86_64' machine='pc-q35-4.1'>hvm</type>
  <boot dev='hd'/>
 </os>

マシンアーキテクチャーは AMD64 および Intel 64 のアーキテクチャーに設定され、Intel Q35 マシン種別を使用して機能の互換性を決定します。OS は、ハードディスクドライブから起動するように設定されています。

OS がインストールされた仮想マシンの作成については、Web コンソールを使用した仮想マシンの作成、およびゲストのオペレーティングシステムのインストール を参照してください。

 <features>
  <acpi/>
  <apic/>
 </features>

acpi および apic ハイパーバイザー機能が無効になっています。

 <cpu mode='host-model' check='partial'/>

機能 XML (virsh 機能の一部として提供) からのホスト CPU 定義は、仮想マシンの XML 設定に自動的にコピーされます。したがって、仮想マシンの起動時に、libvirt はホストの CPU と似た CPU モデルを選択し、さらに機能を追加してホストモデルに可能な限り近づけます。

 <clock offset='utc'>
  <timer name='rtc' tickpolicy='catchup'/>
  <timer name='pit' tickpolicy='delay'/>
  <timer name='hpet' present='no'/>
 </clock>

仮想マシンの仮想ハードウェアクロックは UTC タイムゾーンを使用します。また、QEMU ハイパーバイザーと同期するために、異なるタイマーが 3 つ設定されます。

 <on_poweroff>destroy</on_poweroff>
 <on_reboot>restart</on_reboot>
 <on_crash>destroy</on_crash>

仮想マシンの電源が切れた場合や、仮想マシンの OS が突然終了すると、libvirt が仮想マシンを終了し、割り当てられているリソースをすべて解放します。仮想マシンの再起動時に、libvirt は同じ設定で仮想マシンを起動します。

 <pm>
  <suspend-to-mem enabled='no'/>
  <suspend-to-disk enabled='no'/>
 </pm>

この仮想マシンでは、S3 および S4 ACPI のスリープ状態が無効になっています。

 <devices>
  <emulator>/usr/bin/qemu-kvm</emulator>
  <disk type='file' device='disk'>
   <driver name='qemu' type='qcow2'/>
   <source file='/var/lib/libvirt/images/Testguest.qcow2'/>
   <target dev='hda' bus='ide'/>
  </disk>
  <disk type='file' device='cdrom'>
   <driver name='qemu' type='raw'/>
   <target dev='hdb' bus='ide'/>
   <readonly/>
  </disk>

仮想マシンは、エミュレーションに /usr/bin/qemu-kvm バイナリーファイルを使用し、これには 2 つのディスクデバイスが割り当てられています。

最初のディスクは、ホストに格納されている /var/lib/libvirt/images/Testguest.qcow2 をベースにした仮想ハードドライブで、このドライブの論理デバイス名は hda に設定されます。

2 番目のディスクは仮想化 CD-ROM で、その論理デバイス名は hdb に設定されています。

  <controller type='usb' index='0' model='qemu-xhci' ports='15'/>
  <controller type='sata' index='0'/>
  <controller type='pci' index='0' model='pcie-root'/>
  <controller type='pci' index='1' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='1' port='0x10'/>
  </controller>
  <controller type='pci' index='2' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='2' port='0x11'/>
  </controller>
  <controller type='pci' index='3' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='3' port='0x12'/>
  </controller>
  <controller type='pci' index='4' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='4' port='0x13'/>
  </controller>
  <controller type='pci' index='5' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='5' port='0x14'/>
  </controller>
  <controller type='pci' index='6' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='6' port='0x15'/>
  </controller>
  <controller type='pci' index='7' model='pcie-root-port'>
   <model name='pcie-root-port'/>
   <target chassis='7' port='0x16'/>
  </controller>
  <controller type='virtio-serial' index='0'/>

仮想マシンは、USB デバイスの割り当てにコントローラーを 1 つ、PCI-Express (PCIe) デバイスにルートコントローラーを使用します。さらに、virtio-serial コントローラーが利用できるため、仮想マシンは、シリアルコンソールなど、各種方法でホストを操作できます。

仮想デバイスの詳細は、仮想デバイスの種類 を参照してください。

 <interface type='network'>
  <mac address='52:54:00:65:29:21'/>
  <source network='default'/>
  <model type='rtl8139'/>
 </interface>

ネットワークインターフェイスは、default の仮想ネットワークおよび rtl8139 ネットワークデバイスモデルを使用する仮想マシンに設定されます。

ネットワークインターフェイスの設定に関する詳細は、仮想マシンのネットワークパフォーマンスの最適化 を参照してください。

  <serial type='pty'>
   <target type='isa-serial' port='0'>
    <model name='isa-serial'/>
   </target>
  </serial>
  <console type='pty'>
   <target type='serial' port='0'/>
  </console>
  <channel type='unix'>
   <target type='virtio' name='org.qemu.guest_agent.0'/>
   <address type='virtio-serial' controller='0' bus='0' port='1'/>
  </channel>
  <channel type='spicevmc'>
   <target type='virtio' name='com.redhat.spice.0'/>
    <address type='virtio-serial' controller='0' bus='0' port='2'/>
  </channel>

pty シリアルコンソールが仮想マシンに設定されているので、ホストとの基本的な仮想マシン通信が可能になります。コンソールは、ポート 1 で UNIX チャンネルを使用し、ポート 2 で準仮想化 SPICE を使用します。この設定は自動で設定されており、設定の変更は推奨されません。

仮想マシンと相互作用する方法の詳細は、Web コンソールを使用した仮想マシンとの相互作用 を参照してください。

  <input type='tablet' bus='usb'>
   <address type='usb' bus='0' port='1'/>
  </input>
  <input type='mouse' bus='ps2'/>
  <input type='keyboard' bus='ps2'/>

仮想マシンは、タブレット入力を受信するように設定された仮想 usb ポートと、マウスとキーボード入力を受け取るように設定された仮想 ps2 ポートを使用します。この設定は自動で設定されており、設定の変更は推奨されません。

  <graphics type='spice' autoport='yes' listen='127.0.0.1'>
   <listen type='address' address='127.0.0.1'/>
   <image compression='off'/>
  </graphics>
  <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
   <listen type='address' address='127.0.0.1'/>
  </graphics>

仮想マシンは、グラフィカル出力のレンダリングに VNC プロトコルおよび SPICE プロトコルを使用し、イメージの圧縮はオフになります。

  <sound model='ich6'>
   <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
  </sound>
  <video>
   <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
   <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
  </video>

ICH6 HDA サウンドデバイスが仮想マシン用に設定され、QEMU QXL 準仮想化フレームバッファーデバイスがビデオアクセラレーターとして設定されます。この設定は自動で設定されており、設定の変更は推奨されません。

  <redirdev bus='usb' type='spicevmc'>
   <address type='usb' bus='0' port='1'/>
  </redirdev>
  <redirdev bus='usb' type='spicevmc'>
   <address type='usb' bus='0' port='2'/>
  </redirdev>
  <memballoon model='virtio'>
   <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
  </memballoon>
 </devices>
</domain>

仮想マシンには、USB デバイスをリモート接続するためのディレクトリーが 2 つあり、メモリーバルーンがオンになります。この設定は自動で設定されており、設定の変更は推奨されません。

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.