1

当我尝试在 KVM 中分离驱动器时,出现以下错误:

virsh 分离磁盘 vps_99 vde

错误:操作失败:无法分离磁盘 vde - 没有设备的 PCI 地址

我已经尝试过谷歌,但找不到其他有同样问题的人??

这是我的 VPS 的 XML 转储:

(root@h2)-(/home/cloud)# virsh dumpxml vps_99
<domain type='kvm' id='218'>
  <name>vps_99</name>
  <uuid>42db1de2-f0d4-1030-ac57-0050560018a2</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>restart</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/nbd1'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/nbd2'/>
      <target dev='vdb' bus='virtio'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/nbd3'/>
      <target dev='vde' bus='virtio'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:50:56:00:1b:24'/>
      <source bridge='br0'/>
      <target dev='vnet3'/>
      <model type='virtio'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5903' autoport='yes' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
  <seclabel type='dynamic' model='apparmor'>
    <label>libvirt-42db1de2-f0d4-1030-ac57-0050560018a2</label>
    <imagelabel>libvirt-42db1de2-f0d4-1030-ac57-0050560018a2</imagelabel>
  </seclabel>
</domain>

另一个疯狂的事情是,我指定为“vde”的驱动器作为“vdc”连接到虚拟服务器,就好像它完全忽略了我的“vde”规范一样。

如果有人能告诉我如何确保驱动器作为我指定的设备连接,我会很感激。Amazon Web Services 似乎能够做到这一点,所以我为什么不应该:)

更新:虚拟机启动后,我似乎可以毫无问题地添加和删除新磁盘。分离用于创建虚拟服务器的原始 XML 中定义的磁盘似乎只是问题。但是问题仍然存在,如何分离定义虚拟服务器时定义的磁盘?

更新2:我还尝试<address>为每个磁盘添加一个条目,以确保每个磁盘都连接到预定义的插槽,即 <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> 但仍然无法分离磁盘,并且“virsh dumpxml vps_99”实际上显示我的条目有被完全删除/忽略。

更新 3:我还尝试将磁盘定义放入临时 XML 文件并运行:virsh detach-device vps_99 disk.xml 仍然相同的错误:错误:无法从 disk.xml 分离设备错误:操作失败:磁盘 vdi 无法分离 - 设备没有 PCI 地址

4

1 回答 1

0

你可以用libvirt. 您必须将设备的 xml 描述作为xlmDec.

例如:

virDom.detachDevice(xmldesc)
于 2013-04-11T09:20:43.523 回答