• D
    Properly support SCSI drive hotplug · 3a6bf1bb
    Daniel P. Berrange 提交于
    The current SCSI hotplug support attaches a brand new SCSI controller
    for every disk. This is broken because the semantics differ from those
    used when starting the VM initially. In the latter case, each SCSI
    controller is filled before a new one is added.
    
    If the user specifies an high drive index (sdazz) then at initial
    startup, many intermediate SCSI controllers may be added with no
    drives.
    
    This patch changes SCSI hotplug so that it exactly matches the
    behaviour of initial startup. First the SCSI controller number is
    determined for the drive to be hotplugged. If any controller upto
    and including that controller number is not yet present, it is
    attached. Then finally the drive is attached to the last controller.
    
    NB, this breaks SCSI hotunplug, because there is no 'drive_del'
    command in current QEMU. Previous SCSI hotunplug was broken in
    any case because it was unplugging the entire controller, not
    just the drive in question.
    
    A future QEMU will allow proper SCSI hotunplug of a drive.
    
    This patch is derived from work done by Wolfgang Mauerer on disk
    controllers.
    
    * src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to
     the correct controller, instead of just attaching a new
      controller.
    * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
      src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
      src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
      support for 'drive_add' command
    3a6bf1bb
qemu_driver.c 255.2 KB