1. 28 8月, 2014 1 次提交
  2. 27 8月, 2014 4 次提交
    • 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
      Introduce virDomainOpenGraphicsFD API · 3ddc8544
      Ján Tomko 提交于
      Define the public API implementation and declare internal
      driver prototype.
      3ddc8544
  3. 20 8月, 2014 1 次提交
  4. 04 8月, 2014 1 次提交
    • J
      storage: Refresh storage pool after upload · 4a85bf3e
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1072653
      
      Upon successful upload of a volume, the target volume and storage pool
      were not updated to reflect any changes as a result of the upload. Make
      use of the existing stream close callback mechanism to force a backend
      pool refresh to occur in a separate thread once the stream closes. The
      separate thread should avoid potential deadlocks if the refresh needed
      to wait on some event from the event loop which is used to perform
      the stream callback.
      4a85bf3e
  5. 25 7月, 2014 1 次提交
  6. 14 7月, 2014 1 次提交
  7. 09 7月, 2014 1 次提交
  8. 08 7月, 2014 2 次提交
  9. 03 7月, 2014 1 次提交
  10. 27 6月, 2014 1 次提交
  11. 26 6月, 2014 1 次提交
  12. 24 6月, 2014 2 次提交
    • D
      Change 'interface' to 'iface' in virNetworkDHCPLease · 6512c8b4
      Daniel P. Berrange 提交于
      Variables/fields named 'interface' clash with system
      header symbols on some platforms.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6512c8b4
    • N
      net-dhcp-leases: Implement the public APIs · 03e0e79e
      Nehal J Wani 提交于
      Introduce 3 new APIs, virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
      and virNetworkDHCPLeaseFree.
      
      * virNetworkGetDHCPLeases: returns the dhcp leases information for a given
           virtual network.
      
        For DHCPv4, the information returned:
        - Network Interface Name
        - Expiry Time
        - MAC address
        - IAID (NULL)
        - IPv4 address (with type and prefix)
        - Hostname (can be NULL)
        - Client ID (can be NULL)
      
        For DHCPv6, the information returned:
        - Network Interface Name
        - Expiry Time
        - MAC address
        - IAID (can be NULL, only in rare cases)
        - IPv6 address (with type and prefix)
        - Hostname (can be NULL)
        - Client DUID
      
        Note: @mac, @iaid, @ipaddr, @clientid are in ASCII form, not raw bytes.
        Note: @expirytime can 0, in case the lease is for infinite time.
      
      * virNetworkGetDHCPLeasesForMAC: returns the dhcp leases information for a
           given virtual network and specified MAC Address.
      
      * virNetworkDHCPLeaseFree: allows the upper layer application to free the
           network interface object conveniently.
      
      There is no support for flags, so user is expected to pass 0 for
      both the APIs.
      
      include/libvirt/libvirt.h.in:
        * Define virNetworkGetDHCPLeases
        * Define virNetworkGetDHCPLeasesForMAC
        * Define virNetworkDHCPLeaseFree
      
      src/driver.h:
        * Define networkGetDHCPLeases
        * Define networkGetDHCPLeasesForMAC
      
      src/libvirt.c:
        * Implement virNetworkGetDHCPLeases
        * Implement virNetworkGetDHCPLeasesForMAC
        * Implement virNetworkDHCPLeaseFree
      
      src/libvirt_public.syms:
        * Export the new symbols
      03e0e79e
  13. 19 6月, 2014 1 次提交
    • M
      Introduce virNodeGetFreePages · 34f2d031
      Michal Privoznik 提交于
      The aim of the API is to get information on number of free pages
      on the system. The API behaves similar to the
      virNodeGetCellsFreeMemory(). User passes starting NUMA cell, the
      count of nodes that he's interested in, pages sizes (yes,
      multiple sizes can be queried at once) and the counts are
      returned in an array.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      34f2d031
  14. 11 6月, 2014 1 次提交
    • E
      blockcommit: document semantics of committing active layer · b2980250
      Eric Blake 提交于
      Now that qemu 2.0 allows commit of the active layer, people are
      attempting to use virsh blockcommit and getting into a stuck
      state, because libvirt is unprepared to handle the two-phase
      commit required by qemu.
      
      Stepping back a bit, there are two valid semantics for a
      commit operation:
      
      1. Maintain a 'golden' base, and a transient overlay. Make
      changes in the overlay, and if everything appears to work,
      commit those changes into the base, but still keep the overlay
      for the next round of changes; repeat the cycle as desired.
      
      2. Create an external snapshot, then back up the stable state
      in the backing file. Once the backup is complete, commit the
      overlay back into the base, and delete the temporary snapshot.
      
      Since qemu doesn't know up front which of the two styles is
      preferred, a block commit of the active layer merely gets
      the job into a synchronized state, and sends an event; then
      the user must either cancel (case 1) or complete (case 2),
      where qemu then sends a second event that actually ends the
      job.  However, until commit e6bcbcd3, libvirt was blindly
      assuming the semantics that apply to a commit of an
      intermediate image, where there is only one sane conclusion
      (the job automatically ends with fewer elements in the chain);
      and getting stuck because it wasn't prepared for qemu to enter
      a second phase of the job.
      
      This patch adds a flag to the libvirt API that a user MUST
      supply in order to acknowledge that they will be using two-phase
      semantics.  It might be possible to have a mode where if the
      flag is omitted, we automatically do the case 2 semantics on
      the user's behalf; but before that happens, I must do additional
      patches to track the fact that we are doing an active commit
      in the domain XML.  Later patches will add support of the flag,
      and once 2-phase semantics are working, we can then decide
      whether to relax things to allow an omitted flag to cause an
      automatic pivot.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_COMMIT_ACTIVE)
      (VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT): New enums.
      * src/libvirt.c (virDomainBlockCommit): Document two-phase job
      when committing active layer, through new flag.
      (virDomainBlockJobAbort): Document that pivot also occurs after
      active commit.
      * tools/virsh-domain.c (vshDomainBlockJob): Cover new job.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Explicitly
      reject active copy; later patches will add it in.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b2980250
  15. 28 5月, 2014 1 次提交
  16. 23 5月, 2014 1 次提交
  17. 17 5月, 2014 1 次提交
  18. 15 5月, 2014 1 次提交
    • M
      Introduce virDomain{Get,Set}Time APIs · 0abb3693
      Michal Privoznik 提交于
      These APIs allow users to get or set time in a domain, which may come
      handy if the domain has been resumed just recently and NTP is not
      configured or hasn't kicked in yet and the guest is running
      something time critical. In addition, NTP may refuse to re-set the clock
      if the skew is too big.
      
      In addition, new ACL attribute is introduced 'set_time'.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0abb3693
  19. 07 5月, 2014 1 次提交
  20. 01 5月, 2014 1 次提交
  21. 25 4月, 2014 1 次提交
    • J
      Add support for addressing backing stores by index · f22b7899
      Jiri Denemark 提交于
      Each backing store of a given disk is associated with a unique index
      (which is also formatted in domain XML) for easier addressing of any
      particular backing store. With this patch, any backing store can be
      addressed by its disk target and the index. For example, "vdc[4]"
      addresses the backing store with index equal to 4 of the disk identified
      by "vdc" target. Such shorthand can be used in any API in place for a
      backing file path:
      
          virsh blockcommit domain vda --base vda[3] --top vda[2]
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      f22b7899
  22. 23 4月, 2014 1 次提交
  23. 25 3月, 2014 2 次提交
  24. 21 3月, 2014 1 次提交
    • 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
  25. 18 3月, 2014 2 次提交
  26. 04 3月, 2014 1 次提交
    • E
      util: make it easier to grab only regular command exit · b9dd878f
      Eric Blake 提交于
      Auditing all callers of virCommandRun and virCommandWait that
      passed a non-NULL pointer for exit status turned up some
      interesting observations.  Many callers were merely passing
      a pointer to avoid the overall command dying, but without
      caring what the exit status was - but these callers would
      be better off treating a child death by signal as an abnormal
      exit.  Other callers were actually acting on the status, but
      not all of them remembered to filter by WIFEXITED and convert
      with WEXITSTATUS; depending on the platform, this can result
      in a status being reported as 256 times too big.  And among
      those that correctly parse the output, it gets rather verbose.
      Finally, there were the callers that explicitly checked that
      the status was 0, and gave their own message, but with fewer
      details than what virCommand gives for free.
      
      So the best idea is to move the complexity out of callers and
      into virCommand - by default, we return the actual exit status
      already cleaned through WEXITSTATUS and treat signals as a
      failed command; but the few callers that care can ask for raw
      status and act on it themselves.
      
      * src/util/vircommand.h (virCommandRawStatus): New prototype.
      * src/libvirt_private.syms (util/command.h): Export it.
      * docs/internals/command.html.in: Document it.
      * src/util/vircommand.c (virCommandRawStatus): New function.
      (virCommandWait): Adjust semantics.
      * tests/commandtest.c (test1): Test it.
      * daemon/remote.c (remoteDispatchAuthPolkit): Adjust callers.
      * src/access/viraccessdriverpolkit.c (virAccessDriverPolkitCheck):
      Likewise.
      * src/fdstream.c (virFDStreamCloseInt): Likewise.
      * src/lxc/lxc_process.c (virLXCProcessStart): Likewise.
      * src/qemu/qemu_command.c (qemuCreateInBridgePortWithHelper):
      Likewise.
      * src/xen/xen_driver.c (xenUnifiedXendProbe): Simplify.
      * tests/reconnect.c (mymain): Likewise.
      * tests/statstest.c (mymain): Likewise.
      * src/bhyve/bhyve_process.c (virBhyveProcessStart)
      (virBhyveProcessStop): Don't overwrite virCommand error.
      * src/libvirt.c (virConnectAuthGainPolkit): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainGetBarrierLimit)
      (openvzDomainSetBarrierLimit): Likewise.
      * src/util/virebtables.c (virEbTablesOnceInit): Likewise.
      * src/util/viriptables.c (virIpTablesOnceInit): Likewise.
      * src/util/virnetdevveth.c (virNetDevVethCreate): Fix debug
      message.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Add comment.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSINodeUpdate): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b9dd878f
  27. 20 2月, 2014 1 次提交
  28. 19 2月, 2014 1 次提交
    • R
      bhyve: add a basic driver · 0eb4a5f4
      Roman Bogorodskiy 提交于
      At this point it has a limited functionality and is highly
      experimental. Supported domain operations are:
      
        * define
        * start
        * destroy
        * dumpxml
        * dominfo
      
      It's only possible to have only one disk device and only one
      network, which should be of type bridge.
      0eb4a5f4
  29. 13 2月, 2014 1 次提交
  30. 25 1月, 2014 1 次提交
    • J
      Block info query: Add check for transient domain · 46a0737e
      John Ferlan 提交于
      Currently the qemuDomainGetBlockInfo will return allocation == physical
      for most backing stores. For a qcow2 block backed device it's possible
      to return the highest lv extent allocated from qemu for an active guest.
      That is a value where allocation != physical and one would hope be less.
      However, if the guest is not running, then the code falls back to returning
      allocation == physical. This turns out to be problematic for rhev which
      monitors the size of the backing store. During a migration, before the
      VM has been started on the target and while it is deemed inactive on the
      source, there's a small window of time where the allocation is returned
      as physical triggering the code to extend the file unnecessarily.
      
      Since rhev uses transient domains and this is edge condition for a transient
      domain, rather than returning good status and allocation == physical when
      this "window of opportunity" exists, this patch will check for a transient
      (or non persistent) domain and return a failure to the caller rather than
      returning the defaults. For a persistent domain, the defaults will be
      returned. The description for the virDomainGetBlockInfo has been updated
      to describe the phenomena.
      46a0737e
  31. 23 1月, 2014 1 次提交
    • E
      api: require write permission for guest agent interaction · 7f2d27d1
      Eric Blake 提交于
      I noticed that we allow virDomainGetVcpusFlags even for read-only
      connections, but that with a flag, it can require guest agent
      interaction.  It is feasible that a malicious guest could
      intentionally abuse the replies it sends over the guest agent
      connection to possibly trigger a bug in libvirt's JSON parser,
      or withhold an answer so as to prevent the use of the agent
      in a later command such as a shutdown request.  Although we
      don't know of any such exploits now (and therefore don't mind
      posting this patch publicly without trying to get a CVE assigned),
      it is better to err on the side of caution and explicitly require
      full access to any domain where the API requires guest interaction
      to operate correctly.
      
      I audited all commands that are marked as conditionally using a
      guest agent.  Note that at least virDomainFSTrim is documented
      as needing a guest agent, but that such use is unconditional
      depending on the hypervisor (so the existing domain:fs_trim ACL
      should be sufficient there, rather than also requirng domain:write).
      But when designing future APIs, such as the plans for obtaining
      a domain's IP addresses, we should copy the approach of this patch
      in making interaction with the guest be specified via a flag, and
      use that flag to also require stricter access checks.
      
      * src/libvirt.c (virDomainGetVcpusFlags): Forbid guest interaction
      on read-only connection.
      (virDomainShutdownFlags, virDomainReboot): Improve docs on agent
      interaction.
      * src/remote/remote_protocol.x
      (REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML)
      (REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
      (REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS, REMOTE_PROC_DOMAIN_REBOOT)
      (REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS): Require domain:write for any
      conditional use of a guest agent.
      * src/xen/xen_driver.c: Fix clients.
      * src/libxl/libxl_driver.c: Likewise.
      * src/uml/uml_driver.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7f2d27d1
  32. 20 1月, 2014 1 次提交
  33. 17 1月, 2014 1 次提交