1. 07 10月, 2014 1 次提交
    • 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
  2. 04 10月, 2014 1 次提交
    • E
      qemu: support nospace reason in io error event · e9392e48
      Eric Blake 提交于
      Aeons ago (commit 34dcbbb4, v0.8.2), we added a new libvirt event
      (VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON) in order to tell the user WHY
      the guest halted.  This is because at least VDSM wants to react
      differently to ENOSPC events (resize the lvm partition to be larger,
      and resume the guest as if nothing had happened) from all other events
      (I/O is hosed, throw up our hands and flag things as broken).  At the
      time this was done, downstream RHEL qemu added a vendor extension
      '__com.redhat_reason', which would be exactly one of these strings:
      "enospc", "eperm", "eio", and "eother".  In our stupidity, we exposed
      those exact strings to clients, rather than an enum, and we also
      return "" if we did not have access to a reason (which was the case
      for upstream qemu).
      
      Fast forward to now: upstream qemu commit c7c2ff0c (will be qemu 2.2)
      FINALLY adds a 'nospace' boolean, after discussion with multiple
      projects determined that VDSM really doesn't care about distinction
      between any other error types.  So this patch converts 'nospace' into
      the string "enospc" for compatibility with RHEL clients that were
      already used to the downstream extension, while leaving the reason
      blank for all other cases (no change from the status quo).
      
      See also https://bugzilla.redhat.com/show_bug.cgi?id=1119784
      
      * src/qemu/qemu_monitor_json.c (qewmuMonitorJSONHandleIOError):
      Parse reason field from modern qemu.
      * include/libvirt/libvirt.h.in
      (virConnectDomainEventIOErrorReasonCallback): Document it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e9392e48
  3. 01 10月, 2014 4 次提交
  4. 30 9月, 2014 2 次提交
  5. 23 9月, 2014 2 次提交
  6. 18 9月, 2014 1 次提交
  7. 16 9月, 2014 1 次提交
  8. 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
  9. 11 9月, 2014 1 次提交
    • J
      qemu: Resolve Coverity FORWARD_NULL · bf15f10a
      John Ferlan 提交于
      If the virJSONValueNewObject() fails, then rather than going to error
      and getting a Coverity false positive since it doesn't seem to understand
      the relationship between nkeywords, keywords, and values and seems to
      believe calling qemuFreeKeywords will cause a NULL deref - just return NULL
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      bf15f10a
  10. 10 9月, 2014 2 次提交
  11. 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: add new monitor json conversions · fcbeb2e9
      Eric Blake 提交于
      The previous patch hoisted some bounds checks to the callers;
      but someone that is not aware of the hoisted check could now
      try passing an integer between LLONG_MAX and ULLONG_MAX.  As a
      safety measure, add new json conversion modes that let libvirt
      error out early instead of pass bad numbers to qemu, if the
      caller ever makes a mistake due to later refactoring.
      
      Convert the various blockjob QMP calls to use the new modes,
      and switch some of them to be optional (QMP has always supported
      an omitted "speed" the same as "speed":0, for everything except
      block-job-set-speed).
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONMakeCommandRaw):
      Add 'j'/'y' and 'J'/'Y' to error out on negative input.
      (qemuMonitorJSONDriveMirror, qemuMonitorJSONBlockCommit)
      (qemuMonitorJSONBlockJob): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      fcbeb2e9
    • 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
  12. 20 8月, 2014 2 次提交
  13. 17 7月, 2014 1 次提交
  14. 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
  15. 03 7月, 2014 1 次提交
  16. 03 6月, 2014 3 次提交
    • P
      qemu: monitor: Fix type of holdtime argument in qemuMonitorJSONSendKey · ce2107a9
      Peter Krempa 提交于
      qemuMonitorJSONSendKey declares the "holdtime" argument as unsigned int
      while the command was constructed in qemuMonitorJSONMakeCommand using
      the "P" modifier which took a unsigned long from the variable
      arguments which then made it possible to access uninitialized memory.
      
      This broke the qemumonitorjsontest on 32bit fedora 20:
      64) qemuMonitorJSONSendKey
      ... libvirt: QEMU Driver error : internal error: unsupported data type 'W' for arg 'WVSƒì ‹D$0è‘wÿÿÃAå' FAILED
      
      Uncovered by upstream commit f744b831.
      
      Additionally add test for the hold-time option.
      ce2107a9
    • P
      qemu: json: Add format strings for optional command arguments · f744b831
      Peter Krempa 提交于
      This patch adds option to specify that a json qemu command argument is
      optional without the need to use if's or ternary operators to pass the
      list. Additionally all the modifier characters are documented to avoid
      user confusion.
      f744b831
    • J
      conf: more enum cleanups in "src/conf/domain_conf.h" · 5a2bd4c9
      Julio Faracco 提交于
      In "src/conf/domain_conf.h" there are many enum declarations. The
      cleanup in this header filer was started, but it wasn't enough and
      there are many other files that has enum variables declared. So, the
      commit was starting to be big. This commit finish the cleanup in this
      header file and in other files that has enum variables, parameters,
      or functions declared.
      Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5a2bd4c9
  17. 22 5月, 2014 1 次提交
  18. 05 4月, 2014 1 次提交
    • R
      bhyve: add console support through nmdm device · 6c91134d
      Roman Bogorodskiy 提交于
      nmdm is a FreeBSD driver which allows to create a pair of tty
      devices one of which is passed to the guest and second is used
      by the client.
      
      This patch adds new 'nmdm' character device type. Its definition
      looks this way:
      
      <serial type='nmdm'>
        <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/>
      </serial>
      
      Master is passed to the hypervisior and slave is used for client
      connection.
      
      Also implement domainOpenConsole() for bhyve driver based on that.
      6c91134d
  19. 25 3月, 2014 3 次提交
  20. 21 3月, 2014 2 次提交
    • 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
    • M
      b1d5f6c6
  21. 18 3月, 2014 2 次提交
  22. 12 3月, 2014 1 次提交
    • E
      qemu: don't munge user input during block commit · 359f4b11
      Eric Blake 提交于
      While investigating https://bugzilla.redhat.com/show_bug.cgi?id=1061827
      I noticed that we pass user input unscathed for block-pull, but
      always pass a canonical absolute name through for block-commit.
      [Note that we probably _ought_ to validate that the user's request
      for block-pull actually matches the backing chain, the way we already
      do for block-commit - but that's a separate issue.  Further note that
      the ability to pass user input through unscathed allows backdoors
      such as specifying a backing image that is a network URI such as
      a gluster disk, instead of forcing things to the local file system;
      which is an area still under active investigation on whether libvirt
      needs to behave differently for network disks.]
      
      Since qemu may write the name that the user passed in as the backing
      file, a user may have a reason to want a relative file name passed
      through to qemu, and always munging things to absolute prevents that.
      
      Put another way, if you have the backing chain:
      
      [A] <- [B(back=./A)] <- [C(back=./B)]
      
      and commit B into A (virsh blockcommit $dom vda --base A --top B),
      the metadata of C will have to be re-written. But should it be
      rewritten as [C(back=./A)] or as [C(back=/path/to/A)]?  Still up in
      the air is whether qemu's decision should be based on whether B
      and/or C had relative paths, or on whether the --base and/or
      --top arguments to the command were relative paths; but if we always
      pass a canonical name, we've prevented the spelling of the command
      arguments from being part of the hueristics that qemu uses.
      
      I also audited the code, and verified that we never call
      qemuMonitorBlockCommit() with a NULL base, either before or after
      the change to qemu_driver.c.
      
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Preserve user's
      spelling, since absolute vs. relative matters to qemu.
      * src/qemu/qemu_monitor.h (qemuMonitorBlockCommit): Base is never
      null.
      * src/qemu/qemu_monitor.c (qemuMonitorBlockCommit): Likewise.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockCommit):
      Likewise.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockCommit):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      359f4b11
  23. 10 3月, 2014 1 次提交