1. 01 3月, 2012 1 次提交
    • E
      qemu: pass block pull backing file to monitor · 10ec36e2
      Eric Blake 提交于
      This actually wires up the new optional parameter to block_stream:
      http://wiki.qemu.org/Features/LiveBlockMigration/ImageStreamingAPI
      
      The error checking is still sparse, since libvirt must not use
      qemu-img or header probing on a qcow2 file in use by qemu to
      check if the backing file name is valid; so for now, libvirt is
      relying on qemu to diagnose an incorrect backing name.  Fixing this
      will require libvirt to track the entire backing file chain at the
      time qemu is started and keeps it updated with snapshot and pull
      operations.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Add
      parameter, and update callers.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockJob): Update
      signature.
      * src/qemu/qemu_monitor.h (qemuMonitorBlockJob): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Update caller.
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Likewise.
      10ec36e2
  2. 28 2月, 2012 1 次提交
    • J
      qemu: unescape HMP commands before converting them to json · f27f616f
      Josh Durgin 提交于
      QMP commands don't need to be escaped since converting them to json
      also escapes special characters. When a QMP command fails, however,
      libvirt falls back to HMP commands. These fallback functions
      (qemuMonitorText*) do their own escaping, and pass the result directly
      to qemuMonitorHMPCommandWithFd. If the monitor is in json mode, these
      pre-escaped commands will be escaped again when converted to json,
      which can result in the wrong arguments being sent.
      
      For example, a filename test\file would be sent in json as
      test\\file.
      
      This prevented attaching an image file with a " or \ in its name in
      qemu 1.0.50, and also broke rbd attachment (which uses backslashes to
      escape some internal arguments.)
      Reported-by: NMasuko Tomoya <tomoya.masuko@gmail.com>
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f27f616f
  3. 27 2月, 2012 1 次提交
    • M
      qemu: Implement virDomainPMWakeup API · 9bf1bcc5
      Michal Privoznik 提交于
      using 'system-wakeup' monitor command. It is supported only in JSON,
      as we are enabling it if possible. Moreover, this command is available
      in qemu-1.1+ which definitely has JSON.
      9bf1bcc5
  4. 15 2月, 2012 1 次提交
  5. 01 2月, 2012 1 次提交
  6. 27 1月, 2012 1 次提交
    • J
      qemu: Refactor qemuMonitorGetBlockInfo · 65c27e29
      Jiri Denemark 提交于
      QEMU always sends details about all available block devices as an answer
      for "info block"/"query-block" command. On the other hand, our
      qemuMonitorGetBlockInfo was made for a single block devices queries
      only. Thus, when asking for multiple devices, we asked qemu multiple
      times to always get the same answer from which different parts were
      filtered. This patch makes qemuMonitorGetBlockInfo return a hash table
      of all block devices, which may later be used for getting details about
      specific devices.
      65c27e29
  7. 26 1月, 2012 1 次提交
  8. 01 12月, 2011 1 次提交
  9. 29 11月, 2011 1 次提交
    • O
      block_resize: Implement qemu monitor functions · 4fa36f13
      Osier Yang 提交于
      Implements functions for both HMP and QMP mode.
      
      For HMP mode, qemu uses "M" as the units by default, so the passed "sized"
      is divided by 1024.
      
      For QMP mode, qemu uses "Bytes" as the units by default, the passed "sized"
      is multiplied by 1024.
      
      All of the monitor functions return -1 on failure, 0 on success, or -2 if
      not supported.
      4fa36f13
  10. 28 10月, 2011 1 次提交
    • D
      Wire up QEMU implementation for virDomainOpenGraphics · f877fed3
      Daniel P. Berrange 提交于
      The QEMU monitor command 'add_client' can be used to connect to
      a VNC or SPICE graphics display. This allows for implementation
      of the virDomainOpenGraphics API
      
      * src/qemu/qemu_driver.c: Implement virDomainOpenGraphics
      * 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 binding for 'add_client' command
      f877fed3
  11. 19 10月, 2011 1 次提交
  12. 29 9月, 2011 1 次提交
  13. 28 9月, 2011 1 次提交
  14. 16 9月, 2011 1 次提交
  15. 06 9月, 2011 2 次提交
    • P
      link-state: qemu: Add monitor handling for link state modification · 8277c151
      Peter Krempa 提交于
      This patch adds handlers for modification of guest's interface
      link state. Both HMP and QMP commands are supported, but as the
      link state functionality is from the beginning supported in QMP
      the HMP code will probably never be used.
      8277c151
    • O
      latency: Update monitor functions for new latency fields · 2f58ba89
      Osier Yang 提交于
      The mainly changes are:
      
      1) Update qemuMonitorGetBlockStatsInfo and it's children (Text/JSON)
         functions to return the value of new latency fields.
      2) Add new function qemuMonitorGetBlockStatsParamsNumber, which is
         to count how many parameters the underlying QEMU supports.
      3) Update virDomainBlockStats in src/qemu/qemu_driver.c to be
         compatible with the changes by 1).
      2f58ba89
  16. 05 9月, 2011 1 次提交
    • E
      snapshot: wire up new qemu monitor command · e702b5ba
      Eric Blake 提交于
      No one uses this yet, but it will be important once
      virDomainSnapshotCreateXML learns a VIR_DOMAIN_SNAPSHOT_DISK_ONLY
      flag, and the xml allows passing in the new file names.
      
      * src/qemu/qemu_monitor.h (qemuMonitorDiskSnapshot): New prototype.
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextDiskSnapshot):
      Likewise.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDiskSnapshot):
      Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskSnapshot): New
      function.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskSnapshot):
      Likewise.
      e702b5ba
  17. 22 7月, 2011 2 次提交
    • A
      Asynchronous event for BlockJob completion · d489b046
      Adam Litke 提交于
      When an operation started by virDomainBlockPull completes (either with
      success or with failure), raise an event to indicate the final status.
      This API allow users to avoid polling on virDomainGetBlockJobInfo if
      they would prefer to use an event mechanism.
      
      * daemon/remote.c: Dispatch events to client
      * include/libvirt/libvirt.h.in: Define event ID and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle the new event
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for block_stream completion and emit a libvirt block pull event
      * src/remote/remote_driver.c: Receive and dispatch events to application
      * src/remote/remote_protocol.x: Wire protocol definition for the event
      * src/remote_protocol-structs: structure definitions for protocol verification
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event
        from QEMU monitor
      d489b046
    • A
      Implement virDomainBlockPull for the qemu driver · b976165c
      Adam Litke 提交于
      The virDomainBlockPull* family of commands are enabled by the
      following HMP/QMP commands: 'block_stream', 'block_job_cancel',
       'info block-jobs' / 'query-block-jobs', and 'block_job_set_speed'.
      
      * src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement disk
        streaming by using the proper qemu monitor commands.
      * src/qemu/qemu_monitor_json.[ch]: implement commands using the qmp monitor
      b976165c
  18. 21 7月, 2011 1 次提交
  19. 14 7月, 2011 1 次提交
  20. 12 7月, 2011 1 次提交
    • D
      Add monitor API for checking whether KVM is enabled · 7760eaa0
      Daniel P. Berrange 提交于
      When attaching to an external QEMU process, it is neccessary
      to check if the process is using KVM or not. This can be done
      using a monitor command
      
      * 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
        API for checking if KVM is enabled
      7760eaa0
  21. 24 6月, 2011 3 次提交
    • E
      Revert "Implement virDomainBlockPull for the qemu driver" · 3c2f0a17
      Eric Blake 提交于
      This reverts commit 784ee08d.
      3c2f0a17
    • E
      Revert "Asynchronous event for BlockPull completion" · c4c59e72
      Eric Blake 提交于
      This reverts commit 12cd77a0.
      
      Conflicts:
      
      	python/libvirt-override-virConnect.py
      	python/libvirt-override.c
      	src/remote/remote_protocol.x
      c4c59e72
    • D
      Support reboots with the QEMU driver · 42f43592
      Daniel P. Berrange 提交于
      For controlled shutdown we issue a 'system_powerdown' command
      to the QEMU monitor. This triggers an ACPI event which (most)
      guest OS wire up to a controlled shutdown. There is no equiv
      ACPI event to trigger a controlled reboot. This patch attempts
      to fake a reboot.
      
       - In qemuDomainObjPrivatePtr we have a bool fakeReboot
         flag.
       - The virDomainReboot method sets this flag and then
         triggers a normal 'system_powerdown'.
       - The QEMU process is started with '-no-shutdown'
         so that the guest CPUs pause when it powers off the
         guest
       - When we receive the 'POWEROFF' event from QEMU JSON
         monitor if fakeReboot is not set we invoke the
         qemuProcessKill command and shutdown continues
         normally
       - If fakeReboot was set, we spawn a background thread
         which issues 'system_reset' to perform a warm reboot
         of the guest hardware. Then it issues 'cont' to
         start the CPUs again
      
      * src/qemu/qemu_command.c: Add -no-shutdown flag if
        we have JSON support
      * src/qemu/qemu_domain.h: Add 'fakeReboot' flag to
        qemuDomainObjPrivate struct
      * src/qemu/qemu_driver.c: Fake reboot using the
        system_powerdown command if JSON support is available
      * 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
        binding for system_reset command
      * src/qemu/qemu_process.c: Reset the guest & start CPUs if
        fakeReboot is set
      42f43592
  22. 15 6月, 2011 2 次提交
    • A
      Asynchronous event for BlockPull completion · 12cd77a0
      Adam Litke 提交于
      When an operation started by virDomainBlockPullAll completes (either with
      success or with failure), raise an event to indicate the final status.  This
      allows an API user to avoid polling on virDomainBlockPullInfo if they would
      prefer to use the event mechanism.
      
      * daemon/remote.c: Dispatch events to client
      * include/libvirt/libvirt.h.in: Define event ID and callback signature
      * src/conf/domain_event.c, src/conf/domain_event.h,
        src/libvirt_private.syms: Extend API to handle the new event
      * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
        for block_stream completion and emit a libvirt block pull event
      * src/remote/remote_driver.c: Receive and dispatch events to application
      * src/remote/remote_protocol.x: Wire protocol definition for the event
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c: Watch for BLOCK_STREAM_COMPLETED event
        from QEMU monitor
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      12cd77a0
    • A
      Implement virDomainBlockPull for the qemu driver · 784ee08d
      Adam Litke 提交于
      The virDomainBlockPull* family of commands are enabled by the
      'block_stream' and 'info block_stream' qemu monitor commands.
      
      * src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement disk
        streaming by using the stream and info stream text monitor commands
      * src/qemu/qemu_monitor_json.[ch]: implement commands using the qmp monitor
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      Acked-by: NDaniel P. Berrange <berrange@redhat.com>
      784ee08d
  23. 29 5月, 2011 2 次提交
    • D
      Issue full error messages when processing QEMU monitor I/O · 80d2038d
      Daniel P. Berrange 提交于
      Currently the QEMU monitor I/O handler code uses errno values
      to report errors. This results in a sub-optimal error messages
      on certain conditions, in particular when parsing JSON strings
      malformed data simply results in 'EINVAL'.
      
      This changes the code to use the standard libvirt error reporting
      APIs. The virError is stored against the qemuMonitorPtr struct,
      and when a monitor API is run, any existing stored error is copied
      into that thread's error local
      
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Use
        virError APIs for all monitor I/O handling code
      80d2038d
    • D
      Don't kill QEMU process when a monitor I/O parsing error occurs · 4454a9ef
      Daniel P. Berrange 提交于
      Currently whenever there is any failure with parsing the monitor,
      this is treated in the same was as end-of-file (ie QEMU quit).
      The domain is terminated, if not already dead.
      
      With this change, failures in parsing the monitor stream do not
      result in the death of QEMU. The guest continues running unchanged,
      but all further use of the monitor will be disabled.
      
      The VMM_FAILURE event will be emitted, and the mgmt application
      can decide when to kill/restart the guest to re-gain control
      
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Run a
        different callback for monitor EOF vs error conditions.
      * src/qemu/qemu_process.c: Emit VMM_FAILURE event when monitor
        fails
      4454a9ef
  24. 16 5月, 2011 2 次提交
    • D
      Wire up SPICE client relocation with QEMU migration · cc53b4c4
      Daniel P. Berrange 提交于
      Use the graphics information from the QEMU migration cookie to
      issue a 'client_migrate_info' monitor command to QEMU. This causes
      the SPICE client to automatically reconnect to the target host
      when migration completes
      
      * src/qemu/qemu_migration.c: Set data for SPICE client relocation
        before starting migration on src
      * 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
        new qemuMonitorGraphicsRelocate() command
      cc53b4c4
    • J
      qemu: Update domain state when reconnecting monitor · 9f131961
      Jiri Denemark 提交于
      A qemu domain can get paused when libvirtd is stopped (e.g., because of
      I/O error) so we should check its current state when reconnecting to it.
      9f131961
  25. 13 5月, 2011 1 次提交
    • M
      qemu: Implement the driver methods · 9936aecf
      Michal Privoznik 提交于
      * src/qemu/qemu_driver.c: new qemuDomainScreenshot() function
      * 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:
        Monitor command
      9936aecf
  26. 11 5月, 2011 1 次提交
  27. 25 3月, 2011 1 次提交
    • E
      build: enforce reference count checking · 72d4ff5b
      Eric Blake 提交于
      Add the compiler attribute to ensure we don't introduce any more
      ref bugs like were just patched in commit 9741f346, then explicitly
      mark the remaining places in code that are safe.
      
      * src/qemu/qemu_monitor.h (qemuMonitorUnref): Mark
      ATTRIBUTE_RETURN_CHECK.
      * src/conf/domain_conf.h (virDomainObjUnref): Likewise.
      * src/conf/domain_conf.c (virDomainObjParseXML)
      (virDomainLoadStatus): Fix offenders.
      * src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
      * src/vmware/vmware_conf.c (vmwareLoadDomains): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainObjBeginJob)
      (qemuDomainObjBeginJobWithDriver)
      (qemuDomainObjExitRemoteWithDriver): Likewise.
      * src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): Likewise.
      Suggested by Daniel P. Berrange.
      72d4ff5b
  28. 22 3月, 2011 3 次提交
    • J
      qemu: Detect support for HMP passthrough · abdfca09
      Jiri Denemark 提交于
      abdfca09
    • E
      qemu: simplify interface fd handling in monitor · a24ada4e
      Eric Blake 提交于
      With only a single caller to these two monitor commands, I
      didn't need to wrap a new WithFds version, but just change
      the command itself.
      
      * src/qemu/qemu_monitor.h (qemuMonitorAddNetdev)
      (qemuMonitorAddHostNetwork): Add parameters.
      * src/qemu/qemu_monitor.c (qemuMonitorAddNetdev)
      (qemuMonitorAddHostNetwork): Add support for fd passing.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Use it to
      simplify code.
      a24ada4e
    • E
      qemu: simplify PCI configfd handling in monitor · 09831239
      Eric Blake 提交于
      This is also a bug fix - on the error path, qemu_hotplug would
      leave the configfd file leaked into qemu.  At least the next
      attempt to hotplug a PCI device would reuse the same fdname,
      and when the qemu getfd monitor command gets a new fd by the
      same name as an earlier one, it closes the earlier one, so there
      is no risk of qemu running out of fds.
      
      * src/qemu/qemu_monitor.h (qemuMonitorAddDeviceWithFd): New
      prototype.
      * src/qemu/qemu_monitor.c (qemuMonitorAddDevice): Move guts...
      (qemuMonitorAddDeviceWithFd): ...to new function, and add support
      for fd passing.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice): Use it
      to simplify code.
      Suggested by Daniel P. Berrange.
      09831239
  29. 16 3月, 2011 1 次提交
    • E
      qemu: support migration to fd · 100bba06
      Eric Blake 提交于
      * src/qemu/qemu_monitor.h (qemuMonitorMigrateToFd): New
      prototype.
      * src/qemu/qemu_monitor.c (qemuMonitorMigrateToFd): New function.
      100bba06
  30. 10 3月, 2011 2 次提交