1. 16 3月, 2012 2 次提交
  2. 15 3月, 2012 1 次提交
    • D
      Allow overriding default URI in config file · e457d5ef
      Daniel P. Berrange 提交于
      Currently if the URI passed to virConnectOpen* is NULL, then we
      
       - Look for LIBVIRT_DEFAULT_URI env var
       - Probe for drivers
      
      This changes it so that
      
       - Look for LIBVIRT_DEFAULT_URI env var
       - Look for 'uri_default' in $HOME/.libvirt/libvirt.conf
       - Probe for drivers
      e457d5ef
  3. 08 3月, 2012 3 次提交
    • E
      xml: use long long internally, to centralize overflow checks · 73b99771
      Eric Blake 提交于
      On 64-bit platforms, unsigned long and unsigned long long are
      identical, so we don't have to worry about overflow checks.
      On 32-bit platforms, anywhere we narrow unsigned long long back
      to unsigned long, we have to worry about overflow; it's easier
      to do this in one place by having most of the code use the same
      or wider types, and only doing the narrowing at the last minute.
      Therefore, the memory set commands remain unsigned long, and
      the memory get command now centralizes the overflow check into
      libvirt.c, so that drivers don't have to repeat the work.
      
      This also fixes a bug where xen returned the wrong value on
      failure (most APIs return -1 on failure, but getMaxMemory
      must return 0 on failure).
      
      * src/driver.h (virDrvDomainGetMaxMemory): Use long long.
      * src/libvirt.c (virDomainGetMaxMemory): Raise overflow.
      * src/test/test_driver.c (testGetMaxMemory): Fix driver.
      * src/rpc/gendispatch.pl (name_to_ProcName): Likewise.
      * src/xen/xen_hypervisor.c (xenHypervisorGetMaxMemory): Likewise.
      * src/xen/xen_driver.c (xenUnifiedDomainGetMaxMemory): Likewise.
      * src/xen/xend_internal.c (xenDaemonDomainGetMaxMemory):
      Likewise.
      * src/xen/xend_internal.h (xenDaemonDomainGetMaxMemory):
      Likewise.
      * src/xen/xm_internal.c (xenXMDomainGetMaxMemory): Likewise.
      * src/xen/xm_internal.h (xenXMDomainGetMaxMemory): Likewise.
      * src/xen/xs_internal.c (xenStoreDomainGetMaxMemory): Likewise.
      * src/xen/xs_internal.h (xenStoreDomainGetMaxMemory): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainGetMaxMemory):
      Likewise.
      * src/esx/esx_driver.c (esxDomainGetMaxMemory): Likewise.
      * src/libxl/libxl_driver.c (libxlDomainGetMaxMemory): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainGetMaxMemory): Likewise.
      * src/lxc/lxc_driver.c (lxcDomainGetMaxMemory): Likewise.
      * src/uml/uml_driver.c (umlDomainGetMaxMemory): Likewise.
      73b99771
    • E
      api: add overflow error · 239fb8c4
      Eric Blake 提交于
      Overflow can be user-induced, so it deserves more than being called
      an internal error.  Note that in general, 32-bit platforms have
      far more places to trigger this error (anywhere the public API
      used 'unsigned long' but the other side of the connection is a
      64-bit server); but some are possible on 64-bit platforms (where
      the public API computes the product of two numbers).
      
      * include/libvirt/virterror.h (VIR_ERR_OVERFLOW): New error.
      * src/util/virterror.c (virErrorMsg): Translate it.
      * src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpuPinInfo)
      (virDomainGetVcpus, virDomainGetCPUStats): Use it.
      * daemon/remote.c (HYPER_TO_TYPE): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockResize): Likewise.
      239fb8c4
    • E
      docs: use correct terminology for 1024 bytes · 9dfdeadc
      Eric Blake 提交于
      Yes, I like kilobytes better than kibibytes (when I say kilobytes,
      I generally mean 1024).  But since the term is ambiguous, it can't
      hurt to say what we mean, by using both the correct name and
      calling out the numeric equivalent.
      
      * src/libvirt.c (virDomainGetMaxMemory, virDomainSetMaxMemory)
      (virDomainSetMemory, virDomainSetMemoryFlags)
      (virNodeGetFreeMemory): Tweak wording.
      * docs/formatdomain.html.in: Likewise.
      * docs/formatstorage.html.in: Likewise.
      9dfdeadc
  4. 07 3月, 2012 1 次提交
    • E
      rpc: allow truncated return for virDomainGetCPUStats · 462dc569
      Eric Blake 提交于
      The RPC code assumed that the array returned by the driver would be
      fully populated; that is, ncpus on entry resulted in ncpus * return
      value on exit.  However, while we don't support holes in the middle
      of ncpus, we do want to permit the case of ncpus on entry being
      longer than the array returned by the driver (that is, it should be
      safe for the caller to pass ncpus=128 on entry, and the driver will
      stop populating the array when it hits max_id).
      
      Additionally, a successful return implies that the caller will then
      use virTypedParamArrayClear on the entire array; for this to not
      free uninitialized memory, the driver must ensure that all skipped
      entries are explicitly zeroed (the RPC driver did this, but not
      the qemu driver).
      
      There are now three cases:
      server 0.9.10 and client 0.9.10 or newer: No impact - there were no
      hypervisor drivers that supported cpu stats
      
      server 0.9.11 or newer and client 0.9.10: if the client calls with
      ncpus beyond the max, then the rpc call will fail on the client side
      and disconnect the client, but the server is no worse for the wear
      
      server 0.9.11 or newer and client 0.9.11: the server can return a
      truncated array and the client will do just fine
      
      I reproduced the problem by using a host with 2 CPUs, and doing:
      virsh cpu-stats $dom --start 1 --count 2
      
      * daemon/remote.c (remoteDispatchDomainGetCPUStats): Allow driver
      to omit tail of array.
      * src/remote/remote_driver.c (remoteDomainGetCPUStats):
      Accommodate driver that omits tail of array.
      * src/libvirt.c (virDomainGetCPUStats): Document this.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Clear all
      unpopulated entries.
      462dc569
  5. 06 3月, 2012 1 次提交
    • E
      blockResize: add flag for bytes · 877fd769
      Eric Blake 提交于
      Qemu supports sizing by bytes; we shouldn't force the user to
      round up if they really wanted an unaligned total size.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_RESIZE_BYTES):
      New flag.
      * src/libvirt.c (virDomainBlockResize): Document it.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockResize): Take
      size in bytes.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextBlockResize):
      Likewise.  Pass bytes, not megabytes, to monitor.
      * src/qemu/qemu_driver.c (qemuDomainBlockResize): Implement new
      flag.
      877fd769
  6. 27 2月, 2012 2 次提交
    • P
      Add flags for virDomainOpenConsole · a1801023
      Peter Krempa 提交于
      This patch adds a set of flags to be used with the virDomainOpenConsole
      API call to specify if the user wishes to interrupt an existing console
      session or just to try open a new one.
      
      VIR_DOMAIN_CONSOLE_SAFE - specifies that the console connection should
                                be opened only if the hypervisor supports
                                mutually exclusive access to console devices
      
      VIR_DOMAIN_CONSOLE_FORCE - specifies that the caller wishes to interrupt
                                 existing session and force a creation of a
                                 new one.
      a1801023
    • M
      Introduce virDomainPMWakeup API · e2822f19
      Michal Privoznik 提交于
      This API allows a domain which previously called
      virDomainPMSuspendForDuration() to be woken up.
      e2822f19
  7. 25 2月, 2012 1 次提交
    • M
      Fixed URI parsing · 9f748277
      Martin Kletzander 提交于
      Function xmlParseURI does not remove square brackets around IPv6
      address when parsing. One of the solutions is making wrappers around
      functions working with xmlURI*. This assures that uri->server will be
      always properly assigned and it doesn't have to be changed when used
      on some new place in the code.
      For this purpose, functions virParseURI and virSaveURI were
      added. These function are wrappers around xmlParseURI and xmlSaveUri
      respectively.
      Also there is one new syntax check function to prohibit these functions
      anywhere else.
      
      File changes:
       - src/util/viruri.h        -- declaration
       - src/util/viruri.c        -- definition
       - src/libvirt_private.syms -- symbol export
       - src/Makefile.am          -- added source and header files
       - cfg.mk                   -- added sc_prohibit_xmlURI
       - all others               -- ID name and include fixes
      9f748277
  8. 22 2月, 2012 2 次提交
    • J
      Add support for unsafe migration · 7808844d
      Jiri Denemark 提交于
      This patch adds VIR_MIGRATE_UNSAFE flag for migration APIs and new
      VIR_ERR_MIGRATION_UNSAFE error code.  The error code should be returned
      whenever migrating a domain is considered unsafe (e.g., it's configured
      in a way that does not ensure data integrity once it is migrated).
      VIR_MIGRATE_UNSAFE flag may be used to force migration even though it
      would normally be considered unsafe and forbidden.
      7808844d
    • P
      lib: Fix function documentation for virConnectListDomains · 616a6f0e
      Peter Krempa 提交于
      Clarify the documentation of virConnectListDomains.
      616a6f0e
  9. 10 2月, 2012 1 次提交
  10. 04 2月, 2012 2 次提交
    • L
      qemu: new GRACEFUL flag for virDomainDestroy w/ QEMU support · 72f8a7f1
      Laine Stump 提交于
      When libvirt's virDomainDestroy API is shutting down the qemu process,
      it first sends SIGTERM, then waits for 1.6 seconds and, if it sees the
      process still there, sends a SIGKILL.
      
      There have been reports that this behavior can lead to data loss
      because the guest running in qemu doesn't have time to flush its disk
      cache buffers before it's unceremoniously whacked.
      
      This patch maintains that default behavior, but provides a new flag
      VIR_DOMAIN_DESTROY_GRACEFUL to alter the behavior. If this flag is set
      in the call to virDomainDestroyFlags, SIGKILL will never be sent to
      the qemu process; instead, if the timeout is reached and the qemu
      process still exists, virDomainDestroy will return an error.
      
      Once this patch is in, the recommended method for applications to call
      virDomainDestroyFlags will be with VIR_DOMAIN_DESTROY_GRACEFUL
      included. If that fails, then the application can decide if and when
      to call virDomainDestroyFlags again without
      VIR_DOMAIN_DESTROY_GRACEFUL (to force the issue with SIGKILL).
      
      (Note that this does not address the issue of existing applications
      that have not yet been modified to use VIR_DOMAIN_DESTROY_GRACEFUL.
      That is a separate patch.)
      72f8a7f1
    • P
      virterror.c: Fix several spelling mistakes · 99d24ab2
      Philipp Hahn 提交于
      compat{a->i}bility
      erron{->e}ous
      nec{c->}essary.
      Either "the" or "a".
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      99d24ab2
  11. 03 2月, 2012 1 次提交
  12. 02 2月, 2012 2 次提交
    • E
      block rebase: add new API virDomainBlockRebase · 99fd69c3
      Eric Blake 提交于
      Qemu is adding the ability to do a partial rebase.  That is, given:
      
      base <- intermediate <- current
      
      virDomainBlockPull will produce:
      
      current
      
      but qemu now has the ability to leave base in the chain, to produce:
      
      base <- current
      
      Note that current qemu can only do a forward merge, and only with
      the current image as the destination, which is fully described by
      this API without flags.  But in the future, it may be possible to
      enhance this API for additional scenarios by using flags:
      
      Merging the current image back into a previous image (that is,
      undoing a live snapshot), could be done by passing base as the
      destination and flags with a bit requesting a backward merge.
      
      Merging any other part of the image chain, whether forwards (the
      backing image contents are pulled into the newer file) or backwards
      (the deltas recorded in the newer file are merged back into the
      backing file), could also be done by passing a new flag that says
      that base should be treated as an XML snippet rather than an
      absolute path name, where the XML could then supply the additional
      instructions of which part of the image chain is being merged into
      any other part.
      
      * include/libvirt/libvirt.h.in (virDomainBlockRebase): New
      declaration.
      * src/libvirt.c (virDomainBlockRebase): Implement it.
      * src/libvirt_public.syms (LIBVIRT_0.9.10): Export it.
      * src/driver.h (virDrvDomainBlockRebase): New driver callback.
      * src/rpc/gendispatch.pl (long_legacy): Add exemption.
      * docs/apibuild.py (long_legacy_functions): Likewise.
      99fd69c3
    • P
      API: Add api to set and get domain metadata · c471e55e
      Peter Krempa 提交于
      This patch adds API to modify domain metadata for running and stopped
      domains. The api supports changing description, title as well as the
      newly added <metadata> element. The API has support for storing data in
      the metadata element using xml namespaces.
      
      * include/libvirt/libvirt.h.in
      * src/libvirt_public.syms
              - add function headers
              - add enum to select metadata to operate on
              - export functions
      * src/libvirt.c
              - add public api implementation
      * src/driver.h
              - add driver support
      * src/remote/remote_driver.c
      * src/remote/remote_protocol.x
              - wire up the remote protocol
      * include/libvirt/virterror.h
      * src/util/virterror.c
              - add a new error message note that metadata for domain are
              missing
      c471e55e
  13. 01 2月, 2012 3 次提交
    • J
      virDomainGetDiskErrors public API · 02af3e13
      Jiri Denemark 提交于
      We already provide ways to detect when a domain has been paused as a
      result of I/O error, but there was no way of getting the exact error or
      even the device that experienced it.  This new API may be used for both.
      02af3e13
    • M
      qemu: Clenup qemuDomainSetInterfaceParameters · 50e9b389
      Michal Privoznik 提交于
      which contained some useless lines, copied code, NULL
      dereference.
      50e9b389
    • E
      resize: slightly alter signature · 055bbf45
      Eric Blake 提交于
      Our existing virDomainBlockResize takes an unsigned long long
      argument; if that command is later taught a DELTA and SHRINK flag,
      we cannot change its type without breaking API (but at least such
      a change would be ABI compatible).  Meanwhile, the only time a
      negative size makes sense is if both DELTA and SHRINK are used
      together, but if we keep the argument unsigned, applications can
      pass the positive delta amount by which they would like to shrink
      the system, and have the flags imply the negative value.  So,
      since this API has not yet been released, and in the interest of
      consistency with existing API, we swap virStorageVolResize to
      always pass an unsigned value.
      
      * include/libvirt/libvirt.h.in (virStorageVolResize): Use unsigned
      argument.
      * src/libvirt.c (virStorageVolResize): Likewise.
      * src/driver.h (virDrvStorageVolUpload): Adjust clients.
      * src/remote/remote_protocol.x (remote_storage_vol_resize_args):
      Likewise.
      * src/remote_protocol-structs: Regenerate.
      Suggested by Daniel P. Berrange.
      055bbf45
  14. 29 1月, 2012 1 次提交
  15. 28 1月, 2012 4 次提交
    • E
      docs: tweak recent suspend API additions · f0b22ebe
      Eric Blake 提交于
      * src/libvirt.c (virDomainPMSuspendForDuration): Clarify usage.
      f0b22ebe
    • K
      Add new public API virDomainGetCPUStats() · e1eea747
      KAMEZAWA Hiroyuki 提交于
      add new API virDomainGetCPUStats() for getting cpu accounting information
      per real cpus which is used by a domain.  The API is designed to allow
      future extensions for additional statistics.
      
      based on ideas by Lai Jiangshan and Eric Blake.
      
      * src/libvirt_public.syms: add API for LIBVIRT_0.9.10
      * src/libvirt.c: define virDomainGetCPUStats()
      * include/libvirt/libvirt.h.in: add virDomainGetCPUStats() header
      * src/driver.h: add driver API
      * python/generator.py: add python API (as not implemented)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e1eea747
    • M
      Introduce virDomainPMSuspendForDuration API · 8f8b0802
      Michal Privoznik 提交于
      This API allows a domain to be put into one of S# ACPI states.
      Currently, S3 and S4 are supported. These states are shared
      with virNodeSuspendForDuration.
      However, for now we don't support any duration other than zero.
      The same apply for flags.
      8f8b0802
    • Z
      resize: add virStorageVolResize() API · 6714fd04
      Zeeshan Ali (Khattak) 提交于
      Add a new function to allow changing of capacity of storage volumes.
      Plan out several flags, even if not all of them will be implemented
      up front.
      
      Expose the new command via 'virsh vol-resize'.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6714fd04
  16. 26 1月, 2012 2 次提交
    • D
      Introduce new API for generating random numbers · e95ef67b
      Daniel P. Berrange 提交于
      The old virRandom() API was not generating good random numbers.
      Replace it with a new API virRandomBits which instead of being
      told the upper limit, gets told the number of bits of randomness
      required.
      
      * src/util/virrandom.c, src/util/virrandom.h: Add virRandomBits,
        and move virRandomInitialize
      * src/util/util.h, src/util/util.c: Delete virRandom and
        virRandomInitialize
      * src/libvirt.c, src/security/security_selinux.c,
        src/test/test_driver.c, src/util/iohelper.c: Update for
        changes from virRandom to virRandomBits
      * src/storage/storage_backend_iscsi.c: Remove bogus call
        to virRandomInitialize & convert to virRandomBits
      e95ef67b
    • M
      storage: Support different wiping algorithms · adb99a05
      Michal Privoznik 提交于
      Currently, we support only filling a volume with zeroes on wiping.
      However, it is not enough as data might still be readable by
      experienced and equipped attacker. Many technical papers have been
      written, therefore we should support other wiping algorithms.
      adb99a05
  17. 25 1月, 2012 1 次提交
  18. 24 1月, 2012 1 次提交
    • D
      Add new virDomainShutdownFlags API · 0b7ddf9e
      Daniel P. Berrange 提交于
      Add a new API virDomainShutdownFlags and define:
      
          VIR_DOMAIN_SHUTDOWN_DEFAULT        = 0,
          VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = (1 << 0),
          VIR_DOMAIN_SHUTDOWN_GUEST_AGENT    = (1 << 1),
      
      Also define some flags for the reboot API
      
          VIR_DOMAIN_REBOOT_DEFAULT        = 0,
          VIR_DOMAIN_REBOOT_ACPI_POWER_BTN = (1 << 0),
          VIR_DOMAIN_REBOOT_GUEST_AGENT    = (1 << 1),
      
      Although these two APIs currently have the same flags, using
      separate enums allows them to expand separately in the future.
      
      Add stub impls of the new API for all existing drivers
      0b7ddf9e
  19. 17 1月, 2012 1 次提交
    • J
      Clarify semantics of virDomainMigrate{,ToURI}2 · 5e31e713
      Jiri Denemark 提交于
      Commit 5d784bd6 was a nice attempt to
      clarify the semantics by requiring domain name from dxml to either match
      original name or dname. However, setting dxml domain name to dname
      doesn't really work since destination host needs to know the original
      domain name to be able to use it in migration cookies. This patch
      requires domain name in dxml to match the original domain name. The
      change should be safe and backward compatible since migration would fail
      just a bit later in the process.
      5e31e713
  20. 12 1月, 2012 1 次提交
  21. 11 1月, 2012 2 次提交
    • E
      snapshot: allow reuse of existing files in disk snapshot · 4e9953a4
      Eric Blake 提交于
      When disk snapshots were first implemented, libvirt blindly refused
      to allow an external snapshot destination that already exists, since
      qemu will blindly overwrite the contents of that file during the
      snapshot_blkdev monitor command, and we don't like a default of
      data loss by default.  But VDSM has a scenario where NFS permissions
      are intentionally set so that the destination file can only be
      created by the management machine, and not the machine where the
      guest is running, so that libvirt will necessarily see the destination
      file already existing; adding a flag will allow VDSM to force the file
      reuse without libvirt complaining of possible data loss.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=767104
      
      * include/libvirt/libvirt.h.in (virDomainSnapshotCreateFlags): Add
      VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT.
      * src/libvirt.c (virDomainSnapshotCreateXML): Document it.  Add
      note about partial failure.
      * tools/virsh.c (cmdSnapshotCreate, cmdSnapshotCreateAs): Add new
      flag.
      * tools/virsh.pod (snapshot-create, snapshot-create-as): Document
      it.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare)
      (qemuDomainSnapshotCreateXML): Implement the new flag.
      4e9953a4
    • E
      docs: standardize description of flags · 529e4a50
      Eric Blake 提交于
      We had loads of different styles in describing the @flags parameter
      for various APIs, as well as several APIs that didn't list which
      enums provided the bit values valid for the flags.
      
      The end result is one of two formats:
      @flags: bitwise-OR of vir...Flags
      @flags: extra flags; not used yet, so callers should always pass 0
      
      * src/libvirt.c: Use common sentences for flags.  Also,
      (virDomainGetBlockIoTune): Mention virTypedParameterFlags.
      (virConnectOpenAuth): Mention virConnectFlags.
      (virDomainMigrate, virDomainMigrate2, virDomainMigrateToURI)
      (virDomainMigrateToURI2): Mention virDomainMigrateFlags.
      (virDomainMemoryPeek): Mention virDomainMemoryFlags.
      (virStoragePoolBuild): Mention virStoragePoolBuildFlags.
      (virStoragePoolDelete): Mention virStoragePoolDeleteFlags.
      (virStreamNew): Mention virStreamFlags.
      (virDomainOpenGraphics): Mention virDomainOpenGraphicsFlags.
      529e4a50
  22. 10 1月, 2012 1 次提交
    • J
      PolicyKit: Check auth before asking client to obtain it · 9ae4ac7a
      Jim Fehlig 提交于
      I previously mentioned [1] a PolicyKit issue where libvirt would
      proceed with authentication even though polkit-auth failed:
      
      testusr xen134:~> virsh list --all
      Attempting to obtain authorization for org.libvirt.unix.manage.
      polkit-grant-helper: given auth type (8 -> yes) is bogus
      Failed to obtain authorization for org.libvirt.unix.manage.
       Id Name                 State
      ----------------------------------
        0 Domain-0             running
        - sles11sp1-pv         shut off
      
      AFAICT, libvirt attempts to obtain a privilege it already has,
      causing polkit-auth to fail with above message.  Instead of calling
      obtain and then checking auth, IMO the workflow should be for the
      server to check auth first, and if that fails ask the client to
      obtain it and check again.  This workflow also allows for checking
      only successful exit of polkit-auth in virConnectAuthGainPolkit().
      
      [1] https://www.redhat.com/archives/libvir-list/2011-December/msg00837.html
      9ae4ac7a
  23. 04 1月, 2012 1 次提交
  24. 03 1月, 2012 1 次提交
    • E
      domiftune: clean up previous patches · 269ce467
      Eric Blake 提交于
      Most severe here is a latent (but currently untriggered) memory leak
      if any hypervisor ever adds a string interface property; the
      remainder are mainly cosmetic.
      
      * include/libvirt/libvirt.h.in (VIR_DOMAIN_BANDWIDTH_*): Move
      macros closer to interface that uses them, and document type.
      * src/libvirt.c (virDomainSetInterfaceParameters)
      (virDomainGetInterfaceParameters): Formatting tweaks.
      * daemon/remote.c (remoteDispatchDomainGetInterfaceParameters):
      Avoid memory leak.
      * src/libvirt_public.syms (LIBVIRT_0.9.9): Sort lines.
      * src/libvirt_private.syms (domain_conf.h): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSetInterfaceParameters): Fix
      comments, break long lines.
      269ce467
  25. 29 12月, 2011 1 次提交
  26. 21 12月, 2011 1 次提交