Red Hat Training

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

12.3. virt-install を使用した PCI デバイスの割り当て

virt-install を使用して PCI デバイスを割り当てるには、--host-device パラメーターを使用します。

手順12.5 virt-install を使用した、仮想マシンへの PCI デバイスの割り当て

  1. デバイスの識別

    ゲスト仮想マシンにデバイス割り当てに指定されている PCI デバイスを特定します。
    # lspci | grep Ethernet
    00:19.0 Ethernet controller: Intel Corporation 82567LM-2 Gigabit Network Connection
    01:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
    01:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
    virsh nodedev-list コマンドは、システムに接続されているすべてのデバイスの一覧を表示し、各 PCI デバイスを文字列で識別します。出力を PCI デバイスのみに制限するには、次のコマンドを実行します。
    # virsh nodedev-list --cap pci
    pci_0000_00_00_0
    pci_0000_00_01_0
    pci_0000_00_03_0
    pci_0000_00_07_0
    pci_0000_00_10_0
    pci_0000_00_10_1
    pci_0000_00_14_0
    pci_0000_00_14_1
    pci_0000_00_14_2
    pci_0000_00_14_3
    pci_0000_00_19_0
    pci_0000_00_1a_0
    pci_0000_00_1a_1
    pci_0000_00_1a_2
    pci_0000_00_1a_7
    pci_0000_00_1b_0
    pci_0000_00_1c_0
    pci_0000_00_1c_1
    pci_0000_00_1c_4
    pci_0000_00_1d_0
    pci_0000_00_1d_1
    pci_0000_00_1d_2
    pci_0000_00_1d_7
    pci_0000_00_1e_0
    pci_0000_00_1f_0
    pci_0000_00_1f_2
    pci_0000_00_1f_3
    pci_0000_01_00_0
    pci_0000_01_00_1
    pci_0000_02_00_0
    pci_0000_02_00_1
    pci_0000_06_00_0
    pci_0000_07_02_0
    pci_0000_07_03_0
    PCI デバイス番号を記録します。この番号は他の手順で確認する必要があります。
    ドメイン、バス、および機能の情報は、virsh nodedev-dumpxml コマンドの出力から取得できます。
    # virsh nodedev-dumpxml pci_0000_01_00_0
    <device>
      <name>pci_0000_01_00_0</name>
      <parent>pci_0000_00_01_0</parent>
      <driver>
        <name>igb</name>
      </driver>
      <capability type='pci'>
        <domain>0</domain>
        <bus>1</bus>
        <slot>0</slot>
        <function>0</function>
        <product id='0x10c9'>82576 Gigabit Network Connection</product>
        <vendor id='0x8086'>Intel Corporation</vendor>
        <capability type='virt_functions'>
        </capability>
      </capability>
    </device>
  2. デバイスの追加

    virshnodedev コマンドから出力された PCI 識別子を --host-device パラメーターの値として使用します。
    virt-install \
    --name=guest1-rhel6-64 \
    --disk path=/var/lib/libvirt/images/guest1-rhel6-64.img,size=8 \
    --nonsparse --graphics spice \
    --vcpus=2 --ram=2048 \
    --location=http://example1.com/installation_tree/RHEL6.1-Server-x86_64/os \
    --nonetworks \
    --os-type=linux \
    --os-variant=rhel6 \
    --host-device=pci_0000_01_00_0
  3. インストールを完了する

    ゲストのインストールを完了します。PCI デバイスはゲストに接続する必要があります。