1. 28 10月, 2011 1 次提交
    • D
      Extend graphics event to include UNIX socket · 6aa27da2
      Daniel P. Berrange 提交于
      Not all VNC/SPICE servers use a TCP socket for their connections.
      It is possible to configure a UNIX socket server. The graphics
      event must thus include a UNIX socket address type.
      
      * include/libvirt/libvirt.h.in: Add UNIX socket address type
        for graphics event
      * src/qemu/qemu_monitor_json.c: Add 'unix' string to address
        type enum
      6aa27da2
  2. 27 10月, 2011 1 次提交
    • D
      Add a systemtap script for watching QEMU monitor interactions · 9b76b08a
      Daniel P. Berrange 提交于
      This change adds some systemtap/dtrace probes to the QEMU monitor
      client code. In particular it allows watching of all operations
      for a VM
      
      * examples/systemtap/qemu-monitor.stp: Watch all monitor commands
      * src/Makefile.am: Passing libdir/bindir/sbindir to dtrace2systemtap.pl
      * src/dtrace2systemtap.pl: Accept libdir/bindir/sbindir as args
        and look for '# binary:' comment to mark probes against libvirtd
        vs libvirt.so
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c,
        src/qemu/qemu_monitor_text.c: Add probes for key functions
      9b76b08a
  3. 14 10月, 2011 1 次提交
  4. 12 10月, 2011 1 次提交
    • E
      snapshot: use correct qmp monitor command · 59f179ce
      Eric Blake 提交于
      To date, JSON disk snapshots worked by accident, as they were always
      using hmp fallback due to a typo in commit e702b5ba not picking up
      on the (intentional) difference in command names between the two
      monitor protocols.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskSnapshot):
      Spell QMP command correctly.
      Reported by Luiz Capitulino.
      59f179ce
  5. 08 10月, 2011 1 次提交
    • E
      qemu: silence Coverity false positive · 0654d274
      Eric Blake 提交于
      Coverity complained that 4 out of 5 callers to virJSONValueObjectGetBoolean
      checked for errors.  But we documented that we don't care in this case.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetBlockInfo): Use
      ignore_value.
      0654d274
  6. 29 9月, 2011 1 次提交
  7. 28 9月, 2011 1 次提交
  8. 16 9月, 2011 1 次提交
  9. 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
  10. 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
  11. 02 9月, 2011 1 次提交
    • A
      BlockPull: Set initial bandwidth limit if specified · d4b9e062
      Adam Litke 提交于
      The libvirt BlockPull API supports the use of an initial bandwidth limit but the
      qemu block_stream API does not.  To get the desired behavior we use the two APIs
      strung together: first BlockPull, then BlockJobSetSpeed.  We can do this at the
      driver level to avoid duplicated code in each monitor path.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      d4b9e062
  12. 24 8月, 2011 1 次提交
    • O
      qemu: Report error if qemu monitor command not found for BlockJob · 10b10024
      Osier Yang 提交于
      * src/qemu/qemu_monitor_json.c: Handle error "CommandNotFound" and
        report the error.
      
      * src/qemu/qemu_monitor_text.c: If a sub info command is not found,
        it prints the output of "help info", for other commands,
        "unknown command" is printed.
      
      Without this patch, libvirt always report:
      
        An error occurred, but the cause is unknown
      
      This patch was adapted from a patch by Osier Yang <jyang@redhat.com> to
      break out detection of unrecognized text monitor commands into a separate
      function.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      10b10024
  13. 17 8月, 2011 1 次提交
    • T
      qemu: disk migration verbose progress · 108ca333
      Tom Vijlbrief 提交于
      A virsh command like:
      
      migrate --live --copy-storage-all Guest qemu+ssh://user@host/system
      --persistent --verbose
      
      shows
      
      Migration: [  0 %]
      
      during the storage copy and does not start counting
      until the ram transfer starts
      
      Fix this by scraping optional disk transfer status, and adding it
      into the progress meter.
      108ca333
  14. 03 8月, 2011 1 次提交
    • E
      qemu: avoid null deref on block pull error · 9160573d
      Eric Blake 提交于
      Coverity detected that 5 of 6 callers of virJSONValueArrayGet checked
      for a NULL return; and that by not checking we risk a null deref
      during an error.  The error is unlikely since the prior call to
      virJSONValueArraySize would probably have already caught any botched
      JSON array parse, but better safe than sorry.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetBlockJobInfo):
      Check for NULL.
      (qemuMonitorJSONExtractPtyPaths): Fix typo.
      9160573d
  15. 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
  16. 21 7月, 2011 1 次提交
  17. 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
  18. 01 7月, 2011 1 次提交
    • D
      Fix leak of JSON object for events · 5ab8746f
      Daniel P. Berrange 提交于
      The event handler functions do not free the virJSONValuePtr
      object. Every event received from a VM thus caused a memory
      leak
      
      * src/qemu/qemu_monitor_json.c: Fix leak of event object
      5ab8746f
  19. 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
  20. 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
  21. 14 6月, 2011 1 次提交
    • O
      qemu: Parse current balloon value returned by query_balloon · 41514f7b
      Osier Yang 提交于
      Qemu once supported following memory stats which will returned by
      "query_balloon":
      
          stat_put(dict, "actual", actual);
          stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]);
          stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]);
          stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]);
          stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]);
          stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]);
          stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]);
      
      But it later disabled all the stats except "actual" by commit
      07b0403dfc2b2ac179ae5b48105096cc2d03375a.
      
      libvirt doesn't parse "actual", so user will always see a empty result
      with "virsh dommemstat $domain". Even qemu haven't disabled the stats,
      we should support parsing "actual".
      41514f7b
  22. 29 5月, 2011 1 次提交
    • 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
  23. 26 5月, 2011 1 次提交
  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. 12 5月, 2011 1 次提交
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
  27. 11 5月, 2011 1 次提交
  28. 30 3月, 2011 1 次提交
    • W
      check whether qemuMonitorJSONHMP() failed · 0ecfa7f2
      Wen Congyang 提交于
      If qemu quited unexpectedly when we call qemuMonitorJSONHMP(),
      libvirt will crash.
      Steps to reproduce this bug:
      1. use gdb to attach libvirtd, and set a breakpoint in the function
         qemuMonitorSetCapabilities()
      2. start a vm
      3. let the libvirtd to run until qemuMonitorJSONSetCapabilities() returns.
      4. kill the qemu process
      5. continue running libvirtd
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      0ecfa7f2
  29. 22 3月, 2011 3 次提交
  30. 15 3月, 2011 2 次提交
    • W
      ce81bc5c
    • E
      qemu: consolidate duplicated monitor migration code · 1c5dc4c6
      Eric Blake 提交于
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextMigrate): Declare
      in place of individual monitor commands.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONMigrate): Likewise.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextMigrateToHost)
      (qemuMonitorTextMigrateToCommand, qemuMonitorTextMigrateToFile)
      (qemuMonitorTextMigrateToUnix): Delete.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONMigrateToHost)
      (qemuMonitorJSONMigrateToCommand, qemuMonitorJSONMigrateToFile)
      (qemuMonitorJSONMigrateToUnix): Delete.
      * src/qemu/qemu_monitor.c (qemuMonitorMigrateToHost)
      (qemuMonitorMigrateToCommand, qemuMonitorMigrateToFile)
      (qemuMonitorMigrateToUnix): Consolidate shared code.
      1c5dc4c6
  31. 10 3月, 2011 1 次提交
    • J
      qemu: Fallback to HMP for snapshot commands · 89241fe0
      Jiri Denemark 提交于
      qemu driver in libvirt gained support for creating domain snapshots
      almost a year ago in libvirt 0.8.0. Since then we enabled QMP support
      for qemu >= 0.13.0 but QMP equivalents of {save,load,del}vm commands are
      not implemented in current qemu (0.14.0) so the domain snapshot support
      is not very useful.
      
      This patch detects when the appropriate QMP command is not implemented
      and tries to use human-monitor-command (aka HMP passthrough) to run
      it's HMP equivalent.
      89241fe0