1

virsh attah-disk を使用して、追加のストレージ ソースとして qcow2 ファイルをアタッチしようとしています。私が使用している構文は(インターネットから)です:

virsh attach-disk --driver file vm2 disk2.qcow2 hdc

VM が実行中または一時停止中の場合は、次のように表示されます。

error: this function is not supported by the hypervisor: disk bus 'ide' cannot be hotplugged.

VM がシャットダウンされている場合は、次のように表示されます。

error: Requested operation is not valid: cannot attach device on inactive domain

hdc パラメータについてはよくわかりません。次のようにxmlファイルでもattach-device機能を使用してみました:

<disk type="file" device="disk">
    <driver name="file"/>
    <source file="/gfs1/disk2.qcow2"/>
    <target dev="hdc"/>
</disk>

しかし、これは次のことも示しています。

error: Failed to attach device from /gfs1/disk2tovm2.xml
error: this function is not supported by the hypervisor: disk bus 'ide' cannot be hotplugged.

多くの例を見ましたが、どれも機能せず、すべてがほぼ同じ構文でした。誰かがエラーを理解するのを手伝ってくれたら。

VM の完全な構成ファイル

root@blade1:/vms# virsh dumpxml vm2
<domain type='kvm' id='33'>
  <name>vm2</name>
  <uuid>70affd5d-af95-72c5-2d96-c131f46409b6</uuid>
  <description>--autostart</description>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='i686' machine='pc-0.14'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/vms/vm2.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <interface type='bridge'>
      <mac address='52:54:00:5e:98:e4'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='6900' autoport='no' listen='0.0.0.0'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='apparmor'>
    <label>libvirt-70affd5d-af95-72c5-2d96-c131f46409b6</label>
    <imagelabel>libvirt-70affd5d-af95-72c5-2d96-c131f46409b6</imagelabel>
  </seclabel>
</domain>
4

2 に答える 2

5

これが機能しない理由は、IDEアーキテクチャを使用して実行中のドメインにディスクを接続しようとしているためです。

実際の物理サーバーがあると想像してください。実行中にサーバーを開いて、IDE ドライブを接続できますか? いいえ、アーキテクチャはサポートしていません。このアーキテクチャをエミュレートしようとする KVM/QEMU は、「ディスク バス 'ide' をホットプラグできません」というエラーを表示する必要があります。

1 つの解決策は、SCSI アーキテクチャを使用してディスクを接続することです。SCSI はホットプラグをサポートしています。使用するコマンドは次のとおりです。

virsh attach-disk --driver ファイル vm2 disk2.qcow2 sdc

唯一の変更点は、「hdc」ではなく「sdc」です。これは、IDE ではなく SCSI が必要であることを KVM/QEMU に示唆し、ディスクを接続します。

また、ドメインが停止している場合、attach-disk はドメインを実行するための機能であるため、使用できません。

于 2011-10-06T11:23:17.593 に答える