1. 17 2月, 2011 1 次提交
    • O
      storage: Allow to delete device mapper disk partition · df1011ca
      Osier Yang 提交于
      The name convention of device mapper disk is different, and 'parted'
      can't be used to delete a device mapper disk partition. e.g.
      
      Name                 Path
      -----------------------------------------
      3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1
      
      Error: Expecting a partition number.
      
      This patch introduces 'dmsetup' to fix it.
      
      Changes:
        - New function "virIsDevMapperDevice" in "src/utils/utils.c"
        - remove "is_dm_device" in "src/storage/parthelper.c", use
          "virIsDevMapperDevice" instead.
        - Requires "device-mapper" for 'with-storage-disk" in "libvirt.spec.in"
        - Check "dmsetup" in 'configure.ac' for "with-storage-disk"
        - Changes on "src/Makefile.am" to link against libdevmapper
        - New entry for "virIsDevMapperDevice" in "src/libvirt_private.syms"
      
      Changes from v1 to v3:
        - s/virIsDeviceMapperDevice/virIsDevMapperDevice/g
        - replace "virRun" with "virCommand"
        - sort the list of util functions in "libvirt_private.syms"
        - ATTRIBUTE_NONNULL(1) for virIsDevMapperDevice declaration.
      
      e.g.
      
      Name                 Path
      -----------------------------------------
      3600a0b80005ad1d7000093604cae912fp1 /dev/mapper/3600a0b80005ad1d7000093604cae912fp1
      
      Vol /dev/mapper/3600a0b80005ad1d7000093604cae912fp1 deleted
      
      Name                 Path
      -----------------------------------------
      df1011ca
  2. 16 2月, 2011 2 次提交
    • E
      cgroup: preserve correct errno on failure · 76c57a7c
      Eric Blake 提交于
      * src/util/cgroup.c (virCgroupSetValueStr, virCgroupGetValueStr)
      (virCgroupRemoveRecursively): VIR_DEBUG can clobber errno.
      (virCgroupRemove): Use VIR_DEBUG rather than DEBUG.
      76c57a7c
    • E
      build: address clang reports about virCommand · 3db08aea
      Eric Blake 提交于
      clang had 5 reports against virCommand; three were false positives
      (a NULL deref in ProcessIO solved by sa_assert, and two uninitialized
      memory operations solved by adding an initializer), but two were real.
      
      * src/util/command.c (virCommandProcessIO): Fix real bug of
      possible NULL dereference.  Teach clang that buf is never NULL.
      (virCommandRun): Teach clang that infd is only ever accessed when
      initialized.
      3db08aea
  3. 15 2月, 2011 5 次提交
  4. 14 2月, 2011 1 次提交
  5. 12 2月, 2011 1 次提交
    • E
      build: fix cygwin strerror_r failure · 699a5888
      Eric Blake 提交于
      Building the 0.8.8 release candidate on cygwin produced this compiler
      warning, which is indicative of catastrophic failure on any attempt to
      print an error message with errno turned to a string:
      
        CC       strerror_r.lo
      strerror_r.c: In function 'rpl_strerror_r':
      strerror_r.c:67: warning: assignment makes integer from pointer without a cast
      
      This has been fixed in gnulib.
      
      * .gnulib: Update to latest, for strerror_r fix.
      * src/util/memory.c (includes): Satisfy 'make syntax-check'.
      699a5888
  6. 11 2月, 2011 1 次提交
    • D
      Imprint all logs with version + package build information · cee61fc2
      Daniel P. Berrange 提交于
      The logging functions are enhanced so that immediately prior to
      the first log message being printed to any output channel, the
      libvirt package version will be printed.
      
      eg
      
       $ LIBVIRT_DEBUG=1 virsh
       18:13:28.013: 17536: info : libvirt version: 0.8.7
       18:13:28.013: 17536: debug : virInitialize:361 : register drivers
       ...
      
      The 'configure' script gains two new arguments which can be
      used as
      
         --with-packager="Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10"
         --with-packager-version="1.fc14"
      
      to allow distros to append a custom string with package specific
      data.
      
      The RPM specfile is modified so that it appends the RPM version,
      the build host, the build date and the packager name.
      
      eg
      
       $ LIBVIRT_DEBUG=1 virsh
       18:14:52.086: 17551: info : libvirt version: 0.8.7, package: 1.fc13 (Fedora Project, x86-01.phx2.fedoraproject.org, 01-27-2011-18:00:10)
       18:14:52.086: 17551: debug : virInitialize:361 : register drivers
      
      Thus when distro packagers receive bug reports they can clearly
      see what version was in use, even if the bug reporter mistakenly
      or intentionally lies about version/builds
      
      * src/util/logging.c: Output version data prior to first log message
      * libvirt.spec.in: Include RPM release, date, hostname & packager
      * configure.ac: Add --with-packager & --with-packager-version args
      cee61fc2
  7. 10 2月, 2011 2 次提交
  8. 09 2月, 2011 3 次提交
  9. 04 2月, 2011 1 次提交
    • S
      macvtap: fix 2 nla_put expressions (non-serious bug) · be23e2bd
      Stefan Berger 提交于
      This patch fixes 2 occurrences of nla_put expression with a '!' in
      front of them that basically prevented the detection that the buffer
      is too small. However, code further below would then detect that the
      buffer is too small when further parts are added to the netlink message.
      be23e2bd
  10. 03 2月, 2011 1 次提交
    • D
      Fix conflicts with glibc globals · de53effe
      Davidlohr Bueso 提交于
      When compiling libvirt with GCC 3.4.6 the following warning is being triggered quite a lot:
      
      util/memory.h:60: warning: declaration of 'remove' shadows a global declaration
      /usr/include/stdio.h:175: warning: shadowed declaration is here
      
      Fix this by renaming the parameter to 'toremove'.
      de53effe
  11. 02 2月, 2011 1 次提交
  12. 30 1月, 2011 2 次提交
    • E
      maint: reject raw close, popen in 'make syntax-check' · 030ce43b
      Eric Blake 提交于
      commit f1fe9671 was supposed to make sure we use files.h
      macros to avoid double close, but it didn't work.
      
      Meanwhile, virCommand is vastly superior to system(), fork(),
      and popen() (also to virExec, but we haven't completed that
      conversion), so enforce that, too.
      
      * cfg.mk (sc_prohibit_close): Fix typo that excluded close, and
      add pclose.
      (sc_prohibit_fork_wrappers): New rule, for fork, system, and popen.
      * .x-sc_prohibit_close: More exemptions.
      * .x-sc_prohibit_fork_wrappers: New file.
      * Makefile.am (syntax_check_exceptions): Ship new file.
      * src/datatypes.c (virReleaseConnect): Tweak comment to avoid
      false positive.
      * src/util/files.h (VIR_CLOSE): Likewise.
      030ce43b
    • E
      build: avoid close, system · e67ae619
      Eric Blake 提交于
      * src/fdstream.c (virFDStreamOpenFile, virFDStreamCreateFile):
      Use VIR_FORCE_CLOSE instead of close.
      * tests/commandtest.c (mymain): Likewise.
      * tools/virsh.c (editFile): Use virCommand instead of system.
      * src/util/util.c (__virExec): Special case preservation of std
      file descriptors to child.
      e67ae619
  13. 29 1月, 2011 1 次提交
  14. 26 1月, 2011 3 次提交
    • 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
    • D
      Cleanup code style in logging APIs · 2b7ac883
      Daniel P. Berrange 提交于
      Remove use of brackets around following return statement.
      Fix indentation of two switch statements
      2b7ac883
  15. 19 1月, 2011 1 次提交
    • E
      build: use more gnulib modules for simpler code · c5b11b3c
      Eric Blake 提交于
      * .gnulib: Update to latest, for sigpipe and sigaction modules.
      * bootstrap.conf (gnulib_modules): Add siaction, sigpipe, strerror_r.
      * tools/virsh.c (vshSetupSignals) [!SIGPIPE]: Delete, now that
      gnulib guarantees it.
      (SA_SIGINFO): Define for mingw fallback.
      * src/util/virterror.c (virStrerror): Simplify, now that gnulib
      guarantees the POSIX interface.
      * configure.ac (AC_CHECK_FUNCS_ONCE): Drop redundant check.
      (AM_PROG_CC_STDC): Move earlier, to keep autoconf happy.
      c5b11b3c
  16. 15 1月, 2011 1 次提交
  17. 14 1月, 2011 1 次提交
    • E
      util: add missing string->integer conversion functions · 1ff03b28
      Eric Blake 提交于
      It was awkward having only int conversion in the virStrToLong family,
      but only long conversion in the virXPath family.  Make both families
      support both types.
      
      * src/util/util.h (virStrToLong_l, virStrToLong_ul): New
      prototypes.
      * src/util/xml.h (virXPathInt, virXPathUInt): Likewise.
      * src/util/util.c (virStrToLong_l, virStrToLong_ul): New
      functions.
      * src/util/xml.c (virXPathInt, virXPathUInt): Likewise.
      * src/libvirt_private.syms (util.h, xml.h): Export them.
      1ff03b28
  18. 13 1月, 2011 1 次提交
    • E
      virFindFileInPath: only find executable non-directory · 9ae992f2
      Eric Blake 提交于
      Without this patch, at least tests/daemon-conf (which sticks
      $builddir/src in the PATH) tries to execute the directory
      $builddir/src/qemu rather than a real qemu binary.
      
      * src/util/util.h (virFileExists): Adjust prototype.
      (virFileIsExecutable): New prototype.
      * src/util/util.c (virFindFileInPath): Reject non-executables and
      directories.  Avoid huge stack allocation.
      (virFileExists): Use lighter-weight syscall.
      (virFileIsExecutable): New function.
      * src/libvirt_private.syms (util.h): Export new function.
      9ae992f2
  19. 11 1月, 2011 1 次提交
  20. 06 1月, 2011 1 次提交
    • L
      Log an error on attempts to add a NAT rule for non-IPv4 addresses · cd6a8f9c
      Laine Stump 提交于
      Although the upper-layer code protected against it, it was possible to
      call iptablesForwardMasquerade() with an IPv6 address and have it
      attempt to add a rule to the MASQUERADE chain of ip6tables (which
      doesn't exist).
      
      This patch changes that function to check the protocol of the given
      address, generate an error log if it's not IPv4 (AF_INET), and finally
      hardcodes all the family parameters sent down to lower-level functions.
      cd6a8f9c
  21. 04 1月, 2011 2 次提交
    • E
      build: avoid compilation warnings · c685993d
      Eric Blake 提交于
      Detected on cygwin:
      util/util.c: In function 'virSetUIDGID':
      util/util.c:2824: warning: format '%d' expects type 'int', but argument 7 has type 'gid_t' [-Wformat]
      (and three other lines)
      
      * src/util/util.c (virSetUIDGID): Cast, as is done elsewhere in
      this file, to avoid printf type mismatch warnings.
      c685993d
    • H
      threadpool: allow NULL jobdata · b2dbc160
      Hu Tao 提交于
      Don't require non-null jobdata to virThreadPoolSendJob().
      b2dbc160
  22. 01 1月, 2011 4 次提交
    • E
      virExec: fix logic bug · e80ed3fd
      Eric Blake 提交于
      As pointed out in https://bugzilla.redhat.com/show_bug.cgi?id=659855#c9,
      commit c3568ec2 introduced a regression where we no longer close any
      fd's beyond FD_SETSIZE.
      
      * src/util/util.c (__virExec): Continue to close fd's beyond
      keepfd range.
      Reported by Stefan Praszalowicz.
      e80ed3fd
    • L
      Improve virSocketAddrMask[ByPrefix] API · 77094eaf
      Laine Stump 提交于
      The original version of these functions would modify the address sent
      in, meaning that the caller would usually need to copy the address
      first. This change makes the original a const, and puts the resulting
      masked address into a new arg (which could point to the same
      virSocketAddr as the original, if the caller really wants to modify
      it).
      
      This also makes the API consistent with virSocketAddrBroadcast[ByPrefix].
      77094eaf
    • L
      Set broadcast address for IPv4 addresses on virtual network bridges · 2eeeb601
      Laine Stump 提交于
      Previously we used ioctl() to set the IP address and netmask of the
      bridges used for virtual networks, and apparently the SIOCSIFNETMASK
      ioctl implicitly set the broadcast address for the interface. The new
      method of using the "ip" command requires broadcast address to be
      explicitly specified though.
      2eeeb601
    • L
      Utility functions to produce an IPv4 broadcast address · 86387878
      Laine Stump 提交于
      These functions work only for IPv4, becasue IPv6 doesn't have the same
      concept of "broadcast address" as IPv4. They merely OR the inverse of
      the netmask with the given host address, thus turning on all the host
      bits.
      86387878
  23. 24 12月, 2010 3 次提交
    • J
      bridge: Fix uninitialized variable · 0ecac8aa
      Jiri Denemark 提交于
      0ecac8aa
    • L
      new virSetUIDGID() utility function · d596c6dc
      Laine Stump 提交于
      virSetUIDGID() sets both the real and effective group and user of the
      process, and additionally calls initgroups() to assure that the
      process joins all the auxiliary groups that the given uid is a member
      of.
      d596c6dc
    • L
      Preserve errno across calls to error reporting functions & VIR_FREE · 17e19add
      Laine Stump 提交于
      There are cases when we want log an error message, and possibly free
      some memory as part of the cleanup, while still preserving errno for a
      caller, but the functions that log errors, and virFree (VIR_FREE) make
      system calls that will clear errno. This patch preserves errno during
      those most basic functions (corresponding to virReportSystemError(),
      virReportOOMError(), networkReportError(), etc, as well as
      virStrError()). It does *not preserve errno across calls to higher
      level items such as virDispatchError(), as it's assumed the caller is
      all finished with any need for errno by the time it dispatches the
      error.
      17e19add