Show Table of Contents
21.23. 多機能 PCI デバイスの KVM ゲスト仮想マシンへの追加
多機能 PCI デバイスを KVM ゲスト仮想マシンに追加するには、以下の手順に従います。
virsh edit guestnameコマンドを実行して、ゲスト仮想マシンの XML 設定ファイルを編集します。<address>要素には、multifunction='on'属性を追加します。これにより、特定の多機能 PCI デバイスの他の機能が有効になります。<disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/rhel62-1.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </disk>
2 種類の機能を備えた PCI デバイスの場合、XML 設定ファイルを修正して、2 番目のデバイスに 1 番目のデバイスと同じスロット番号と、function='0x0'などの異なる機能番号を持たせます。<disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/rhel62-1.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/var/lib/libvirt/images/rhel62-2.img'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/> </disk>
lspciコマンドを実行します。KVM ゲスト仮想マシンの出力は virtio ブロックデバイスを表示します。$
lspci00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device 00:05.1 SCSI storage controller: Red Hat, Inc Virtio block device注記
SeaBIOS アプリケーションは BIOS インターフェースとの互換性のために real モードで実行されます。これにより、利用可能なメモリー容量が制限されます。結果として、SeaBIOS は制限された数のディスクしか処理できなくなります。現在サポートされているディスク数は以下のとおりです。- virtio-scsi — 64
- virtio-blk — 4
- ahci/sata — 24 (6 ポートが接続された 4 コントローラー)
- usb-storage — 4
回避策として、仮想マシンに多量のディスクを割り当てる場合、SeaBIOS が pci バスをスキャンする際にまず認識できるよう、システムディスクの pci スロット番号が小さく設定されていることを確認してください。さらに、ディスクごとのメモリーオーバーヘッドも小さくなるので、virtio-blk ではなく virtio-scsi デバイスを使用することもお勧めします。

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.