You need to sign in or sign up before continuing.
  1. 15 9月, 2017 1 次提交
  2. 10 7月, 2015 1 次提交
  3. 26 6月, 2015 1 次提交
  4. 26 1月, 2015 1 次提交
    • D
      systemd: fix build without dbus · d13b586a
      Daniel P. Berrange 提交于
      The virDBusMethodCall method has a DBusError as one of its
      parameters. If the caller wants to pass a non-NULL value
      for this, it immediately makes the calling code require
      DBus at build time. This has led to breakage of non-DBus
      builds several times. It is desirable that only the virdbus.c
      file should need WITH_DBUS conditionals, so we must ideally
      remove the DBusError parameter from the method.
      
      We can't simply raise a libvirt error, since the whole point
      of this parameter is to give the callers a way to check if
      the error is one they want to ignore, without having the logs
      polluted with an error message. So, we add a virErrorPtr
      parameter which the caller can then either ignore or raise
      using the new virReportErrorObject method.
      
      This new method is distinct from virSetError in that it
      ensures the logging hooks are run.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d13b586a
  5. 21 5月, 2014 1 次提交
    • C
      virdbus: Remove redundant error macro · aa7fc495
      Cole Robinson 提交于
      This is the only callsite.
      
      We drop use of localerror.name here, because it's not actually useful
      to us: rather than the parameter name which received an invalid value
      (which was assumed), it's actually the the dbus errno equivalent.
      Just use the error string.
      Acked-by: NEric Blake <eblake@redhat.com>
      aa7fc495
  6. 06 5月, 2014 1 次提交
  7. 10 3月, 2014 1 次提交
  8. 06 1月, 2014 1 次提交
    • E
      maint: improve VIR_ERR_OPERATION_DENIED usage · d219826c
      Eric Blake 提交于
      Some of our operation denied messages are outright stupid; for
      example, if virIdentitySetAttr fails:
      
      error: operation Identity attribute is already set forbidden for read only access
      
      This patch fixes things to a saner:
      
      error: operation forbidden: Identity attribute is already set
      
      It also consolidates the most common usage pattern for operation
      denied errors: read-only connections preventing a public API.  In
      this case, 'virsh -r -c test:///default destroy test' changes from:
      
      error: operation virDomainDestroy forbidden for read only access
      
      to:
      
      error: operation forbidden: read only access prevents virDomainDestroy
      
      Note that we were previously inconsistent on which APIs used
      VIR_FROM_DOM (such as virDomainDestroy) vs. VIR_FROM_NONE (such as
      virDomainPMSuspendForDuration).  After this patch, all uses
      consistently use VIR_FROM_NONE, on the grounds that it is unlikely
      that a caller learning that a call is denied can do anything in
      particular with extra knowledge which error domain the call belongs
      to (similar to what we did in commit baa72449).
      
      * src/util/virerror.c (virErrorMsg): Rework OPERATION_DENIED error
      message.
      * src/internal.h (virCheckReadOnlyGoto): New macro.
      * src/util/virerror.h (virReportRestrictedError): New macro.
      * src/libvirt-lxc.c: Use new macros.
      * src/libvirt-qemu.c: Likewise.
      * src/libvirt.c: Likewise.
      * src/locking/lock_daemon.c (virLockDaemonClientNew): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d219826c
  9. 05 1月, 2014 1 次提交
    • E
      maint: improve VIR_ERR_NO_SUPPORT usage · baa72449
      Eric Blake 提交于
      We weren't very consistent in our use of VIR_ERR_NO_SUPPORT; many
      users just passed __FUNCTION__ on, while others passed "%s" to
      silence over-eager compilers that warn about __FUNCTION__ not
      containing any %.  It's nicer to route all these uses through
      a single macro, so that if we ever need to change the reporting,
      we can do it in one place.
      
      I verified that 'virsh -c test:///default qemu-monitor-command test foo'
      gives the same error message before and after this patch:
      error: this function is not supported by the connection driver: virDomainQemuMonitorCommand
      
      Note that in libvirt.c, we were inconsistent on whether virDomain*
      API used virLibConnError() (with VIR_FROM_NONE) or virLibDomainError()
      (with VIR_FROM_DOMAIN); this patch unifies these errors to all use
      VIR_FROM_NONE, on the grounds that it is unlikely that a caller
      learning that a call is unimplemented can do anything in particular
      with extra knowledge of which error domain it belongs to.
      
      One particular change to note is virDomainOpenGraphics which was
      trying to fail with VIR_ERR_NO_SUPPORT after a failed
      VIR_DRV_SUPPORTS_FEATURE check; all other places that fail a
      feature check report VIR_ERR_ARGUMENT_UNSUPPORTED.
      
      * src/util/virerror.h (virReportUnsupportedError): New macro.
      * src/libvirt-qemu.c: Use new macro.
      * src/libvirt-lxc.c: Likewise.
      * src/lxc/lxc_driver.c: Likewise.
      * src/security/security_manager.c: Likewise.
      * src/util/virinitctl.c: Likewise.
      * src/libvirt.c: Likewise.
      (virDomainOpenGraphics): Use correct error for unsupported feature.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      baa72449
  10. 28 12月, 2013 1 次提交
  11. 22 7月, 2013 2 次提交
    • D
      Add helpers for dealing with system errors · f5384eed
      Daniel P. Berrange 提交于
      Add virErrorSetErrnoFromLastError and virLastErrorIsSystemErrno
      to simplify code which wants to handle system errors in a more
      graceful fashion.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f5384eed
    • D
      Introduce virDBusCallMethod & virDBusMessageRead methods · 834c9c94
      Daniel P. Berrange 提交于
      Doing DBus method calls using libdbus.so is tedious in the
      extreme. systemd developers came up with a nice high level
      API for DBus method calls (sd_bus_call_method). While
      systemd doesn't use libdbus.so, their API design can easily
      be ported to libdbus.so.
      
      This patch thus introduces methods virDBusCallMethod &
      virDBusMessageRead, which are based on the code used for
      sd_bus_call_method and sd_bus_message_read. This code in
      systemd is under the LGPLv2+, so we're license compatible.
      
      This code is probably pretty unintelligible unless you are
      familiar with the DBus type system. So I added some API
      docs trying to explain how to use them, as well as test
      cases to validate that I didn't screw up the adaptation
      from the original systemd code.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      834c9c94
  12. 21 12月, 2012 1 次提交
  13. 21 9月, 2012 1 次提交
  14. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  15. 18 7月, 2012 1 次提交
    • D
      Introduce virReportError macro for general error reporting · 7e94acd4
      Daniel P. Berrange 提交于
      Nearly every source file does something like
      
        #define VIR_FROM_THIS VIR_FROM_FOO
        #define virFooReportErorr(code, ...) \
           virReportErrorHelper(VIR_FROM_THIS, code,  __FILE__,    \
                                __FUNCTION__, __LINE__, \
                                __VA_ARGS__)
      
      This creates needless duplication and inconsistent error
      reporting function names in each file. It is trivial to
      just have virterror_internal.h provide a virReportError
      macro that is equivalent
      
      * src/util/virterror_internal.h: Define virReportError(code, ...)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      7e94acd4
  16. 28 5月, 2012 1 次提交
    • D
      Santize the reporting of VIR_ERR_INVALID_ERROR · d91f3ef4
      Daniel P. Berrange 提交于
      To ensure consistent error reporting of invalid arguments,
      provide a number of predefined helper methods & macros.
      
       - An arg which must not be NULL:
      
         virCheckNonNullArgReturn(argname, retvalue)
         virCheckNonNullArgGoto(argname, label)
      
       - An arg which must be NULL
      
         virCheckNullArgGoto(argname, label)
      
       - An arg which must be positive (ie 1 or greater)
      
         virCheckPositiveArgGoto(argname, label)
      
       - An arg which must not be 0
      
         virCheckNonZeroArgGoto(argname, label)
      
       - An arg which must be zero
      
         virCheckZeroArgGoto(argname, label)
      
       - An arg which must not be negative (ie 0 or greater)
      
         virCheckNonNegativeArgGoto(argname, label)
      
      * src/libvirt.c, src/libvirt-qemu.c,
        src/nodeinfo.c, src/datatypes.c: Update to use
        virCheckXXXX macros
      * po/POTFILES.in: Add libvirt-qemu.c and virterror_internal.h
      * src/internal.h: Define macros for checking invalid args
      * src/util/virterror_internal.h: Define macros for reporting
        invalid args
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d91f3ef4
  17. 20 1月, 2012 1 次提交
    • E
      error: drop old-style error reporting · c2551bea
      Eric Blake 提交于
      While we still don't want to enable gcc's new -Wformat-literal
      warning, I found a rather easy case where the warning could be
      reduced, by getting rid of obsolete error-reporting practices.
      This is the last place where we were passing the (unused) net
      and conn arguments for constructing an error.
      
      * src/util/virterror_internal.h (virErrorMsg): Delete prototype.
      (virReportError): Delete macro.
      * src/util/virterror.c (virErrorMsg): Make static.
      * src/libvirt_private.syms (virterror_internal.h): Drop export.
      * src/util/conf.c (virConfError): Convert to macro.
      (virConfErrorHelper): New function, and adjust error calls.
      * src/xen/xen_hypervisor.c (virXenErrorFunc): Delete.
      (xenHypervisorGetSchedulerType)
      (xenHypervisorGetSchedulerParameters)
      (xenHypervisorSetSchedulerParameters)
      (xenHypervisorDomainBlockStats)
      (xenHypervisorDomainInterfaceStats)
      (xenHypervisorDomainGetOSType)
      (xenHypervisorNodeGetCellsFreeMemory, xenHypervisorGetVcpus):
      Update callers.
      c2551bea
  18. 14 7月, 2011 1 次提交
    • E
      build: avoid ATTRIBUTE_UNUSED in headers · 088473b2
      Eric Blake 提交于
      The compiler might optimize based on our declaration that something
      is unused.  Putting that declaration in the header risks getting
      out of sync with the actual implementation, so it belongs better
      only in the .c files.  We were mostly compliant, and a new syntax
      check will help us in the future.
      
      * cfg.mk (sc_avoid_attribute_unused_in_header): New syntax check.
      * src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Delete
      attribute already present in .c file.
      * src/qemu/qemu_domain.h (qemuDomainEventFlush): Likewise.
      * src/util/virterror_internal.h (virReportErrorHelper): Parameters
      are actually used by .c file.
      * src/xenxs/xen_sxpr.h (xenFormatSxprDisk): Adjust prototype.
      * src/xenxs/xen_sxpr.c (xenFormatSxprDisk): Delete unused argument.
      (xenFormatSxpr): Adjust caller.
      * src/xen/xend_internal.c (xenDaemonAttachDeviceFlags)
      (xenDaemonUpdateDeviceFlags): Likewise.
      Suggested by Daniel Veillard.
      088473b2
  19. 17 4月, 2011 1 次提交
  20. 26 1月, 2011 2 次提交
    • D
      Filter out certain expected error messages from libvirtd · b8786c06
      Daniel P. Berrange 提交于
      Add a hook to the error reporting APIs to allow specific
      error messages to be filtered out. Wire up libvirtd to
      remove VIR_ERR_NO_DOMAIN & similar error codes from the
      logs. They are still logged at DEBUG level.
      
      * daemon/libvirtd.c: Filter VIR_ERR_NO_DOMAIN and friends
      * src/libvirt_private.syms, src/util/virterror.c,
        src/util/virterror_internal.h: Hook for changing error
        reporting level
      b8786c06
    • D
      Revert all previous error log priority hacks · dbfca3ff
      Daniel P. Berrange 提交于
      This reverts the additions in commit
      
        abff683f
      
      taking us back to state where all errors are fully logged
      in both libvirtd and normal clients.
      
      THe intent was to stop VIR_ERR_NO_DOMAIN (No such domain
      with UUID XXXX) messages from client apps polluting syslog
      The change affected all error codes, but more seriously,
      it also impacted errors from internal libvirtd infrastructure
      For example guest autostart no longer logged errors. The
      libvirtd network code no longer logged some errors. This
      makes debugging incredibly hard
      
      * daemon/libvirtd.c: Remove error log priority filter
      * src/util/virterror.c, src/util/virterror_internal.h: Remove
        callback for overriding log priority
      dbfca3ff
  21. 30 11月, 2010 1 次提交
    • M
      Log client errors in libvirtd at debug priority · abff683f
      Matthias Bolte 提交于
      This reverts commit
      
       Log all errors at level INFO to stop polluting syslog
       04bd0360.
      
      and makes virRaiseErrorFull() log errors at debug priority
      when called from inside libvirtd. This stops libvirtd from
      polluting it's own log with client errors at error priority
      that'll be reported and logged on the client side anyway.
      abff683f
  22. 10 3月, 2010 1 次提交
  23. 09 2月, 2010 2 次提交
  24. 12 1月, 2010 2 次提交
    • C
      virterror: Add virSetError · fd5eb45b
      Cole Robinson 提交于
      Can be used to re-set an old error, which may have been squashed by
      other functions (like cleanup routines). Will be used in subsequent patches
      fd5eb45b
    • D
      Ensure error handling callback functions are called from safe context · 3a80f2f7
      Daniel P. Berrange 提交于
      The virRaiseErrorFull() may invoke the error handler callback
      functions an application has registered. This is not good
      because the connection object may not be available at this
      point, and the caller may be holding locks. This creates a
      problem if the error handler calls back into libvirt.
      
      The solutuon is to move invocation of the handler into the
      final cleanup code in the public API entry points, where it
      is guarenteed to have safe state.
      
      * src/libvirt.c: Invoke virDispatchError() in all error paths
      * src/util/virterror.c: Remove virSetConnError/virSetGlobalError,
        replacing with virDispatchError(). Move invocation of the
        error callbacks into virDispatchError() instead of the
        virRaiseErrorFull function which is not in a safe context
      3a80f2f7
  25. 21 9月, 2009 1 次提交
    • D
      Move all shared utility files to src/util/ · 1355e055
      Daniel P. Berrange 提交于
      * src/bridge.c, src/bridge.h, src/buf.c, src/buf.h, src/cgroup.c,
        src/cgroup.h, src/conf.c, src/conf.h, src/event.c, src/event.h,
        src/hash.c, src/hash.h, src/hostusb.c, src/hostusb.h,
        src/iptables.c, src/iptables.h, src/logging.c, src/logging.h,
        src/memory.c, src/memory.h, src/pci.c, src/pci.h, src/qparams.c,
        src/qparams.h, src/stats_linux.c, src/stats_linux.h,
        src/threads-pthread.c, src/threads-pthread.h, src/threads-win32.c,
        src/threads-win32.h, src/threads.c, src/threads.h, src/util.c,
        src/util.h, src/uuid.c, src/uuid.h, src/virterror.c,
        src/virterror_internal.h, src/xml.c, src/xml.h: Move all files
        into src/util/
      * daemon/Makefile.am: Add -Isrc/util/ to build flags
      * src/Makefile.am: Add -Isrc/util/ to build flags and update for
        moved files
      * src/libvirt_private.syms: Export cgroup APIs since they're now
        in util rather than linking directly to drivers
      * src/xen/xs_internal.c: Disable bogus virEventRemoveHandle call
        when built under PROXY
      * proxy/Makefile.am: Update for changed file locations. Remove
        bogus build of event.c
      * tools/Makefile.am, tests/Makefile.am: Add -Isrc/util/ to build flags
      1355e055
  26. 23 7月, 2009 1 次提交
    • D
      Fix misc Win32 compile warnings · 899ae0d2
      Daniel P. Berrange 提交于
      GCC >= 4.4 assumes the 'printf' attribute refers to the native
      runtime libraries format specifiers. Thanks to gnulib, libvirt
      has GNU format specifiers everywhere.  This means we need to
      use 'gnu_printf' with GCC >= 4.4 to get correct compiler
      checking of printf format specifiers.
      
      * HACKING: Document new rules for ATTRIBUTE_FMT_PRINTF
      * autobuild.sh, mingw32-libvirt.spec.in: Disable OpenNebula
        driver on mingw32 builds
      * qemud/dispatch.h, qemud/qemu.h, src/buf.h src/internal.h,
        src/logging.h, src/security.h, src/sexpr.h, src/util.h,
        src/virterror_internal.h, src/xend_internal.c: Change
        over to ATTRIBUTE_FMT_PRINTF.
      * src/virsh.c: Disable 'cd' and 'pwd' commands on Win32
        since they don't compile
      * src/threads-win32.c: Add missing return value check
      899ae0d2
  27. 27 5月, 2009 1 次提交
  28. 06 2月, 2009 1 次提交
    • J
      publicize virStrerror · 7bc569dd
      Jim Meyering 提交于
      * src/virterror.c (virStrerror): Remove "static".
      * src/virterror_internal.h (virStrerror): Declare it.
      * src/libvirt_private.syms: Add virStrerror;
      7bc569dd
  29. 21 1月, 2009 1 次提交
  30. 20 1月, 2009 1 次提交
  31. 05 11月, 2008 1 次提交