1. 31 5月, 2012 4 次提交
    • E
      command: avoid double close bugs · da831afc
      Eric Blake 提交于
      KAMEZAWA Hiroyuki reported a nasty double-free bug when virCommand
      is used to convert a string into input to a child command.  The
      problem is that the poll() loop of virCommandProcessIO would close()
      the write end of the pipe in order to let the child see EOF, then
      the caller virCommandRun() would also close the same fd number, with
      the second close possibly nuking an fd opened by some other thread
      in the meantime.  This in turn can have all sorts of bad effects.
      
      The bug has been present since the introduction of virCommand in
      commit f16ad06f.
      
      This is based on his first attempt at a patch, at
      https://bugzilla.redhat.com/show_bug.cgi?id=823716
      
      * src/util/command.c (_virCommand): Drop inpipe member.
      (virCommandProcessIO): Add argument, to avoid closing caller's fd
      without informing caller.
      (virCommandRun, virCommandNewArgs): Adjust clients.
      da831afc
    • W
      avoid fd leak · 655cffa0
      Wen Congyang 提交于
      virCommandRunAsync() will set errfd if it succeed. We should
      close it if virFDStreamOpenInternal() fails.
      655cffa0
    • W
      avoid closing uninitialized fd · 0a045f01
      Wen Congyang 提交于
      If the system does not support bypass cache, we will close fd,
      but it is uninitialized.
      0a045f01
    • M
      Fixes for check and rpm builds without sanlock (and qemu) · 730cc8d7
      Martin Kletzander 提交于
      Apart from the non-sanlock check build, there is also a little fix for
      qemu (EXTRA_DIST had qemu.conf and others inside even if the build was
      supposed to be without qemu).
      730cc8d7
  2. 30 5月, 2012 11 次提交
    • W
      build: include augeas-gentest.pl into dist file · 23292f73
      Wen Congyang 提交于
      We generate *.aug from *.aug.in by augeas-gentest.pl, so this script
      should be included in dist file.
      23292f73
    • E
      build: use same perl binary throughout build · 13af87f2
      Eric Blake 提交于
      Some of our rules used $(PERL), while others used 'perl'.  Always
      using the variable allows a developer to point to a different (often
      better) perl than the default one found on $PATH.
      
      * daemon/Makefile.am ($(srcdir)/remote_dispatch.h): s/perl/$(PERL).
      * src/Makefile.am ($(srcdir)/remote/remote_client_bodies.h)
      (PDWTAGS, %protocol.c, %_probes.stp): Likewise.
      13af87f2
    • E
      build: fix testing of augeas files in VPATH builds · fb59cf7a
      Eric Blake 提交于
      Without this fix, a VPATH build (such as used by ./autobuild.sh)
      fails with messages like:
      
      make[3]: Entering directory `/home/remote/eblake/libvirt-tmp2/build/daemon'
      ../../build-aux/augeas-gentest.pl libvirtd.conf ../../daemon/test_libvirtd.aug.in test_libvirtd.aug
      cannot read libvirtd.conf: No such file or directory at ../../build-aux/augeas-gentest.pl line 38.
      
      Since the test files are not part of the tarball, we can generate
      them into the build dir, but rather than create a subdirectory
      just for the test file, it is easier to test them directly in
      libvirt.git/src.
      
      * daemon/Makefile.am (AUG_GENTEST): Factor out definition.
      (test_libvirtd.aug): Look for correct file.
      * src/Makefile.am (AUG_GENTEST): Use $(PERL).
      (qemu/test_libvirtd_qemu.aug, lxc/test_libvirtd_lxc.aug)
      (locking/test_libvirt_sanlock.aug): Rename to avoid subdirectories.
      (check-augeas-qemu, check-augeas-lxc, check-augeas-sanlock): Reflect
      location of built tests.
      * configure.ac (PERL): Substitute perl.
      fb59cf7a
    • E
      build: silence warning from autoconf · aabf77aa
      Eric Blake 提交于
      Autoconf 2.60 and later insist on using ${datarootdir}, rather than
      the derived ${datadir} (although the latter defaults to the former,
      it is possible to set configure arguments so that they differ):
      
      config.status: creating libvirt.pc
      config.status: WARNING:  'libvirt.pc.in' seems to ignore the --datarootdir setting
      
      This patch follows the autoconf manual's suggestions for how to
      support 2.59 (RHEL 5) and newer simultaneously.
      
      * libvirt.pc.in (datarootdir): Define, so ${datadir} will not ignore
      datarootdir when using newer autoconf.
      aabf77aa
    • M
      virCommand: Extend debug message for handshake · 7454849e
      Michal Privoznik 提交于
      Currently, we are logging only one side of pipes we
      create in virCommandRequireHandshake(); This is enough
      in cases where pipe2() returns two consecutive FDs. However,
      it is not guaranteed and it may return any FDs.
      Therefore, it's wise to log the other ends as well.
      7454849e
    • M
      lxc: return correct number of CPUs · 87dfdb0b
      Martin Kletzander 提交于
      When getting number of CPUs the host has assigned, there was always
      number "1" returned. Even though all lxc domains with no pinning
      launched by libvirt run on all pCPUs (by default, no matter what's the
      number), we should at least return the same number as the user
      specified when creating the domain.
      87dfdb0b
    • M
      build: Fixed generating of libvirt_qemu_probes.h · be6c46b1
      Martin Kletzander 提交于
      I added libvirt_qemu_probes.h into BUILT_SOURCES. That makes it
      generated, but most probably it is not the clearest way how to do
      that, but it fixes the build.
      be6c46b1
    • D
      examples: add consolecallback example python script · ffc9f7ab
      Dave Allan 提交于
      A while back I wrote the attached code to demonstrate how to use
      events and serial console to create a serial console that stays up
      even when the VM is down.  It might need some work, as I am not
      terribly strong with Python.
      
      * examples/python/consolecallback.py: New file.
      * examples/python/Makefile.am (EXTRA_DIST): Ship it.
      ffc9f7ab
    • E
      build: don't lose probes.o files · 620dda66
      Eric Blake 提交于
      The previous patch fixed an incremental build, but missed that on
      a fresh checkout, we now have nothing left that stops make from
      nuking libvirt_qemu_probes.o.
      
      * src/Makefile.am ($(libvirt_driver_qemu_la_SOURCES)): Delete,
      since this variable is empty.
      (.PRECIOUS): Add %_probes.o, so they don't get nuked as an
      intermediate by-product after creating %_probes.lo.
      620dda66
    • E
      build: fix missing dependencies for libvirt-qemu.so · fca009fd
      Eric Blake 提交于
      The moment you specify a _DEPENDENCIES, older automake (stupidly)
      assumes that you will specify _all_ dependencies for that target.
      This stupidity has been fixed in automake 1.12, but we cannot rely on
      newer automake everywhere.  For libvirt_la_DEPENDENCIES, we took
      care of providing the full list, but for libvirt_qemu_la_DEPENDENCIES,
      we were missing the dependency on libvirt_qemu_impl.la, which resulted
      in a failed build:
      
      make[3]: Entering directory `/home/ajia/Workspace/libvirt/src'
         CCLD   libvirt_driver_qemu.la
      libtool: link: `libvirt_qemu_probes.lo' is not a valid libtool object
      
      * src/Makefile.am (libvirt_driver_qemu_la_DEPENDENCIES): Delete;
      automake does a better job if it does the entire job.
      fca009fd
    • E
      build: don't clean a file that belongs in the tarball · 28dbf01d
      Eric Blake 提交于
      Otherwise, 'make rpm' fails with:
      
      make[2]: *** No rule to make target `locking/test_libvirt_sanlock.aug.in', needed by `distdir'.  Stop.
      make[2]: Leaving directory `/home/dipankar/src/powerpc/libvirt-ppc/src'
      make[1]: *** [distdir] Error 1
      
      Reported by Dipankar Sarma.
      
      * src/Makefile.am (CLEANFILES): Clean only the generated file.
      28dbf01d
  3. 29 5月, 2012 5 次提交
    • E
      virsh: avoid strncpy · dc4301c7
      Eric Blake 提交于
      strncpy is generally evil - it runs the risk of missing NUL
      termination, and more often than not wastes time zeroing way
      more bytes than strictly necessary.  We've avoided this evil
      in our virStrncpy wrapper, except for places where we forgot
      to use the wrapper; meanwhile, we have also added an even
      higher layer wrapper for setting virTypedParameter values.
      
      * tools/virsh.c (cmdMemtune, cmdBlkdeviotune): Use modern API.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_strncpy): Tighten.
      dc4301c7
    • E
      build: update to latest gnulib · e925ea31
      Eric Blake 提交于
      Gnulib finally relaxed the isatty license, needed as first mentioned here:
      https://www.redhat.com/archives/libvir-list/2012-February/msg01022.html
      
      Other improvements include better syntax-check rules (we can delete one
      of ours now that it is a duplicate) and better compiler warning usage.
      
      * .gnulib: Update to latest, for isatty.
      * cfg.mk (sc_prohibit_strncpy): Drop a now-redundant rule.
      * bootstrap.conf (gnulib_modules): Add isatty.
      * bootstrap: Resync from gnulib.
      e925ea31
    • S
      leak_fix.diff · 67dd486f
      Stefan Berger 提交于
      ==3240== 23 bytes in 1 blocks are definitely lost in loss record 242 of 744
      ==3240==    at 0x4C2A4CD: malloc (vg_replace_malloc.c:236)
      ==3240==    by 0x8077537: __vasprintf_chk (vasprintf_chk.c:82)
      ==3240==    by 0x509C677: virVasprintf (stdio2.h:199)
      ==3240==    by 0x509C733: virAsprintf (util.c:1912)
      ==3240==    by 0x1906583A: qemudStartup (qemu_driver.c:679)
      ==3240==    by 0x511991D: virStateInitialize (libvirt.c:809)
      ==3240==    by 0x40CD84: daemonRunStateInit (libvirtd.c:751)
      ==3240==    by 0x5098745: virThreadHelper (threads-pthread.c:161)
      ==3240==    by 0x7953D8F: start_thread (pthread_create.c:309)
      ==3240==    by 0x805FF5C: clone (clone.S:115)
      67dd486f
    • S
      Introduce virMacAddr typedef · 423bb749
      Stefan Berger 提交于
      423bb749
    • D
      Fix typo in comment start · d8199033
      Daniel P. Berrange 提交于
      src/libvirt.c: s,//,/,
      d8199033
  4. 28 5月, 2012 14 次提交
    • 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
    • E
      build: silence libtool during tests · 1d22ba95
      Eric Blake 提交于
      Libtool is picky about linking against a module library (aka a .so);
      giving lots of warnings like this in the tests directory:
      
        CCLD   networkxml2argvtest
      
      *** Warning: Linking the executable networkxml2argvtest against the loadable module
      *** libvirt_driver_network.so is not portable!
      
      Fix that by splitting things into a convenience library which can
      be used directly by the tests, and making the real .so just wrap
      the convenience library.
      
      Based on a suggestion by Daniel P. Berrange.
      
      * configure.ac (--with-driver-modules): Fix help test.
      * src/Makefile.am (libvirt_driver_xen.la, libvirt_driver_libxl.la)
      (libvirt_driver_qemu.la, libvirt_driver_lxc.la)
      (libvirt_driver_uml.la): Factor into new convenience libraries.
      * tests/Makefile.am (xen_LDADDS, qemu_LDADDS, lxc_LDADDS)
      (networkxml2argvtest_LDADD): Link to convenience libraries, not
      shared libraries.
      1d22ba95
    • D
      Fix linking to DTrace probes file · 1e8ecfed
      Daniel P. Berrange 提交于
      There was no rule forcing libvirt_qemu_probes.o to be built
      before libvirt_qemu_probes.lo was used. Also libvirtd was
      still referencing the .o file, rather than the .lo file.
      
      Both the .lo and .o file must be listed as DEPENDENCIES,
      otherwise libtool will unhelpfully delete the .o file
      once the .lo file is created.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1e8ecfed
    • D
      Fix Win32 build by linking to ole32 · 7cd77b6b
      Daniel P. Berrange 提交于
      The CoTaskMemFree function requires the ole32 DLL to be
      linked against. Currently this is only done for the
      VirtualBox driver. Also add it to libvirt_util.la
      
      * configure.ac: Unconditionally add ole32 DLL to Win32
      * src/Makefile.am: Link old32 to libvirt_util.la
      7cd77b6b
    • M
      docs: typo in acceleration element · 94618eb6
      Martin Kletzander 提交于
      "accel3d" was specified twice, the second one is obviously "accel2d"
      (also from the text down below.
      94618eb6
    • D
      Autogenerate augeas test case from default config files · de9758ae
      Daniel P. Berrange 提交于
      When adding new config file parameters, the corresponding
      additions to the augeas lens' are constantly forgotten.
      Also there are augeas test cases, these don't catch the
      error, since they too are never updated.
      
      To address this, the augeas test cases need to be auto-generated
      from the example config files.
      
      * build-aux/augeas-gentest.pl: Helper to generate an
        augeas test file, substituting in elements from the
        example config files
      * src/Makefile.am, daemon/Makefile.am: Switch to
        auto-generated augeas test cases
      * daemon/test_libvirtd.aug, daemon/test_libvirtd.aug.in,
        src/locking/test_libvirt_sanlock.aug,
        src/locking/test_libvirt_sanlock.aug.in,
        src/lxc/test_libvirtd_lxc.aug,
        src/lxc/test_libvirtd_lxc.aug.in,
        src/qemu/test_libvirtd_qemu.aug,
        src/qemu/test_libvirtd_qemu.aug.in: Remove example
        config file data, replacing with a ::CONFIG:: placeholder
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      de9758ae
    • D
      Re-order config options in qemu driver augeas lens · 6c10c04c
      Daniel P. Berrange 提交于
      Currently all the config options are listed under a 'vnc_entry'
      group. Create a bunch of new groups & move options to the
      right place
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6c10c04c
    • D
      Fix mistakes in augeas lens · a9c779ca
      Daniel P. Berrange 提交于
      Add nmissing 'host_uuid' entry to libvirtd.conf lens and
      rename spice_passwd to spice_password in qemu.conf lens
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a9c779ca
    • D
      Standardize whitespace used in example config files · c5c3278e
      Daniel P. Berrange 提交于
      Instead of doing
      
        # example_config
      
      use
      
        #example_config
      
      so it is possible to programatically uncomment example config
      options, as distinct from their comment/descriptions
      
      Also delete rogue trailing comma not allowed by lens
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c5c3278e
    • D
      Add impl of APIs to get user directories on Win32 · 076f2006
      Daniel P. Berrange 提交于
      Add an impl of +virGetUserRuntimeDirectory, virGetUserCacheDirectory
      virGetUserConfigDirectory and virGetUserDirectory for Win32 platform.
      Also create stubs for non-Win32 platforms which lack getpwuid_r()
      
      In adding these two helpers were added virFileIsAbsPath and
      virFileSkipRoot, along with some macros VIR_FILE_DIR_SEPARATOR,
      VIR_FILE_DIR_SEPARATOR_S, VIR_FILE_IS_DIR_SEPARATOR,
      VIR_FILE_PATH_SEPARATOR, VIR_FILE_PATH_SEPARATOR_S
      
      All this code was adapted from GLib2 under terms of LGPLv2+ license.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      076f2006
    • D
      Remove uid param from directory lookup APIs · 517368a3
      Daniel P. Berrange 提交于
      Remove the uid param from virGetUserConfigDirectory,
      virGetUserCacheDirectory, virGetUserRuntimeDirectory,
      and virGetUserDirectory
      
      These functions were universally called with the
      results of getuid() or geteuid(). To make it practical
      to port to Win32, remove the uid parameter and hardcode
      geteuid()
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      517368a3
    • D
      Fix typos in RPM dependencies · 83fe3d22
      Daniel P. Berrange 提交于
      s/daemon-driver-nwilter/daemon-driver-nwfilter/
      s/daemon-network/daemon-driver-network/
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      83fe3d22
    • D
      Fix check for socket existance / daemon spawn · 54c4d9d9
      Daniel P. Berrange 提交于
      When you try to connect to a socket in the abstract namespace,
      the error will be ECONNREFUSED for a non-listening daemon. With
      the non-abstract namespace though, you instead get ENOENT. Add
      a check for this extra errno when auto-spawning the daemon
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      54c4d9d9
    • D
      Remove last usage of PATH_MAX and ban its future use · ebbcc026
      Daniel P. Berrange 提交于
      Remove a number of pointless checks against PATH_MAX and
      add a syntax-check rule to prevent its use in future
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ebbcc026
  5. 26 5月, 2012 2 次提交
    • J
      maint: avoid new automake warning about AM_PROG_CC_STDC · 0d07aa51
      Jim Meyering 提交于
      * configure.ac (AM_PROG_CC_STDC): Stop using this macro.
      It provokes warnings from newer automake and is superseded by
      autoconf's AC_PROG_CC, which we're already using.
      0d07aa51
    • E
      build: silence libtool warning on probes.o · 0159295d
      Eric Blake 提交于
      Libtool supports linking directly against .o files on some platforms
      (such as Linux), which happens to be the only place where we are
      actually doing that (for the dtrace-generated probes.o files).  However,
      it raises a big stink about the non-portability, even though we don't
      attempt it on platforms where it would actually fail:
      
        CCLD   libvirt_driver_qemu.la
      
      *** Warning: Linking the shared library libvirt_driver_qemu.la against
      the non-libtool
      *** objects  libvirt_qemu_probes.o is not portable!
      
      This shuts libtool up by creating a proper .lo file that matches
      what libtool normally expects.
      
      * src/Makefile.am (%_probes.lo): New rule.
      (libvirt_probes.stp, libvirt_qemu_probes.stp): Simplify into...
      (%_probes.stp): ...shorter rule.
      (CLEANFILES): Clean new .lo files.
      (libvirt_la_BUILT_LIBADD, libvirt_driver_qemu_la_LIBADD)
      (libvirt_lxc_LDADD, virt_aa_helper_LDADD): Link against .lo file.
      * tests/Makefile.am (PROBES_O, qemu_LDADDS): Likewise.
      0159295d
  6. 25 5月, 2012 4 次提交