1. 28 8月, 2014 12 次提交
    • P
      lib: Add few flags for the bulk stats APIs · 1438807b
      Peter Krempa 提交于
      Add domain list filtering functions and a flag to enforce checking
      whether the remote daemon supports the requested stats groups.
      1438807b
    • P
      conf: Add helper to free domain list · e4151224
      Peter Krempa 提交于
      Add helper to free a list of virDomainPtrs without raising or clearing
      errors. Use it in one place and prepare it for reuse.
      e4151224
    • E
      virsh: fix keepalive error msg · f284ee54
      Erik Skultety 提交于
      resolves https://bugzilla.redhat.com/show_bug.cgi?id=1132305:
      
      The error message for an out-of-range argument was confusing:
      
      virsh -k 9999999999
      error: option --k requires a positive numeric argument
      
      After this patch, it is:
      
      error: Invalid value for option -k
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f284ee54
    • J
      qemu_capabilities: Resolve Coverity NULL_RETURNS · cabebc0c
      John Ferlan 提交于
      Adjust the initialization of qemuCaps() to check for a NULL before
      attempting to dereference like other callers/users do.
      cabebc0c
    • J
      qemu_driver: Resolve Coverity CONSTANT_EXPRESSION_RESULT · 9d7254de
      John Ferlan 提交于
      The call to virDomainSnapshotRedefinePrep() had a spurrious ! in front of
      it which caused Coverity to complan that the expression is always false.
      9d7254de
    • J
      domain_conf: Resolve Coverity REVERSE_INULL · 0c5ca985
      John Ferlan 提交于
      Coverity complains that checking for domain->def being non NULL in the
      if (live) path of virDomainObjAssignDef() would be unnecessary or a
      NULL deref since the call to virDomainObjIsActive() would already
      dereference domain->def when checking if the def->id field was != -1.
      
      Checked all callers to virDomainObjAssignDef() and each at some point
      dereferences (vm)->def->{field} prior to calling when live is true.
      0c5ca985
    • J
      qemu_command: Resolve Coverity REVERSE_INULL · 39b9c121
      John Ferlan 提交于
      In qemuNetworkIfaceConnect() a call to virNetDevBandwidthSet() is
      made where the function prototype requires the first parameter
      (net->ifname) to be non NULL.  Coverity complains that the subsequent
      non NULL check for net->ifname prior to the next call gets flagged as
      an unnecessary check.  Resolve by removing the extra check
      39b9c121
    • J
      domain_conf: Resolve Coverity REVERSE_INULL · 9ba04dec
      John Ferlan 提交于
      In virDomainActualNetDefFormat() a call to virDomainNetGetActualType(def)
      was made before a check for (!def) a few lines later. This triggered
      Coverity to note the possible NULL deref.  Just moving the initialization
      to after the !def checks resolves the issue
      9ba04dec
    • J
      storage_driver: Resolve Coverity REVERSE_INULL · bab35f74
      John Ferlan 提交于
      There were two occurrances of attempting to initialize actualType by
      calling virStorageSourceGetActualType(src) prior to a check if (!src)
      resulting in Coverity complaining about the possible NULL dereference
      in virStorageSourceGetActualType() of src.
      
      Resolve by moving the actualType setting until after checking !src
      bab35f74
    • J
      xen_xm: Resolve Coverity USE_AFTER_FREE · cfbbeb36
      John Ferlan 提交于
      If virDomainDiskDefFree(disk) is called in 'skipdisk:', then it's possible
      to either return to skipdisk without reallocating a new disk (via the if
      condition just prior) or to end the loop having deleted the disk. Since
      virDomainDiskDefFree() does not pass by reference, disk isn't changed in
      this context, thus the possible issue.
      cfbbeb36
    • J
      xen_common: Resolve Coverity USE_AFTER_FREE · 0454f23c
      John Ferlan 提交于
      There were two warnings in this module
      
        If the VIR_ALLOC_N(def->serials, 1) fails, then a virDomainChrDefFree(chr)
        is called and we jump to cleanup which makes the same call. Just remove
        the one after VIR_ALLOC_N()
      
        In the label "skipnic:" a virDomainNetDefFree(net) is made; however, if
        in going back to the top of the loop we jump back down to skipnic for any
        reason, the call will attempt to free an already freed structure since
        "net" was not passed by reference to virDomainNetDefFree().  Just set
        net = NULL in skipnic: to resolve the issue.
      0454f23c
    • J
      parallels: Resolve Coverity USE_AFTER_FREE · 0da9a8a8
      John Ferlan 提交于
      Coverity complains that calling virNetworkDefFree(def), then jumping
      to the cleanup: label which calls virNetworkDefFree(def) could result
      in a double_free.  Just remove the call from the if statement.
      0da9a8a8
  2. 27 8月, 2014 14 次提交
    • M
      conf: fix leak with def->mem.hugepages · a6a210b8
      Martin Kletzander 提交于
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      a6a210b8
    • M
      vbox: Register per partes · dbb4cbf5
      Michal Privoznik 提交于
      Since times when vbox moved to the daemon (due to some licensing
      issue) the subdrivers that vbox implements were registered, but not
      opened since our generic subdrivers took priority. I've tried to fix
      this in 65b7d553 but it was not correct. Apparently moving
      vbox driver registration upfront changes the default connection URI
      which makes some users sad. So, this commit breaks vbox into pieces
      and register vbox's network and storage drivers first, and vbox driver
      then at the end. This way, the vbox driver is registered in the order
      it always was, but its subdrivers are registered prior the generic
      ones.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      dbb4cbf5
    • M
      virDriverLoadModule: Honor libvirt func name tranlsation · 27d59ab7
      Michal Privoznik 提交于
      There's this unwritten rule in libvirt that vir_function is translated
      into virFunction when needed (e.g. in remote protocol definition,
      python, ...). Up till now we ignored such translation in driver module
      loading and did fine. Well, we didn't have any module with an
      underscore in its name. But this will change in next commit. The
      problem is, once an a module is dlopen()-ed, we derive register
      function name from its name. So instead of "driver_subdriverRegister"
      do some magic to turn that into "driverSubdriverRegister".
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      27d59ab7
    • M
      virdrivermoduletest: Test all the modules · 5feaef17
      Michal Privoznik 提交于
      Even though we kept adding new and new modules (e.g. vbox or bhyve)
      the test wasn't updated. Do that now. Moreover, while it's not
      crucial, it's nice to reorder test cases to match the order in which
      the daemon loads the modules.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5feaef17
    • E
      domain_conf: fix internal flag verification · 79f4c4e6
      Eric Blake 提交于
      While working on virDomainBlockCopy, I noticed we had a verify()
      concerning internal XML flags that was incomplete after several
      recent flag additions; move that up higher in the code to make it
      harder to forget to modify on the next flag addition.  Adjust
      some formatting while at it.
      
      * src/conf/domain_conf.c (verify): Move closer to internal flag
      definitions.  Cover missing flags ALLOW_ROM and ALLOW_BOOT.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      79f4c4e6
    • E
      virsh: drop unused variable · 1db2f4f7
      Eric Blake 提交于
      While prepping for virDomainBlockJob patches, I found some dead code.
      
      * tools/virsh-domain.c (blockJobImpl): Kill unused 'name'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1db2f4f7
    • J
      qemu: call endjob in RevertToSnapshot · 03b994fa
      Jincheng Miao 提交于
      In qemuDomainRevertToSnapshot(), it will check snap->def->state.
      But when the state is PMSUSPENDED/NOSTATE/BLOCKED, it forgets to
      call qemuDomainObjEndJob.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1134154
      Bug introduced in commit 1e833899.
      Signed-off-by: NJincheng Miao <jmiao@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      03b994fa
    • E
      API: Tweak virDomainOpenGraphics to return fd directly · b259e459
      Eric Blake 提交于
      Let's fix this before we bake in a painful API.  Since we know
      that we have exactly one non-negative fd on success, we might
      as well return the fd directly instead of forcing the user to
      pass in a pointer.  Furthermore, I found some memory and fd
      leaks while reviewing the code - the idea is that on success,
      libvirtd will have handed two fds in two different directions:
      one to qemu, and one to the RPC client.
      
      * include/libvirt/libvirt.h.in (virDomainOpenGraphicsFD): Drop
      unneeded parameter.
      * src/driver.h (virDrvDomainOpenGraphicsFD): Likewise.
      * src/libvirt.c (virDomainOpenGraphicsFD): Adjust interface to
      return fd directly.
      * daemon/remote.c (remoteDispatchDomainOpenGraphicsFd): Adjust
      semantics.
      * src/qemu/qemu_driver.c (qemuDomainOpenGraphicsFD): Likewise,
      and plug fd leak.
      * src/remote/remote_driver.c (remoteDomainOpenGraphicsFD):
      Likewise, and plug memory and fd leak.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b259e459
    • E
      blockcopy: virDomainBlockCopy with XML destination, typed params · 993fa528
      Eric Blake 提交于
      This commit (finally) adds the virDomainBlockCopy API, with the
      intent that it will provide more power to the existing 'virsh
      blockcopy' command.
      
      'virsh blockcopy' was first added in Apr 2012 (v0.9.12), which
      corresponds to the upstream qemu 1.2 timeframe.  It was done as
      a hack on top of the existing virDomainBlockRebase() API call,
      for two reasons: 1) it was targetting a feature that landed first
      in downstream RHEL qemu, but had not stabilized in upstream qemu
      at the time (and indeed, 'drive-mirror' only landed upstream in
      qemu 1.3 with slight differences to the first RHEL attempt,
      and later gained further parameters like granularity and buf-size
      that are also worth exposing), and 2) extending an existing API
      allowed it to be backported without worrying about bumping .so
      versions.  A virDomainBlockCopy() API was proposed at that time
      [1], but we decided not to accept it into libvirt until after
      upstream qemu stabilized, and it ended up getting scrapped.
      Whether or not RHEL should have attempted adding a new feature
      without getting it upstream first is a debate that can be held
      another day; but enough time has now elapsed that we are ready to
      do the interface cleanly.
      
      [1] https://www.redhat.com/archives/libvir-list/2012-April/msg00768.html
      
      Delaying the creation of a clean API until now has also had a
      benefit: we've only recently learned of a few shortcomings in the
      original design: 1) it is unable to target a network destination
      (such as a gluster volume) because it hard-coded the assumption
      that the destination is a local file name.  Because of all the
      refactoring we've done to add virStorageSourcePtr, we are in a
      better position to declare an API that parses XML describing a
      host storage source as the copy destination, which was not
      possible had we implemented virDomainBlockCopy as it had been
      originally envisioned (although a network target will have to wait
      until a later libvirt release compared to the API addition to
      actually be implemented).  2) the design of using MiB/sec as the
      bandwidth throttle is rather coarse; qemu is actually tuned to
      bytes/second, and libvirt is preventing access to that level of
      detail.  A later patch will add flags to existing block job API
      that can request bytes/second instead of back-compat MiB/s, but as
      this is a new API, we can get it right to begin with.
      
      At least I had the foresight to create 'virsh blockcopy' as a
      separate command at the UI level (commit 1f06c007) rather than
      leaking the underlying API overload of virDomainBlockRebase onto
      shell users.
      
      A further note on the bandwidth option: virTypedParameters
      intentionally lacks unsigned long (since variable-width
      interaction between mixed 32- vs. 64-bit client/server setups is
      nasty), but we have to deal with the fact that we are interacting
      with existing older code that mistakenly chose unsigned long
      bandwidth at a point before we decided to prohibit it in all new
      API.  The typed parameter is therefore unsigned long long, but
      the implementation (in a later patch) will have to do overflow
      detection on 32-bit platforms, as well as capping the value to
      match the LLONG_MAX>>20 cap of the existing MiB/s interfaces.
      
      * include/libvirt/libvirt.h.in (virDomainBlockCopy): New API.
      (virDomainBlockJobType, virConnectDomainEventBlockJobStatus):
      Update related documentation.
      * src/libvirt.c (virDomainBlockCopy): Implement it.
      * src/libvirt_public.syms (LIBVIRT_1.2.8): Export it.
      * src/driver.h (_virDriver): New driver callback.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      993fa528
    • P
      virsh: domain: Split out code to lookup domain from string · 3b20e50d
      Peter Krempa 提交于
      Split out guts of the function to reuse it to get domain objects from
      string.
      3b20e50d
    • P
      lib: Introduce API for retrieving bulk domain stats · 76a5bc4e
      Peter Krempa 提交于
      The motivation for this API is that management layers that use libvirt
      usually poll for statistics using various split up APIs we currently
      provide. To get all the necessary stuff, the app needs to issue a lot of
      calls and aggregate the results.
      
      The APIs I'm introducing here:
      1) Returns data in a format that we can expand in the future and is
      (pseudo) hierarchical. The data is returned as typed parameters where
      the fields are constructed as dot-separated strings containing names and
      other stuff in a list of typed params.
      
      2) Stats for multiple (all) domains can be queried at once and are
      returned in one call. This will decrease the overhead necessary to issue
      multiple calls per domain multiplied by the count of domains.
      
      3) Selectable (bit mask) fields in the returned format. This will allow
      to retrieve only specific stats according to the app's need.
      
      The stats groups will be enabled using a bit field @stats passed as the
      function argument. A few sample stats groups that this API will support:
      
      VIR_DOMAIN_STATS_STATE
      VIR_DOMAIN_STATS_CPU
      VIR_DOMAIN_STATS_BLOCK
      VIR_DOMAIN_STATS_INTERFACE
      
      (Note that this is only an example, the initial implementation supports
       only VIR_DOMAIN_STATS_STATE while others will be added later.)
      
      the returned typed params will use the following scheme
      
      state.state = VIR_DOMAIN_RUNNING
      state.reason = VIR_DOMAIN_RUNNING_BOOTED (the actual values according to
                                                the enum)
      cpu.count = 8
      cpu.0.state = running
      cpu.0.time = 1234
      76a5bc4e
    • J
    • J
      Add RPC implementation for virDomainOpenGraphicsFd · 408aae38
      Ján Tomko 提交于
      408aae38
    • J
      Introduce virDomainOpenGraphicsFD API · 3ddc8544
      Ján Tomko 提交于
      Define the public API implementation and declare internal
      driver prototype.
      3ddc8544
  3. 26 8月, 2014 8 次提交
  4. 25 8月, 2014 6 次提交