1. 20 10月, 2010 1 次提交
    • D
      Basic framework for auditing integration · 8f680ad3
      Daniel P. Berrange 提交于
      Integrate with libaudit.so for auditing of important operations.
      libvirtd gains a couple of config entries for auditing. By
      default it will enable auditing, if its enabled on the host.
      It can be configured to force exit if auditing is disabled
      on the host. It will can also send audit messages via libvirt
      internal logging API
      
      Places requiring audit reporting can use the VIR_AUDIT
      macro to report data. This is a no-op unless auditing is
      enabled
      
      * autobuild.sh, mingw32-libvirt.spec.in: Disable audit
        on mingw
      * configure.ac: Add check for libaudit
      * daemon/libvirtd.aug, daemon/libvirtd.conf,
        daemon/test_libvirtd.aug, daemon/libvirtd.c: Add config
        options to enable auditing
      * include/libvirt/virterror.h, src/util/virterror.c: Add
        VIR_FROM_AUDIT source
      * libvirt.spec.in: Enable audit
      * src/util/virtaudit.h, src/util/virtaudit.c: Simple internal
        API for auditing messages
      8f680ad3
  2. 19 10月, 2010 1 次提交
    • S
      Introduce VIR_CLOSE to be used rather than close() · f04de501
      Stefan Berger 提交于
      Since bugs due to double-closed file descriptors are difficult to track down in a multi-threaded system, I am introducing the VIR_CLOSE(fd) macro to help avoid mistakes here.
      
      There are lots of places where close() is being used. In this patch I am only cleaning up usage of close() in src/conf where the problems were.
      
      I also dare to declare close() as being deprecated in libvirt code base (HACKING).
      f04de501
  3. 14 9月, 2010 1 次提交
    • E
      build: use portable sed expressions · 249a5b35
      Eric Blake 提交于
      * src/Makefile.am (libvirt.def, libvirt_qemu.def): '\}' and '\t'
      are not required by POSIX.  Use '}' and literal tab instead.
      (install-data-local): Avoid sed -i.
      * tests/read-bufsiz: Likewise.
      Reported by Mitchell Hashimoto.
      249a5b35
  4. 15 8月, 2010 1 次提交
  5. 30 7月, 2010 2 次提交
    • E
      build: distribute libvirt_qemu.syms · 701f356a
      Eric Blake 提交于
      * src/Makefile.am (EXTRA_DIST): Ensure 'make distcheck' and
      'rpmbuild' can reproduce a build.
      * daemon/Makefile.am (DAEMON_SOURCES): Likewise.
      701f356a
    • E
      build: restore operation of bit-rotted 'make cov' · e7064aa6
      Eric Blake 提交于
      './autobuild.sh' with lcov installed discovered that our
      coverage support has been bit-rotting for a while.  This
      restores it back to a successful state, although I have
      not yet spent any time looking through the resulting files to
      look for low-hanging fruit in the unit test coverage front.
      
      * configure.ac: Clear COMPILER_FLAGS at right place.
      * Makefile.am (cov): Newer genhtml no longer likes plain -s.
      * m4/compiler-flags.m4 (gl_COMPILER_FLAGS): Don't AC_SUBST
      COMPILER_FLAGS; it is a shell variable for use in configure only.
      * src/Makefile.am (AM_CFLAGS, AM_LDFLAGS): New variables, to make
      it easier to provide global flag additions.  Use throughout, to
      uniformly apply coverage flags.
      * .gitignore: Globally ignore gcov output.
      * daemon/.gitignore: Simplify.
      * src/.gitignore: Likewise.
      * tests/.gitignore: Likewise.
      e7064aa6
  6. 24 7月, 2010 2 次提交
    • C
      Qemu remote protocol. · 337d201e
      Chris Lalancette 提交于
      Since we are adding a new "per-hypervisor" protocol, we
      make it so that the qemu remote protocol uses a new
      PROTOCOL and PROGRAM number.  This allows us to easily
      distinguish it from the normal REMOTE protocol.
      
      This necessitates changing the proc in remote_message_header
      from a "remote_procedure" to an "unsigned", which should
      be the same size (and thus preserve the on-wire protocol).
      
      Changes since v1:
       - Fixed up a couple of script problems in remote_generate_stubs.pl
       - Switch an int flag to a bool in dispatch.c
      
      Changes since v2:
       - None
      
      Changes since v3:
       - Change unsigned proc to signed proc, to conform to spec
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      337d201e
    • C
      Qemu Monitor API entry point. · 21adf03c
      Chris Lalancette 提交于
      Add the library entry point for the new virDomainQemuMonitorCommand()
      entry point.  Because this is not part of the "normal" libvirt API,
      it gets its own header file, library file, and will eventually
      get its own over-the-wire protocol later in the series.
      
      Changes since v1:
       - Go back to using the virDriver table for qemuDomainMonitorCommand, due to
         linking issues
       - Added versioning information to the libvirt-qemu.so
      
      Changes since v2:
       - None
      
      Changes since v3:
       - Add LGPL header to libvirt-qemu.c
       - Make virLibConnError and virLibDomainError macros instead of function calls
      
      Changes since v4:
       - Move exported symbols to libvirt_qemu.syms
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      21adf03c
  7. 16 7月, 2010 1 次提交
    • D
      RFC: Canonicalize block device paths · ae3275c0
      David Allan 提交于
      There are many naming conventions for partitions associated with a
      block device.  Some of the major ones are:
      
      /dev/foo -> /dev/foo1
      /dev/foo1 -> /dev/foo1p1
      /dev/mapper/foo -> /dev/mapper/foop1
      /dev/disk/by-path/foo -> /dev/disk/by-path/foo-part1
      
      The universe of possible conventions isn't clear.  Rather than trying
      to understand all possible conventions, this patch divides devices
      into two groups, device mapper devices and everything else.  Device
      mapper devices seem always to follow the convention of device ->
      devicep1; everything else is canonicalized.
      ae3275c0
  8. 24 6月, 2010 1 次提交
    • M
      Cleanup some LIBADD and CFLAGS · a73b389d
      Matthias Bolte 提交于
      Move libnl to libvirt_util.la, because macvtap.c requires it.
      
      Add GnuTLS to libvirt_driver.la, because libvirt.c calls gcrypt functions.
      When built without loadable driver modules, then the remote driver pulls
      in GnuTLS.
      
      Move libgnu.la from libvirt_parthelper_CFLAGS to libvirt_parthelper_LDADD.
      a73b389d
  9. 22 6月, 2010 1 次提交
    • S
      nwfilter: fix loadable module support · cab5a52a
      Stefan Berger 提交于
      Following Daniel Berrange's multiple helpful suggestions for improving
      this patch and introducing another driver interface, I now wrote the
      below patch where the nwfilter driver registers the functions to
      instantiate and teardown the nwfilters with a function in
      conf/domain_nwfilter.c called virDomainConfNWFilterRegister. Previous
      helper functions that were called from qemu_driver.c and qemu_conf.c
      were move into conf/domain_nwfilter.h with slight renaming done for
      consistency. Those functions now call the function expored by
      domain_nwfilter.c, which in turn call the functions of the new driver
      interface, if available.
      cab5a52a
  10. 15 6月, 2010 1 次提交
    • E
      parthelper: fix compilation without optimization · 352b6df3
      Eric Blake 提交于
      Daniel's patch works with gcc and CFLAGS containing -O (the
      autoconf default), but fails with non-gcc or with other
      CFLAGS (such as -g), since c-ctype.h declares c_isdigit as
      a macro only for certain compilation settings.
      
      * src/Makefile.am (libvirt_parthelper_LDFLAGS): Add gnulib
      library, for when c_isdigit is not a macro.
      * src/storage/parthelper.c (main): Avoid out-of-bounds
      dereference, noticed by Jim Meyering.
      352b6df3
  11. 27 5月, 2010 1 次提交
  12. 26 5月, 2010 1 次提交
  13. 22 5月, 2010 1 次提交
    • J
      Add simple bitmap operations to utils · 2f32d7af
      Jim Fehlig 提交于
      V2:
        - Move bitmap impl to src/util/bitmap.[ch]
        - Use CHAR_BIT instead of explicit '8'
        - Use size_t instead of unsigned int
        - Fix calculation of bitmap size in virBitmapAlloc
        - Ensure bit is within range of map in the set, clear, and get
          operations
        - Use bool in virBitmapGetBit
        - Add virBitmapFree to free-like funcs in cfg.mk
      
      V3:
        - Check for overflow in virBitmapAlloc
        - Fix copy and paste bug in virBitmapAlloc
        - Use size_t in prototypes
        - Add ATTRIBUTE_NONNULL in prototypes where appropriate
          and remove NULL check from impl
      
      V4:
        - Add ATTRIBUTE_RETURN_CHECK in prototypes where appropriate.
      2f32d7af
  14. 20 5月, 2010 2 次提交
    • E
      docs: distribute more coding convention documentation · 33c721d3
      Eric Blake 提交于
      These files may be useful for anyone making modifications to
      source files in a tarball distribution.
      
      * src/Makefile.am (EXTRA_DIST): Add THREADS.txt.
      * daemon/Makefile.am (EXTRA_DIST): Add THREADING.txt.
      33c721d3
    • J
      tests: the remote_protocol check also accommodates older pdwtags · 10c68162
      Jim Meyering 提交于
      This test was failing on systems using pdwtags from dwarves-1.3.
      Reported by Matthias Bolte.
      Two-pronged fix:
        - use --verbose to work also with dwarves-1.3; adapt regular
          expressions to handle now-varying separators
        - require a minimum number of post-split clauses, in order to
          skip upon any future format change.
          Currently there are 318; if there are 300 or fewer,
          give a warning similar to when pdwtags is missing.
      * src/Makefile.am (remote_protocol-structs): Use pdwtags' --verbose
      option to make 1.3 emit member sizes and offsets.
      Consistently output WARNING messages to stderr.
      10c68162
  15. 18 5月, 2010 1 次提交
    • E
      build: fix cygwin build, correctly this time · b0aaed65
      Eric Blake 提交于
      Fix the cygwin regression introduced in commit 48445ccf, but
      without repeating the fresh build regression of commit
      2d550542.
      
      * src/Makefile.am (libvirt_test_la_LIBADD): Split out subset of
      locally-built libraries...
      (libvirt_test_la_BUILT_LIBADD): ...into new variable.
      (libvirt_test_la_DEPENDENCIES): Depend only on the subset that
      automake would have given us for free if we didn't have to add our
      own extra file.
      b0aaed65
  16. 17 5月, 2010 1 次提交
    • E
      build: fix up some compiler flags · 6e5b5bbc
      Eric Blake 提交于
      Matthias noted that the line:
      virt_aa_helper_LDFLAGS = $(WARN_CFLAGS)
      looks inconsistent, so I did an audit.
      
      Currently, the set of compiler warning flags passed to gcc as $CC are
      equally permitted as the set of linker flags passed to gcc as $LD, so
      there was no problem with that usage.  But if we ever get in a
      situation where $CC and $LD treat particular flags differently, using
      the right variable form will make it easier.
      
      In the process, I spotted a couple of typos that were omitting useful
      flags, as well as specifying a -l under the wrong variable.
      
      * acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Define WARN_LDFLAGS as
      an alias for WARN_CFLAGS.
      * tools/Makefile.am (virsh_LDFLAGS): Use more canonical spelling.
      * proxy/Makefile.am (libvirt_proxy_LDFLAGS): Likewise. Move
      library...
      (libvirt_proxy_LDADD): ...here.
      * src/Makefile.am (virt_aa_helper_LDFLAGS): Use more canonical
      spelling of WARN_LDFLAGS.
      (libvirt_parthelper_LDFLAGS, libvirt_lxc_LDFLAGS): Likewise.  Use
      correct spelling of COVERAGE_LDFLAGS.
      Reported by Matthias Bolte.
      6e5b5bbc
  17. 15 5月, 2010 2 次提交
    • E
      Revert "build: fix cygwin build" · 39b3845f
      Eric Blake 提交于
      This reverts commit 2d550542.
      
      The patch worked for incremental builds, but broke fresh
      builds, because it interfered with automake's automatic
      dependency generation.  Until I figure out how to make
      automake do what we want, I'd rather leave cygwin broken
      but fresh Linux builds working.
      39b3845f
    • E
      build: fix cygwin build · 2d550542
      Eric Blake 提交于
      make[3]: *** No rule to make target `-lxml2', needed by `libvirt.la'.  Stop.
      
      Due to treating the wrong string as a dependency.
      
      * src/Makefile.am (libvirt_la_DEPENDENCIES): Depend only on
      locally-built file, not on strings that might resolve as '-lxml2'.
      2d550542
  18. 11 5月, 2010 2 次提交
    • E
      maint: allow VPATH use of remote_protocol-structs · 3876e010
      Eric Blake 提交于
      * src/Makefile.am (remote_protocol-structs): Ensure file lives in srcdir.
      3876e010
    • E
      maint: avoid spurious output if program not present · 7cdf2663
      Eric Blake 提交于
      Some shells warn about missing programs before redirection;
      the idiomatic way to silence them is to run the program check
      inside a subshell, with the redirections outside the subshell.
      But a subshell is only needed in places where it is reasonable
      to expect the use of such a noisy shell in the first place.
      
      * src/Makefile.am (remote_protocol-structs): Use subshell, for
      FreeBSD 8.0 /bin/sh.
      * cfg.mk (sc_preprocessor_indentation): Avoid subshell, since the
      only users running cfg.mk can be assumed to have decent tools.
      7cdf2663
  19. 08 5月, 2010 4 次提交
    • J
      help avoid accidental remote_protocol.x changes · 180d4b2b
      Jim Meyering 提交于
      Now, if you update remote_protocol.x without also updating
      remote_protocol-structs to match, then "make check" will fail.
      * src/Makefile.am (remote_protocol-structs): Extract list of
      structs and member names from remote_protocol.o.
      (check-local): Depend on it.
      * src/remote_protocol-structs: New file.
      180d4b2b
    • M
      Manually revert "Fix pthread related link error for virt-aa-helper" · cc04c4ca
      Matthias Bolte 提交于
      This reverts commit b5b8a6db.
      
      That commit was not necessary. The problem is fixed by commit
      0e9b3a26, but I didn't rebuild
      it properly after pulling in the commit and didn't notice it.
      cc04c4ca
    • E
      build: use LIBADD, not LDFLAGS, for adding libraries · 48445ccf
      Eric Blake 提交于
      Per automake, LDFLAGS is used early in the line, and LIBADD
      (libraries) or LDADD (programs) is used late.  On platforms like
      cygwin, without lazy linking, this order matters.  Therefore, libtool
      commands, -L, and similar should be in LDFLAGS, but -l should be in
      L*ADD.
      
      * src/Makefile.am (*_LDFLAGS): Move libraries...
      (*_LIBADD): ...to their LIBADD counterpart.
      48445ccf
    • E
      maint: whitespace cleanups · e6125e49
      Eric Blake 提交于
      * src/Makefile.am: Fix some space-tab issues.
      e6125e49
  20. 07 5月, 2010 3 次提交
    • M
      Fix pthread related link error for virt-aa-helper · b5b8a6db
      Matthias Bolte 提交于
      Link virt-aa-helper explicitly with pthread. This is at least
      required on Ubuntu 10.04.
      b5b8a6db
    • J
      avoid link error in tests using libvirt_util; due to pthread_sigmask · 0e9b3a26
      Jim Meyering 提交于
      * src/Makefile.am (libvirt_util_la_LDFLAGS): Add $(LIB_PTHREAD),
      required, now that we're using gnulib's pthread module.
      0e9b3a26
    • E
      build: rely on gnulib's pthread module · 9017b9bc
      Eric Blake 提交于
      Gnulib can guarantee that pthread.h exists, but for now, it is a dummy
      header with no support for most pthread_* functions.  Modify our
      use of pthread to use function checks, rather than header checks,
      to determine how much pthread support is present.
      
      * bootstrap.conf (gnulib_modules): Add pthread.
      * configure.ac: Drop all pthread.h checks.  Optimize function
      checks.  Add check for pthread functions.
      * src/Makefile.am (libvirt_lxc_LDADD): Ensure proper link.
      * src/remote/remote_driver.c (remoteIOEventLoop): Depend on
      pthread_sigmask, now that gnulib guarantees pthread.h.
      * src/util/util.c (virFork): Likewise.
      * src/util/threads.c (threads-pthread.c): Depend on
      pthread_mutexattr_init, as a witness of full pthread support.
      * src/util/threads.h (threads-pthread.h): Likewise.
      9017b9bc
  21. 29 4月, 2010 1 次提交
    • C
      Fix build on Ubuntu. · 50250aba
      Chris Lalancette 提交于
      When building on Ubuntu with make -j3 (or more), it would always
      fail when trying to build virt-aa-helper.  I'm not an expert in
      automake by any means, but I think the entry for virt-aa-helper
      is mis-using LDADD; it shouldn't be putting direct paths to
      libvirt_conf.la and libvirt_util.la, but instead referencing those
      names.  With this patch in place, I'm able to successfully build
      on Ubuntu 9.04 with make -j3.
      Signed-off-by: NChris Lalancette <clalance@redhat.com>
      50250aba
  22. 28 4月, 2010 1 次提交
    • D
      Move dnsmasq host file to a separate directory · 4e041189
      Daniel Veillard 提交于
      use /var/lib/libvirt/dnsmasq since /var/lib/libvirt/network is
      unreadable by the dnsmasq binary
      
      * src/network/bridge_driver.c: update DNSMASQ_STATE_DIR
      * src/Makefile.am: create it on make install
      * libvirt.spec.in: take the new directory into account
      4e041189
  23. 26 4月, 2010 2 次提交
  24. 24 4月, 2010 1 次提交
  25. 16 4月, 2010 1 次提交
  26. 13 4月, 2010 1 次提交
    • S
      Consolidate interface related functions in interface.c · 5174b02f
      Stefan Berger 提交于
      Changes from v1 to v2:
      - changed function name prefixes to 'iface' from previous 'Iface'
      
      - Further to make make syntax-check pass:
       - indentation fix in interface.h
       - added entry to POTFILES.in
      
      I am consolidating network interface related functions used in nwfilter
      and macvtap code in utils/interface.c. All function names are prefixed
      with 'Iface'. The following functions are now available through
      interface.h:
      
      int ifaceCtrl(const char *name, bool up);
      int ifaceUp(const char *name);
      int ifaceDown(const char *name);
      
      int ifaceCheck(bool reportError, const char *ifname,
                     const unsigned char *macaddr, int ifindex);
      
      int ifaceGetIndex(bool reportError, const char *ifname, int *ifindex);
      
      I added 'int ifindex' as parameter to ifaceCheck to the original
      function and modified the code accordingly.
      5174b02f
  27. 09 4月, 2010 1 次提交
  28. 08 4月, 2010 1 次提交
    • S
      nwfilter: Support for learning a VM's IP address · 3bf24abc
      Stefan Berger 提交于
      This patch implements support for learning a VM's IP address. It uses
      the pcap library to listen on the VM's backend network interface (tap)
      or the physical ethernet device (macvtap) and tries to capture packets
      with source or destination MAC address of the VM and learn from DHCP
      Offers, ARP traffic, or first-sent IPv4 packet what the IP address of
      the VM's interface is. This then allows to instantiate the network
      traffic filtering rules without the user having to provide the IP
      parameter somewhere in the filter description or in the interface
      description as a parameter. This only supports to detect the parameter
      IP, which is for the assumed single IPv4 address of a VM. There is not
      support for interfaces that may have multiple  IP addresses (IP
      aliasing) or IPv6 that may then require more than one valid IP address
      to be detected. A VM can have multiple independent interfaces that each
      uses a different IP address and in that case it will be attempted to
      detect each one of the address independently.
      
      So, when for example an interface description in the domain XML has
      looked like this up to now:
      
          <interface type='bridge'>
            <source bridge='mybridge'/>
            <model type='virtio'/>
            <filterref filter='clean-traffic'>
              <parameter name='IP' value='10.2.3.4'/>
            </filterref>
          </interface>
      
      you may omit the IP parameter:
      
          <interface type='bridge'>
            <source bridge='mybridge'/>
            <model type='virtio'/>
            <filterref filter='clean-traffic'/>
          </interface>
      
      Internally I am walking the 'tree' of a VM's referenced network filters
      and determine with the given variables which variables are missing. Now,
      the above IP parameter may be missing and this causes a libvirt-internal
      thread to be started that uses the pcap library's API to listen to the
      backend interface  (in case of macvtap to the physical interface) in an
      attempt to determine the missing IP parameter. If the backend interface
      disappears the thread terminates assuming the VM was brought down. In
      case of a macvtap device a timeout is being used to wait for packets
      from the given VM (filtering by VM's interface MAC address). If the VM's
      macvtap device disappeared the thread also terminates. In all other
      cases it tries to determine the IP address of the VM and will then apply
      the rules late on the given interface, which would have happened
      immediately if the IP parameter had been explicitly given. In case an
      error happens while the firewall rules are applied, the VM's backend
      interface is 'down'ed preventing it to communicate. Reasons for failure
      for applying the network firewall rules may that an ebtables/iptables
      command failes or OOM errors. Essentially the same failure reasons may
      occur as when the firewall rules are applied immediately on VM start,
      except that due to the late application of the filtering rules the VM
      now is already running and cannot be hindered anymore from starting.
      Bringing down the whole VM would probably be considered too drastic.
      While a VM's IP address is attempted to be determined only limited
      updates to network filters are allowed. In particular it is prevented
      that filters are modified in such a way that they would introduce new
      variables.
      
      A caveat: The algorithm does not know which one is the appropriate IP
      address of a VM. If the VM spoofs an IP address in its first ARP traffic
      or IPv4 packets its filtering rules will be instantiated for this IP
      address, thus 'locking' it to the found IP address. So, it's still
      'safer' to explicitly provide the IP address of a VM's interface in the
      filter description if it is known beforehand.
      
      * configure.ac: detect libpcap
      * libvirt.spec.in: require libpcap[-devel] if qemu is built
      * src/internal.h: add the new ATTRIBUTE_PACKED define
      * src/Makefile.am src/libvirt_private.syms: add the new modules and symbols
      * src/nwfilter/nwfilter_learnipaddr.[ch]: new module being added
      * src/nwfilter/nwfilter_driver.c src/conf/nwfilter_conf.[ch]
        src/nwfilter/nwfilter_ebiptables_driver.[ch]
        src/nwfilter/nwfilter_gentech_driver.[ch]: plu the new functionality in
      * tests/nwfilterxml2xmltest: extend testing
      3bf24abc
  29. 01 4月, 2010 1 次提交