• D
    Fully asynchronous monitor I/O processing · 1dc10a7b
    Daniel P. Berrange 提交于
    Change the QEMU monitor file handle watch to poll for both
    read & write events, as well as EOF. All I/O to/from the
    QEMU monitor FD is now done in the event callback thread.
    
    When the QEMU driver needs to send a command, it puts the
    data to be sent into a qemuMonitorMessagePtr object instance,
    queues it for dispatch, and then goes to sleep on a condition
    variable. The event thread sends all the data, and then waits
    for the reply to arrive, putting the response / error data
    back into the qemuMonitorMessagePtr and notifying the condition
    variable.
    
    There is a temporary hack in the disk passphrase callback to
    avoid acquiring the domain lock.  This avoids a deadlock in
    the command processing, since the domain lock is still held
    when running monitor commands. The next commit will remove
    the locking when running commands & thus allow re-introduction
    of locking the disk passphrase callback
    
    * src/qemu/qemu_driver.c: Temporarily don't acquire lock in
      disk passphrase callback. To be reverted in next commit
    * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Remove
      raw I/O functions, and a generic qemuMonitorSend() for
      invoking a command
    * src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
      Remove all low level I/O, and use the new qemuMonitorSend()
      API. Provide a qemuMonitorTextIOProcess() method for detecting
      command/reply/prompt boundaries in the monitor data stream
    1dc10a7b
qemu_driver.c 219.2 KB