QEmu`eject`抱怨没有找到设备

时间:2018-10-22 12:45:51

标签: qemu

我需要从QEmu 3.0监视器中弹出一张软盘,但是该命令出人意料地失败了,抱怨找不到设备,尽管它确实存在。

设备清单:

(qemu) info block
fda: dos-6-22/Dos622-1.img (raw)
    Attached to:      /machine/unattached/device[11]
    Removable device: not locked, tray closed
    Cache mode:       writeback

hda: hda.img (raw)
    Attached to:      /machine/peripheral-anon/device[1]
    Cache mode:       writeback

弹出命令结果:

(qemu) eject fda
Device 'fda' not found

是这样,尽管本文档说这是我必须做的:https://www.linux-kvm.org/page/Change_cdrom(只是我要弹出软盘而不是CD-ROM)。

change命令抱怨相同:

(qemu) change fda dos-6-22/Dos622-2.img raw
Device 'fda' not found

这是错误还是我做错了什么?

我尝试使用不同的节点名称,结果始终相同。

更新

我很确定没有正确的答案,这是我刚刚提交的一个错误:https://bugs.launchpad.net/qemu/+bug/1799766

1 个答案:

答案 0 :(得分:0)

我正在发布答案,但我不确定。我可以说,如果我理解正确,那是一个错误。

答案分为两个部分。

第一部分是精简的失败调用:

qemu-system-i386 \
   -monitor stdio \
   -machine type=isapc,vmport=off \
   -blockdev driver=file,node-name=fda-img,filename=fda.img \
   -blockdev driver=raw,node-name=fda,file=fda-img \
   -global isa-fdc.driveA=fda

(qemu) info block
ide1-cd0: [not inserted]
    Attached to:      /machine/unattached/device[19]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed

fda: fda.img (raw)
    Attached to:      /machine/unattached/device[13]
    Removable device: not locked, tray closed
    Cache mode:       writeback
(qemu) eject fda
Device 'fda' not found

第二部分,没有最后一个参数-global isa-fdc.driveA=fda相同:

qemu-system-i386 \
   -monitor stdio \
   -machine type=isapc,vmport=off \
   -blockdev driver=file,node-name=fda-img,filename=fda.img \
   -blockdev driver=raw,node-name=fda,file=fda-img

(qemu) info block
ide1-cd0: [not inserted]
    Attached to:      /machine/unattached/device[19]
    Removable device: not locked, tray closed

floppy0: [not inserted]
    Attached to:      /machine/unattached/device[13]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed
(qemu) eject floppy0

删除-global isa-fdc.driveA=fda时会出现更多错误。但是,文档说:

  

-全局驱动程序=驱动程序,属性=属性,值=值   将驱动程序属性prop的默认值设置为值,例如:

     

qemu-system-i386 -global ide-hd.physical_block_size = 4096 disk-image.img   特别是,您可以使用它来设置由机器型号自动创建的设备的驱动程序属性。要创建不是自动创建的设备并在其上设置属性,请使用-device。

     

-global driver.prop = value是-global driver = driver,property = prop,value = value的简写。即使驱动程序包含点,长期语法也可以使用。

我在报价中强调的一点是,我没有滥用-global,这很可能是一个错误。

更新以获取更多详细信息:

尽管RedHat文档建议使用-drive而不是-device,但似乎使用driveA而不是-device-drive分配,结果是不一样的并且QEmu 3.0文档说-drive本质上是-device的快捷方式(“基本上”是,没有说出区别)。

下面有两种情况,除了info block以外,还有info qtree的摘录。

与此相结合,eject floppy0可以工作:

qemu-system-i386 \
   -monitor stdio \
   -machine type=isapc,vmport=off \
   -drive format=raw,if=floppy,media=disk,file=fda.img \
   -device isa-vga,vgamem_mb=1 \
   -serial msmouse

[…]

floppy0 (#block156): fda.img (raw)
    Attached to:      /machine/unattached/device[12]
    Removable device: not locked, tray closed
    Cache mode:       writeback

[…]

  dev: isa-fdc, id ""
    iobase = 1008 (0x3f0)
    irq = 6 (0x6)
    dma = 2 (0x2)
    driveA = ""
    driveB = ""
    check_media_rate = true
    fdtypeA = "auto"
    fdtypeB = "auto"
    fallback = "288"
    isa irq 6
    bus: floppy-bus.0
      type floppy-bus
      dev: floppy, id ""
        unit = 0 (0x0)
        drive = "floppy0"
        logical_block_size = 512 (0x200)
        physical_block_size = 512 (0x200)
        min_io_size = 0 (0x0)
        opt_io_size = 0 (0x0)
        discard_granularity = 4294967295 (0xffffffff)
        write-cache = "auto"
        share-rw = false
        drive-type = "144"

在此情况下,eject fda不起作用:

qemu-system-i386 \
   -monitor stdio \
   -machine type=isapc,vmport=off \
   -blockdev driver=file,node-name=fda-img,filename=fda.img \
   -blockdev driver=raw,node-name=fda,file=fda-img \
   -global isa-fdc.driveA=fda \
   -device isa-vga,vgamem_mb=1 \
   -serial msmouse

[…]

fda: fda.img (raw)
    Attached to:      /machine/unattached/device[12]
    Removable device: not locked, tray closed
    Cache mode:       writeback

[…]

  dev: isa-fdc, id ""
    iobase = 1008 (0x3f0)
    irq = 6 (0x6)
    dma = 2 (0x2)
    driveA = ""
    driveB = ""
    check_media_rate = true
    fdtypeA = "auto"
    fdtypeB = "auto"
    fallback = "288"
    isa irq 6
    bus: floppy-bus.0
      type floppy-bus
      dev: floppy, id ""
        unit = 0 (0x0)
        drive = "fda"
        logical_block_size = 512 (0x200)
        physical_block_size = 512 (0x200)
        min_io_size = 0 (0x0)
        opt_io_size = 0 (0x0)
        discard_granularity = 4294967295 (0xffffffff)
        write-cache = "auto"
        share-rw = false
        drive-type = "144"