1. 01 4月, 2018 1 次提交
  2. 03 11月, 2017 1 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      Andrea Bolognani 提交于
      Right-aligning backslashes when defining macros or using complex
      commands in Makefiles looks cute, but as soon as any changes is
      required to the code you end up with either distractingly broken
      alignment or unnecessarily big diffs where most of the changes
      are just pushing all backslashes a few characters to one side.
      
      Generated using
      
        $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
          grep -E '*\.([chx]|am|mk)$$' | \
          while read f; do \
            sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
          done
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3e7db8d3
  3. 13 7月, 2017 2 次提交
    • D
      Revert "Prevent more compiler optimization of mockable functions" · 407a281a
      Daniel P. Berrange 提交于
      This reverts commit e4b980c8.
      
      When a binary links against a .a archive (as opposed to a shared library),
      any symbols which are marked as 'weak' get silently dropped. As a result
      when the binary later runs, those 'weak' functions have an address of
      0x0 and thus crash when run.
      
      This happened with virtlogd and virtlockd because they don't link to
      libvirt.so, but instead just libvirt_util.a and libvirt_rpc.a. The
      virRandomBits symbols was weak and so left out of the virtlogd &
      virtlockd binaries, despite being required by virHashTable functions.
      
      Various other binaries like libvirt_lxc, libvirt_iohelper, etc also
      link directly to .a files instead of libvirt.so, so are potentially
      at risk of dropping symbols leading to a later runtime crash.
      
      This is normal linker behaviour because a weak symbol is not treated
      as undefined, so nothing forces it to be pulled in from the .a You
      have to force the linker to pull in weak symbols using -u$SYMNAME
      which is not a practical approach.
      
      This risk is silent bad linkage that affects runtime behaviour is
      not acceptable for a fix that was merely trying to fix the test
      suite. So stop using __weak__ again.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      407a281a
    • D
      Revert "internal: don't use weak symbols for Win32 platform" · 8ba33d5e
      Daniel P. Berrange 提交于
      This reverts commit b9473d8b.
      8ba33d5e
  4. 11 7月, 2017 6 次提交
    • D
      internal: don't use weak symbols for Win32 platform · b9473d8b
      Daniel P. Berrange 提交于
      The Win32 platform will fail to link if you use weak symbols
      because it is incompatible with exporting symbols in a DLL:
      
      Cannot export virRandomGenerateWWN: symbol wrong type (2 vs 3)
      
      We only need weak symbols for our test suite to do LD_PRELOAD
      and this doesn't work on Win32, so we can just drop the hack
      for Win32
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b9473d8b
    • D
      Prevent more compiler optimization of mockable functions · e4b980c8
      Daniel P. Berrange 提交于
      Currently all mockable functions are annotated with the 'noinline'
      attribute. This is insufficient to guarantee that a function can
      be reliably mocked with an LD_PRELOAD. The C language spec allows
      the compiler to assume there is only a single implementation of
      each function. It can thus do things like propagating constant
      return values into the caller at compile time, or creating
      multiple specialized copies of the function body each optimized
      for a different caller. To prevent these optimizations we must
      also set the 'noclone' and 'weak' attributes.
      
      This fixes the test suite when libvirt.so is built with CLang
      with optimization enabled.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e4b980c8
    • D
      Remove incorrectly used TODO macro · 1dbbcb62
      Daniel P. Berrange 提交于
      The TODO macro expands to an fprintf() call and is used in several
      places in the Xen driver. Anything that wishes to print such debug
      messages should use the logging macros. In this case though, all the
      places in the Xen driver should have been raising a formal libvirt
      error instead. Add proper error handling and delete the TODO macro
      to prevent future misuse.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1dbbcb62
    • D
      Remove network constants out of internal.h · d8f8c7a8
      Daniel P. Berrange 提交于
      The HOST_NAME_MAX, INET_ADDRSTRLEN and VIR_LOOPBACK_IPV4_ADDR
      constants are only used by a handful of files, so are better
      kept in virsocketaddr.h or the source file that uses them.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d8f8c7a8
    • D
      Require use of GCC 4.4 or CLang compilers · 24241c23
      Daniel P. Berrange 提交于
      We only ever test libvirt with GCC or CLang which provides a
      GCC compatible compilation environment. Between them, these
      compilers cover every important operating system platform,
      even Windows.
      
      Mandate their use to make it explicit that we don't care about
      compilers like Microsoft VCC or other UNIX vendor C compilers.
      
      GCC 4.4 was picked as the baseline, since RHEL-6 ships 4.4.7
      and that lets us remove a large set of checks. There is a slight
      issue that CLang reports itself as GCC 4.2, so we must also check
      if __clang__ is defined. We could check a particular CLang version
      too, but that would require someone to figure out a suitable min
      version which is fun because OS-X reports totally different CLang
      version numbers from CLang builds on Linux/BSD
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      24241c23
    • D
      Remove duplicate define of __GNUC_PREREQ · 83b98f19
      Daniel P. Berrange 提交于
      Back in this commit:
      
        commit b436a8ae
        Author: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
        Date:   Thu Jun 9 00:50:35 2016 +0000
      
          gnulib: add getopt module
      
      config-post.h was modified to define __GNUC_PREREQ, but the
      original definition was never removed from internal.h, and
      that is now dead code since config.h is always the first file
      included.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      83b98f19
  5. 23 5月, 2017 1 次提交
  6. 18 5月, 2017 1 次提交
  7. 16 5月, 2017 1 次提交
    • D
      remove hack for debian etch limits.h · 31020664
      Daniel P. Berrange 提交于
      The debian etch distro was end-of-life a long time ago so we no
      longer need the ULLONG_MAX hack. In any case gnulib now provides
      an equivalent fix by default, and so our definition now triggers
      syntax-check rule failure
      
      src/internal.h:#    define ULLONG_MAX   ULONG_LONG_MAX
      maint.mk: define the above via some gnulib .h file
      maint.mk:843: recipe for target 'sc_prohibit_always-defined_macros' failed
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      31020664
  8. 19 4月, 2017 2 次提交
    • D
      Ignore SASL deprecation warnings on OS-X · f7d7825d
      Daniel P. Berrange 提交于
      Apple have annotated all SASL functions as deprecated for
      unknown reasons. Since they still work, lets just ignore
      the warnings. If Apple finally delete the SASL functions
      our configure check should already catch that
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f7d7825d
    • D
      annotate all mocked functions with noinline · 728cacc8
      Daniel P. Berrange 提交于
      CLang's optimizer is more aggressive at inlining functions than
      gcc and so will often inline functions that our tests want to
      mock-override. This causes the test to fail in bizarre ways.
      
      We don't want to disable inlining completely, but we must at
      least prevent inlining of mocked functions. Fortunately there
      is a 'noinline' attribute that lets us control this per function.
      
      A syntax check rule is added that parses tests/*mock.c to extract
      the list of functions that are mocked (restricted to names starting
      with 'vir' prefix). It then checks that src/*.h header file to
      ensure it has a 'ATTRIBUTE_NOINLINE' annotation. This should prevent
      use from bit-rotting in future.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      728cacc8
  9. 23 2月, 2017 1 次提交
    • D
      Add ATTRIBUTE_FALLTHROUGH for switch cases without break · 5d84f596
      Daniel P. Berrange 提交于
      In GCC 7 there is a new warning triggered when a switch
      case has a conditional statement (eg if ... else...) and
      some of the code paths fallthrough to the next switch
      statement. e.g.
      
      conf/domain_conf.c: In function 'virDomainChrEquals':
      conf/domain_conf.c:14926:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
               if (src->targetTypeAttr != tgt->targetTypeAttr)
                  ^
      conf/domain_conf.c:14928:5: note: here
           case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
           ^~~~
      conf/domain_conf.c: In function 'virDomainChrDefFormat':
      conf/domain_conf.c:22143:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
               if (def->targetTypeAttr) {
                  ^
      conf/domain_conf.c:22151:5: note: here
           default:
           ^~~~~~~
      
      GCC introduced a __attribute__((fallthrough)) to let you
      indicate that this is intentionale behaviour rather than
      a bug.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5d84f596
  10. 05 1月, 2017 1 次提交
  11. 05 8月, 2016 1 次提交
  12. 11 4月, 2016 2 次提交
  13. 08 4月, 2016 1 次提交
    • R
      util: move ENODATA redefine to internal.h · edc028d1
      Roman Bogorodskiy 提交于
      FreeBSD lacks ENODATA, and viruuid.c redefines it to EIO, but it's not
      actually using it. On the other hand, we have virrandom.c that's using
      ENODATA. So make this re-definition common by moving it to internal.h,
      so all the current and possible future users don't need to care about
      that.
      edc028d1
  14. 26 6月, 2015 1 次提交
  15. 16 6月, 2015 1 次提交
    • M
      Add libvirt-admin library · 55e0c840
      Martin Kletzander 提交于
      Initial scratch of the admin library.  It has its own virAdmConnectPtr
      that inherits from virAbstractConnectPtr and thus trivially supports
      error reporting.
      
      There's pkg-config file added and spec-file adjusted as well.
      
      Since the library should be "minimalistic" and not depend on any other
      library, the list of files is especially crafted for it.  Most of them
      could've been put to it's own sub-libraries that would be LIBADD'd to
      libvirt_util, libvirt_net_rpc and libvirt_setuid_rpc_client to minimize
      the number of object files being built, but that's a refactoring that
      isn't the orginal aim of this commit.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      55e0c840
  16. 04 5月, 2015 2 次提交
  17. 17 1月, 2015 1 次提交
  18. 15 1月, 2015 1 次提交
  19. 25 11月, 2014 1 次提交
  20. 22 8月, 2014 1 次提交
  21. 24 6月, 2014 1 次提交
    • N
      net-dhcp-leases: Add virsh support · 59cac9a9
      Nehal J Wani 提交于
      Use virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC in virsh.
      
      The new feature supports the follwing methods:
      
      1. Retrieve leases info for a given virtual network
      
      2. Retrieve leases info for given network interface
      
      tools/virsh-domain-monitor.c
         * Introduce new command : net-dhcp-leases
           Example Usage: net-dhcp-leases <network> [mac]
      
         virsh # net-dhcp-leases --network default6
         Expiry Time          MAC address        Protocol  IP address                Hostname        Client ID or DUID
         -------------------------------------------------------------------------------------------------------------------
         2014-06-16 03:40:14  52:54:00:85:90:e2  ipv4      192.168.150.231/24        fedora20-test   01:52:54:00:85:90:e2
         2014-06-16 03:40:17  52:54:00:85:90:e2  ipv6      2001:db8:ca2:2:1::c0/64   fedora20-test   00:04:b1:d8:86:42:e1:6a:aa:cf:d5:86:94:23:6f:94:04:cd
         2014-06-16 03:34:42  52:54:00:e8:73:eb  ipv4      192.168.150.181/24        ubuntu14-vm     -
         2014-06-16 03:34:46  52:54:00:e8:73:eb  ipv6      2001:db8:ca2:2:1::5b/64   -               00:01:00:01:1b:30:c6:aa:52:54:00:e8:73:eb
      
      tools/virsh.pod
         * Document new command
      
      src/internal.h
         * Introduce new macro: EMPTYSTR
      59cac9a9
  22. 19 6月, 2014 1 次提交
    • M
      virnuma: Introduce pages helpers · 35f1095e
      Michal Privoznik 提交于
      For future work we need two functions that fetches total number of
      pages and number of free pages for given NUMA node and page size
      (virNumaGetPageInfo()).
      
      Then we need to learn pages of what sizes are supported on given node
      (virNumaGetPages()).
      
      Note that system page size is disabled at the moment as there's one
      issue connected. If you have a NUMA node with huge pages allocated the
      kernel would return the normal size of memory for that node. It
      basically ignores the fact that huge pages steal size from the system
      memory. Until we resolve this, it's safer to not confuse users and
      hence not report any system pages yet.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      35f1095e
  23. 18 3月, 2014 1 次提交
  24. 04 3月, 2014 1 次提交
    • E
      virFork: give specific status on failure prior to exec · 631923e7
      Eric Blake 提交于
      When a child fails without exec'ing, we want a well-known status;
      best is to match what env(1), nice(1), su(1), and other wrapper
      programs do.  This patch adds enum values that later patches will
      use, and sets up virFork as the first client of EXIT_CANCELED
      for errors detected prior to even attempting exec, as well as
      virExec to distinguish between a missing executable vs. a binary
      that cannot be executed.
      
      This is a slight semantic change in the unlikely case of a child
      process failing to restore its signal mask - we now kill the
      child with a known status instead of relying on the caller to
      notice and do an appropriate _exit().  A subsequent patch will
      make further cleanups based on an audit of all callers.
      
      * src/internal.h (EXIT_CANCELED, EXIT_CANNOT_INVOKE)
      (EXIT_ENOENT): New enum.
      * src/util/vircommand.c (virFork): Document specific exit value if
      child aborts early.
      (virExec): Distinguish between various exec failures.
      * tests/commandtest.c (test1): Enhance test.
      (test22): New test.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      631923e7
  25. 06 2月, 2014 1 次提交
  26. 07 1月, 2014 1 次提交
    • P
      maint: Fix messy include of libvirt_internal.h · aef39eb0
      Peter Krempa 提交于
      The libvirt_internal.h header was included by the internal.h header.
      This made it painful to add new stuff to the header file that would
      require some more specific types. Remove inclusion by internal.h and add
      it to appropriate places manually.
      aef39eb0
  27. 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
  28. 21 5月, 2013 1 次提交
    • E
      maint: use LGPL correctly · d7f53c7b
      Eric Blake 提交于
      Several files called out COPYING or COPYING.LIB instead of using
      the normal boilerplate.  It's especially important that we don't
      call out COPYING from an LGPL file, since COPYING is traditionally
      used for the GPL.  A few files were lacking copyright altogether.
      
      * src/rpc/gendispatch.pl: Add missing copyright.
      * Makefile.nonreentrant: Likewise.
      * src/check-symfile.pl: Likewise.
      * src/check-symsorting.pl: Likewise.
      * src/driver.h: Likewise.
      * src/internal.h: Likewise.
      * tools/libvirt-guests.sh.in: Likewise.
      * tools/virt-pki-validate.in: Mention copyright in comment, not just code.
      * tools/virt-sanlock-cleanup.in: Likewise.
      * src/rpc/genprotocol.pl: Spell out license terms.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * Makefile.am: Likewise.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * docs/schemas/Makefile.am: Likewise.
      * examples/apparmor/Makefile.am: Likewise.
      * examples/domain-events/events-c/Makefile.am: Likewise.
      * examples/dominfo/Makefile.am: Likewise.
      * examples/domsuspend/Makefile.am: Likewise.
      * examples/hellolibvirt/Makefile.am: Likewise.
      * examples/openauth/Makefile.am: Likewise.
      * examples/python/Makefile.am: Likewise.
      * examples/systemtap/Makefile.am: Likewise.
      * examples/xml/nwfilter/Makefile.am: Likewise.
      * gnulib/lib/Makefile.am: Likewise.
      * gnulib/tests/Makefile.am: Likewise.
      * include/Makefile.am: Likewise.
      * include/libvirt/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * python/tests/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      * tools/Makefile.am: Likewise.
      * configure.ac: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d7f53c7b
  29. 15 5月, 2013 1 次提交
  30. 14 5月, 2013 1 次提交
  31. 08 4月, 2013 1 次提交
    • D
      Disable cast-align warnings in various places · e57aaa6f
      Daniel P. Berrange 提交于
      There are a number of places which generate cast alignment
      warnings, which are difficult or impossible to address. Use
      pragmas to disable the warnings in these few places
      
      conf/nwfilter_conf.c: In function 'virNWFilterRuleDetailsParse':
      conf/nwfilter_conf.c:1806:16: warning: cast increases required alignment of target type [-Wcast-align]
               item = (nwItemDesc *)((char *)nwf + att[idx].dataIdx);
      conf/nwfilter_conf.c: In function 'virNWFilterRuleDefDetailsFormat':
      conf/nwfilter_conf.c:3238:16: warning: cast increases required alignment of target type [-Wcast-align]
               item = (nwItemDesc *)((char *)def + att[i].dataIdx);
      
      storage/storage_backend_mpath.c: In function 'virStorageBackendCreateVols':
      storage/storage_backend_mpath.c:247:17: warning: cast increases required alignment of target type [-Wcast-align]
               names = (struct dm_names *)(((char *)names) + next);
      
      nwfilter/nwfilter_dhcpsnoop.c: In function 'virNWFilterSnoopDHCPDecode':
      nwfilter/nwfilter_dhcpsnoop.c:994:15: warning: cast increases required alignment of target type [-Wcast-align]
               pip = (struct iphdr *) pep->eh_data;
      nwfilter/nwfilter_dhcpsnoop.c:1004:11: warning: cast increases required alignment of target type [-Wcast-align]
           pup = (struct udphdr *) ((char *) pip + (pip->ihl << 2));
      
      nwfilter/nwfilter_learnipaddr.c: In function 'procDHCPOpts':
      nwfilter/nwfilter_learnipaddr.c:327:33: warning: cast increases required alignment of target type [-Wcast-align]
                       uint32_t *tmp = (uint32_t *)&dhcpopt->value;
      nwfilter/nwfilter_learnipaddr.c: In function 'learnIPAddressThread':
      nwfilter/nwfilter_learnipaddr.c:501:43: warning: cast increases required alignment of target type [-Wcast-align]
                           struct iphdr *iphdr = (struct iphdr*)(packet +
      nwfilter/nwfilter_learnipaddr.c:538:43: warning: cast increases required alignment of target type [-Wcast-align]
                           struct iphdr *iphdr = (struct iphdr*)(packet +
      nwfilter/nwfilter_learnipaddr.c:544:48: warning: cast increases required alignment of target type [-Wcast-align]
                               struct udphdr *udphdr= (struct udphdr *)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e57aaa6f