1. 09 4月, 2015 1 次提交
  2. 26 3月, 2015 1 次提交
  3. 23 3月, 2015 1 次提交
  4. 19 3月, 2015 1 次提交
    • E
      qemu: track 'cancelling' migration state · e2660cb8
      Eric Blake 提交于
      In qemu 2.3, the migration status will include 'cancelling' in the
      window between when an asynchronous cancel has been requested and
      when the migration is actually halted.  Previously, qemu hid this
      state and reported 'active'.  Libvirt manages the sequence okay
      even when the string is unrecognized (that is, it will report an
      unknown state:
      
      Migration: [ 69 %]^Cerror: internal error: unexpected migration status in cancelling.
      
      but the migration is still cancelled), but recognizing the string
      makes for a smoother user experience.
      
      * src/qemu/qemu_monitor.h
      (QEMU_MONITOR_MIGRATION_STATUS_CANCELLING): Add enum.
      * src/qemu/qemu_monitor.c (qemuMonitorMigrationStatus): Map it.
      * src/qemu/qemu_migration.c (qemuMigrationUpdateJobStatus): Adjust
      clients.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONGetMigrationStatusReply): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e2660cb8
  5. 18 3月, 2015 1 次提交
    • E
      qemu: read backing chain names from qemu · f9ea3d60
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1199182 documents that
      after a series of disk snapshots into existing destination images,
      followed by active commits of the top image, it is possible for
      qemu 2.2 and earlier to end up tracking a different name for the
      image than what it would have had when opening the chain afresh.
      That is, when starting with the chain 'a <- b <- c', the name
      associated with 'b' is how it was spelled in the metadata of 'c',
      but when starting with 'a', taking two snapshots into 'a <- b <- c',
      then committing 'c' back into 'b', the name associated with 'b' is
      now the name used when taking the first snapshot.
      
      Sadly, older qemu doesn't know how to treat different spellings of
      the same filename as identical files (it uses strcmp() instead of
      checking for the same inode), which means libvirt's attempt to
      commit an image using solely the names learned from qcow2 metadata
      fails with a cryptic:
      
      error: internal error: unable to execute QEMU command 'block-commit': Top image file /tmp/images/c/../b/b not found
      
      even though the file exists.  Trying to teach libvirt the rules on
      which name qemu will expect is not worth the effort (besides, we'd
      have to remember it across libvirtd restarts, and track whether a
      file was opened via metadata or via snapshot creation for a given
      qemu process); it is easier to just always directly ask qemu what
      string it expects to see in the first place.
      
      As a safety valve, we validate that any name returned by qemu
      still maps to the same local file as we have tracked it, so that
      a compromised qemu cannot accidentally cause us to act on an
      incorrect file.
      
      * src/qemu/qemu_monitor.h (qemuMonitorDiskNameLookup): New
      prototype.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDiskNameLookup):
      Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskNameLookup): New function.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskNameLookup)
      (qemuMonitorJSONDiskNameLookupOne): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit)
      (qemuDomainBlockJobImpl): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f9ea3d60
  6. 11 3月, 2015 2 次提交
  7. 14 1月, 2015 1 次提交
    • P
      qemu_process: detect updated video ram size values from QEMU · ce745914
      Pavel Hrdina 提交于
      QEMU internally updates the size of video memory if the domain XML had
      provided too low memory size or there are some dependencies for a QXL
      devices 'vgamem' and 'ram' size. We need to know about the changes and
      store them into the status XML to not break migration or managedsave
      through different libvirt versions.
      
      The values would be loaded only if the "vgamem_mb" property exists for
      the device.  The presence of the "vgamem_mb" also tells that the
      "ram_size" and "vram_size" exists for QXL devices.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      ce745914
  8. 17 12月, 2014 1 次提交
    • E
      getstats: prepare monitor collection for recursion · 7b11f5e5
      Eric Blake 提交于
      A future patch will allow recursion into backing chains when
      collecting block stats.  This patch should not change behavior,
      but merely moves out the common code that will be reused once
      recursion is enabled, and adds the parameter that will turn on
      recursion.
      
      * src/qemu/qemu_monitor.h (qemuMonitorGetAllBlockStatsInfo)
      (qemuMonitorBlockStatsUpdateCapacity): Add recursion parameter,
      although it is ignored for now.
      * src/qemu/qemu_monitor.h (qemuMonitorGetAllBlockStatsInfo)
      (qemuMonitorBlockStatsUpdateCapacity): Likewise.
      * src/qemu/qemu_monitor_json.h
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacity): Likewise.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacity): Add parameter, and
      split...
      (qemuMonitorJSONGetOneBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacityOne): ...into helpers.
      (qemuMonitorJSONGetBlockStatsInfo): Update caller.
      * src/qemu/qemu_driver.c (qemuDomainGetStatsBlock): Update caller.
      * src/qemu/qemu_migration.c (qemuMigrationCookieAddNBD): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7b11f5e5
  9. 24 11月, 2014 1 次提交
    • P
      qemu: chardev: Extract more information about character devices · 4d7eb903
      Peter Krempa 提交于
      Improve the monitor function to also retrieve the guest state of
      character device (if provided) so that we can refresh the state of
      virtio-serial channels and perhaps react to changes in the state in
      future patches.
      
      This patch changes the returned data from qemuMonitorGetChardevInfo to
      return a structure containing the pty path and the state for all the
      character devices.
      
      The change to the testsuite makes sure that the data is parsed
      correctly.
      4d7eb903
  10. 21 11月, 2014 2 次提交
    • P
      qemu: Add handling for VSERPORT_CHANGE event · 15bbaaf0
      Peter Krempa 提交于
      New qemu added a new event that is emitted when a virtio serial channel
      is opened in the guest OS. This allows us to update the state of the
      port in the output-only XML element.
      
      This patch implements the monitor callbacks and necessary handlers to
      update the state in the definition.
      15bbaaf0
    • P
      qemu: monitor: Rename and improve qemuMonitorGetPtyPaths · e9a45069
      Peter Krempa 提交于
      To unify future additions that require information from "query-chardev"
      rename qemuMonitorGetPtyPaths and friends to qemuMonitorGetChardevInfo
      and move the allocation of the returned hash into the top level
      function.
      e9a45069
  11. 14 11月, 2014 1 次提交
  12. 11 11月, 2014 1 次提交
  13. 15 10月, 2014 1 次提交
    • P
      qemu: monitor: Add functions for object hot-add/remove · 6908f8ca
      Peter Krempa 提交于
      To allow live modification of device backends in qemu libvirt needs to
      be able to hot-add/remove "objects". Add monitor backend functions to
      allow this.
      
      This function will be used for hot-add/remove of RNG backends,
      IOThreads, memory backing objects, etc.
      6908f8ca
  14. 07 10月, 2014 2 次提交
    • L
      qemu: setup infrastructure to handle NIC_RX_FILTER_CHANGED event · b6bdda45
      Laine Stump 提交于
      NIC_RX_FILTER_CHANGED is sent by qemu any time a NIC driver in the
      guest modified the NIC's RX Filter (for example, if the MAC address of
      the NIC is changed by the guest).
      
      This patch doesn't do anything useful with that event; it just sets up
      all the plumbing to get news of the event into a worker thread with
      all proper locking/reference counting, and provide an easy place to
      add in desired functionality.
      
      See src/qemu/EVENTHANDLERS.txt for information/instructions on adding
      a libvirt-internal handler for a qemu event (using
      NIC_RX_FILTER_CHANGED as an example).
      b6bdda45
    • L
      qemu: qemuMonitorQueryRxFilter - retrieve guest netdev rx-filter · ab989962
      Laine Stump 提交于
      This function can be called at any time to get the current status of a
      guest's network device rx-filter. In particular it is useful to call
      after libvirt recieves a NIC_RX_FILTER_CHANGED event - this event only
      tells you that something has changed in the rx-filter, the details are
      retrieved with the query-rx-filter monitor command (only available in
      the json monitor). The command sent to the qemu monitor looks like this:
      
        {"execute":"query-rx-filter", "arguments": {"name":"net2"} }'
      
      and the results will look something like this:
      
      {
          "return": [
              {
                  "promiscuous": false,
                  "name": "net2",
                  "main-mac": "52:54:00:98:2d:e3",
                  "unicast": "normal",
                  "vlan": "normal",
                  "vlan-table": [
                      42,
                      0
                  ],
                  "unicast-table": [
      
                  ],
                  "multicast": "normal",
                  "multicast-overflow": false,
                  "unicast-overflow": false,
                  "multicast-table": [
                      "33:33:ff:98:2d:e3",
                      "01:80:c2:00:00:21",
                      "01:00:5e:00:00:fb",
                      "33:33:ff:98:2d:e2",
                      "01:00:5e:00:00:01",
                      "33:33:00:00:00:01"
                  ],
                  "broadcast-allowed": false
              }
          ],
          "id": "libvirt-14"
      }
      
      This is all parsed from JSON into a virNetDevRxFilter object for
      easier consumption. (unicast-table is usually empty, but is also an
      array of mac addresses similar to multicast-table).
      
      (NB: LIBNL_CFLAGS was added to tests/Makefile.am because virnetdev.h
      now includes util/virnetlink.h, which includes netlink/msg.h when
      appropriate. Without LIBNL_CFLAGS, gcc can't find that file (if
      libnl/netlink isn't available, LIBNL_CFLAGS will be empty and
      virnetlink.h won't try to include netlink/msg.h anyway).)
      ab989962
  15. 01 10月, 2014 3 次提交
  16. 30 9月, 2014 1 次提交
  17. 23 9月, 2014 3 次提交
  18. 18 9月, 2014 1 次提交
  19. 16 9月, 2014 1 次提交
  20. 12 9月, 2014 1 次提交
    • E
      blockcopy: add qemu implementation of new tunables · eef91f94
      Eric Blake 提交于
      Upstream qemu 1.4 added some drive-mirror tunables not present
      when it was first introduced in 1.3.  Management apps may want
      to set these in some cases (for example, without tuning
      granularity down to sector size, a copy may end up occupying
      more bytes than the original because an entire cluster is
      copied even when only a sector within the cluster is dirty,
      although tuning it down results in more CPU time to do the
      copy).  I haven't personally needed to use the parameters, but
      since they exist, and since the new API supports virTypedParams,
      we might as well expose them.
      
      Since the tuning parameters aren't often used, and omitted from
      the QMP command when unspecified, I think it is safe to rely on
      qemu 1.3 to issue an error about them being unsupported, rather
      than trying to create a new capability bit in libvirt.
      
      Meanwhile, all versions of qemu from 1.4 to 2.1 have a bug where
      a bad granularity (such as non-power-of-2) gives a poor message:
      error: internal error: unable to execute QEMU command 'drive-mirror': Invalid parameter 'drive-virtio-disk0'
      
      because of abuse of QERR_INVALID_PARAMETER (which is supposed to
      name the parameter that was given a bad value, rather than the
      value passed to some other parameter).  I don't see that a
      capability check will help, so we'll just live with it (and it
      has since been improved in upstream qemu).
      
      * src/qemu/qemu_monitor.h (qemuMonitorDriveMirror): Add
      parameters.
      * src/qemu/qemu_monitor.c (qemuMonitorDriveMirror): Likewise.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDriveMirror):
      Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDriveMirror):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockCopyCommon): Likewise.
      (qemuDomainBlockRebase, qemuDomainBlockCopy): Adjust callers.
      * src/qemu/qemu_migration.c (qemuMigrationDriveMirror): Likewise.
      * tests/qemumonitorjsontest.c (qemuMonitorJSONDriveMirror): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      eef91f94
  21. 06 9月, 2014 3 次提交
    • E
      blockjob: allow finer bandwidth tuning for query · db33cc24
      Eric Blake 提交于
      While reviewing the new virDomainBlockCopy API, Peter Krempa
      pointed out that our existing design of using MiB/s for block
      job bandwidth is rather coarse, especially since qemu tracks
      it in bytes/s; so virDomainBlockCopy only accepts bytes/s.
      But once the new API is implemented for qemu, we will be in
      the situation where it is possible to set a value that cannot
      be accurately reflected back to the user, because the existing
      virDomainGetBlockJobInfo defaults to the coarser units.
      
      Fortunately, we have an escape hatch; and one that has already
      served us well in the past: we can use the flags argument to
      specify which scale to use (see virDomainBlockResize for prior
      art).  This patch fixes the query side of the API; made easier
      by previous patches that split the query side out from the
      modification code.  Later patches will address the virsh
      interface, as well retrofitting all other blockjob APIs to
      also accept a flag for toggling bandwidth units.
      
      * include/libvirt/libvirt.h.in (_virDomainBlockJobInfo)
      (VIR_DOMAIN_BLOCK_COPY_BANDWIDTH): Document sizing issues.
      (virDomainBlockJobInfoFlags): New enum.
      * src/libvirt.c (virDomainGetBlockJobInfo): Document new flag.
      * src/qemu/qemu_monitor.h (qemuMonitorBlockJobInfo): Add parameter.
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJobInfo): Likewise.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockJobInfo):
      Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJobInfo)
      (qemuMonitorJSONGetBlockJobInfoOne): Likewise. Don't scale here.
      * src/qemu/qemu_migration.c (qemuMigrationDriveMirror): Update
      callers.
      * src/qemu/qemu_driver.c (qemuDomainBlockPivot)
      (qemuDomainBlockJobImpl): Likewise.
      (qemuDomainGetBlockJobInfo): Likewise, and support new flag.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      db33cc24
    • E
      blockjob: hoist bandwidth scaling out of monitor code · 08cc14f7
      Eric Blake 提交于
      qemu treats blockjob bandwidth as a 64-bit number, in the units
      of bytes/second.  But we stupidly modeled block job bandwidth
      after migration bandwidth, which in turn was an 'unsigned long'
      and therefore subject to 32-bit vs. 64-bit interpretations, and
      with a scale of MiB/s.  Our code already has to convert between
      the two scales, and report overflow as appropriate; although
      this conversion currently lives in the monitor code.  In fact,
      our conversion code limited things to 63 bits, because we
      checked against LLONG_MAX and reject what would be negative
      bandwidth if treated as signed.
      
      On the bright side, our use of MiB/s means that even with a
      32-bit unsigned long, we still have no problem representing a
      bandwidth of 2GiB/s, which is starting to be more feasible as
      10-gigabit or even faster interfaces are used.  And once you
      get past the physical speeds of existing interfaces, any larger
      bandwidth number behaves the same - effectively unlimited.
      But on the low side, the granularity of 1MiB/s tuning is rather
      coarse.  So the new virDomainBlockJob API decided to go with
      a direct 64-bit bytes/sec number instead of the scaled number
      that prior blockjob APIs had used.  But there is no point in
      rounding this number to MiB/s just to scale it back to bytes/s
      for handing to qemu.
      
      In order to make future code sharing possible between the old
      virDomainBlockRebase and the new virDomainBlockCopy, this patch
      moves the scaling and overflow detection into the driver code.
      Several of the block job calls that can set speed are fed
      through a common interface, so it was easier to adjust all block
      jobs at once, for consistency.  This patch is just code motion;
      there should be no user-visible change in behavior.
      
      * src/qemu/qemu_monitor.h (qemuMonitorBlockJob)
      (qemuMonitorBlockCommit, qemuMonitorDriveMirror): Change
      parameter type and scale.
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob)
      (qemuMonitorBlockCommit, qemuMonitorDriveMirror): Move scaling
      and overflow detection...
      * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl)
      (qemuDomainBlockRebase, qemuDomainBlockCommit): ...here.
      (qemuDomainBlockCopy): Use bytes/sec.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      08cc14f7
    • E
      blockjob: split out block info monitor handling · ced81365
      Eric Blake 提交于
      Another layer of overly-multiplexed code that deserves to be
      split into obviously separate paths for query vs. modify.
      This continues the cleanup started in commit cefe0ba3.
      
      In the process, make some tweaks to simplify the logic when
      parsing the JSON reply.  There should be no user-visible
      semantic changes.
      
      * src/qemu/qemu_monitor.h (qemuMonitorBlockJob): Drop parameter.
      (qemuMonitorBlockJobInfo): New prototype.
      (BLOCK_JOB_INFO): Drop enum.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockJob)
      (qemuMonitorJSONBlockJobInfo): Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Split...
      (qemuMonitorBlockJobInfo): ...into second function.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Move
      block info portions...
      (qemuMonitorJSONGetBlockJobInfo): ...here, and rename...
      (qemuMonitorJSONBlockJobInfo): ...and export.
      (qemuMonitorJSONGetBlockJobInfoOne): Alter return semantics.
      * src/qemu/qemu_driver.c (qemuDomainBlockPivot)
      (qemuDomainBlockJobImpl, qemuDomainGetBlockJobInfo): Adjust
      callers.
      * src/qemu/qemu_migration.c (qemuMigrationDriveMirror)
      (qemuMigrationCancelDriveMirror): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ced81365
  22. 20 8月, 2014 1 次提交
  23. 17 7月, 2014 1 次提交
  24. 04 7月, 2014 3 次提交
    • P
      qemu: monitor: Add support for backing name specification for block-stream · a448713a
      Peter Krempa 提交于
      To allow changing the name that is recorded in the top of the current
      image chain used in a block pull/rebase operation, we need to specify
      the backing name to qemu. This is done via the "backing-file" attribute
      to the block-stream commad.
      a448713a
    • P
      qemu: monitor: Add argument for specifying backing name for block commit · c29b6529
      Peter Krempa 提交于
      To allow changing the name that is recorded in the overlay of the TOP
      image used in a block commit operation, we need to specify the backing
      name to qemu. This is done via the "backing-file" attribute to the
      block-commit command.
      c29b6529
    • E
      blockjob: allow omitted arguments to QMP block-commit · 47549d5a
      Eric Blake 提交于
      We are about to turn on support for active block commit.  Although
      qemu 2.0 was the first version to mostly support it, that version
      mis-handles 0-length files, and doesn't have anything available for
      easy probing.  But qemu 2.1 fixed bugs, and made life simpler by
      letting the 'top' argument be optional.  Unless someone begs for
      active commit with qemu 2.0, for now we are just going to enable
      it only by probing for qemu 2.1 behavior (anyone backporting active
      commit can also backport the optional argument behavior).  This
      requires qemu.git commit 7676e2c597000eff3a7233b40cca768b358f9bc9.
      
      Although all our actual uses of block-commit supply arguments for
      both base and top, we can omit both arguments and use a bogus
      device string to trigger an interesting behavior in qemu.  All QMP
      commands first do argument validation, failing with GenericError
      if a mandatory argument is missing.  Once that passes, the code
      in the specific command gets to do further checking, and the qemu
      developers made sure that if device is the only supplied argument,
      then the block-commit code will look up the device first, with a
      failure of DeviceNotFound, before attempting any further argument
      validation (most other validations fail with GenericError).  Thus,
      the category of error class can reliably be used to decipher
      whether the top argument was optional, which in turn implies a
      working active commit.  Since we expect our bogus device string to
      trigger an error either way, the code is written to return a
      distinct return value without spamming the logs.
      
      * src/qemu/qemu_monitor.h (qemuMonitorSupportsActiveCommit): New
      prototype.
      * src/qemu/qemu_monitor.c (qemuMonitorSupportsActiveCommit):
      Implement it.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockCommit):
      Allow NULL for top and base, for probing purposes.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockCommit):
      Likewise, implementing the probe.
      * tests/qemumonitorjsontest.c (mymain): Enable...
      (testQemuMonitorJSONqemuMonitorSupportsActiveCommit): ...a new test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      47549d5a
  25. 03 6月, 2014 1 次提交
  26. 25 3月, 2014 2 次提交
  27. 21 3月, 2014 2 次提交
    • C
      libvirt support to force convergence of live guest migration · 05e1b06a
      Chegu Vinod 提交于
      Busy enterprise workloads hosted on large sized VM's tend to dirty
      memory faster than the transfer rate achieved via live guest migration.
      Despite some good recent improvements (& using dedicated 10Gig NICs
      between hosts) the live migration may NOT converge.
      
      Recently support was added in qemu (version 1.6) to allow a user to
      choose if they wish to force convergence of their migration via a
      new migration capability : "auto-converge". This feature allows for qemu
      to auto-detect lack of convergence and trigger a throttle-down of the
      VCPUs.
      
      This patch includes the libvirt support needed to trigger this
      feature. (Testing is in progress)
      Signed-off-by: NChegu Vinod <chegu_vinod@hp.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      05e1b06a
    • E
      qemu: enable monitor event reporting · 3566599a
      Eric Blake 提交于
      Wire up all the pieces to send arbitrary qemu events to a
      client using libvirt-qemu.so.  If the extra bookkeeping of
      generating event objects even when no one is listening turns
      out to be noticeable, we can try to further optimize things
      by adding a counter for how many connections are using events,
      and only dump events when the counter is non-zero; but for
      now, I didn't think it was worth the code complexity.
      
      * src/qemu/qemu_driver.c
      (qemuConnectDomainQemuMonitorEventRegister)
      (qemuConnectDomainQemuMonitorEventDeregister): New functions.
      * src/qemu/qemu_monitor.h (qemuMonitorEmitEvent): New prototype.
      (qemuMonitorDomainEventCallback): New typedef.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONIOProcessEvent):
      Report events.
      * src/qemu/qemu_monitor.c (qemuMonitorEmitEvent): New function, to
      pass events through.
      * src/qemu/qemu_process.c (qemuProcessHandleEvent): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3566599a