1. 27 8月, 2014 6 次提交
    • 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
      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
  2. 26 8月, 2014 5 次提交
  3. 25 8月, 2014 8 次提交
  4. 24 8月, 2014 1 次提交
  5. 23 8月, 2014 3 次提交
    • E
      qemu: check for active domain after agent interaction · 2c551d34
      Eric Blake 提交于
      Commit b606bbb4 reminded me that any time we drop locks to run
      back-to-back guest interaction commands, we have to check that
      the guest didn't disappear in between the two commands.  A quick
      audit found a couple of spots that were missing this check.
      
      * src/qemu/qemu_driver.c (qemuDomainShutdownFlags)
      (qemuDomainSetVcpusFlags): Check that domain is still up.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2c551d34
    • J
      xenconfig: Resolve Coverity RESOURCE_LEAK · c585334b
      John Ferlan 提交于
      Since '337a1362' - Coverity complains that 'net' is VIR_ALLOC()'d, but
      on various 'cleanup' exit paths from the code there is no corresponding
      cleanup.
      c585334b
    • J
      virnetsocket: Resolve Coverity RESOURCE_LEAK · cc1bbbbe
      John Ferlan 提交于
      Since '1b807f92' - Coverity complains that in the error paths of
      both virFork() and virProcessWait() that the 'passfd' will not be closed.
      Added the VIR_FORCE_CLOSE(passfd) and initialized it to -1.
      
      Also noted that variable 'buf' was never really used - so I removed it
      cc1bbbbe
  6. 22 8月, 2014 13 次提交
  7. 21 8月, 2014 3 次提交
    • P
      conf: net: Correctly switch how to format address fields · 4cf1c3fa
      Peter Krempa 提交于
      When formatting the forward mode addresses or interfaces the switch was
      done based on the type of the network rather than of the type of the
      individual <interface>/<address> element. In case a user would specify
      an incorrect network type ("passhtrough") with <address> elements,
      libvirtd would crash as it would attempt to format an <interface>.
      
      Use the type of the individual element to format the XML.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1132347
      4cf1c3fa
    • J
      Perform disk config validity checking for attach-device config · 33188c9f
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1078126
      
      Using 'virsh attach-device --config' (or --persistent) to attach a
      file backed lun device will succeed; however, subsequent domain restarts
      will result in failure because the configuration of a file backed lun
      is not supported.
      
      Although allowing 'illegal configurations' is something that can be
      allowed, it may not be practical in this case. Generally, when attaching
      a device to a domain means the domain must be running. A way around
      this is using the --config (or --persistent) option. When an attach
      is done to a running domain, a temporary configuration is modified
      first followed by the live update. The live update will make a number
      of disk validity checks when building the qemu command to attach the
      disk. If any fail, then change is rejected.
      
      Rather than allow a potentially illegal combination, adjust the code
      in the configuration path to make the same checks as the running path
      will make with respect to disk validity checks. This way we avoid
      having the potential for some subsequent start/reboot to fail because
      an illegal combination was allowed.
      
      NB: The live path still checks the configuration since it is possible
      to just do --live guest modification...
      33188c9f
    • M
      hvsupport: Adapt to vbox driver rewrite · cf389258
      Michal Privoznik 提交于
      Since vbox driver rewrite the virDriver structure init moved from
      vbox_tmpl.c into vbox_common.c. However, our hvsupport.pl script
      doesn't count with that. It still parses vbox_tmp.c and looks for
      virDriver structure which is not found there anymore. As a result,
      at hvsupport page is seems like vbox driver doesn't support
      anything.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cf389258
  8. 20 8月, 2014 1 次提交
    • M
      nodeCapsInitNUMA: Avoid @cpumap leak · f4c87a0c
      Michal Privoznik 提交于
      In case the host has 2 or more NUMA nodes, we fetch CPU map for each
      node. However, we need to free the CPU map in between loops:
      
      ==29513== 96 (72 direct, 24 indirect) bytes in 3 blocks are definitely lost in loss record 951 of 1,264
      ==29513==    at 0x4C2A700: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==29513==    by 0x52AD24B: virAlloc (viralloc.c:144)
      ==29513==    by 0x52AF0E6: virBitmapNew (virbitmap.c:78)
      ==29513==    by 0x52FB720: virNumaGetNodeCPUs (virnuma.c:294)
      ==29513==    by 0x53C700B: nodeCapsInitNUMA (nodeinfo.c:1886)
      ==29513==    by 0x11759708: vboxCapsInit (vbox_common.c:398)
      ==29513==    by 0x11759CC4: vboxConnectOpen (vbox_common.c:514)
      ==29513==    by 0x53C965F: do_open (libvirt.c:1147)
      ==29513==    by 0x53C9EBC: virConnectOpen (libvirt.c:1317)
      ==29513==    by 0x142905: remoteDispatchConnectOpen (remote.c:1215)
      ==29513==    by 0x126ADF: remoteDispatchConnectOpenHelper (remote_dispatch.h:2346)
      ==29513==    by 0x5453D21: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      f4c87a0c