1. 18 11月, 2010 1 次提交
    • E
      maint: improve i18n on non-Linux · 981d2cda
      Eric Blake 提交于
      Per the gettext developer:
      http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00019.html
      http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00021.html
      
      gettext() doesn't work correctly on all platforms unless you have
      called setlocale().  Furthermore, gnulib's gettext.h has provisions
      for setting up a default locale, which is the preferred method for
      libraries to use gettext without having to call textdomain() and
      override the main program's default domain (virInitialize already
      calls bindtextdomain(), but this is insufficient without the
      setlocale() added in this patch; and a redundant bindtextdomain()
      in this patch doesn't hurt, but serves as a good example for other
      packages that need to bind a second translation domain).
      
      This patch is needed to silence a new gnulib 'make syntax-check'
      rule in the next patch.
      
      * daemon/libvirtd.c (main): Setup locale and gettext.
      * src/lxc/lxc_controller.c (main): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/storage/parthelper.c (main): Likewise.
      * tools/virsh.c (main): Fix exit status.
      * src/internal.h (DEFAULT_TEXT_DOMAIN): Define, for gettext.h.
      (_): Simplify definition accordingly.
      * po/POTFILES.in: Add src/storage/parthelper.c.
      981d2cda
  2. 17 11月, 2010 2 次提交
    • E
      maint: use gnulib configmake rather than open-coding things · 0d5f54bb
      Eric Blake 提交于
      * bootstrap.conf (gnulib_modules): Add configmake.
      * daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
      gnulib.
      * src/Makefile.am (INCLUDES): Likewise.
      * tests/Makefile.am (INCLUDES): Likewise.
      * tools/Makefile.am (virsh_CFLAGS): Likewise.
      * daemon/libvirtd.c (qemudInitPaths, usage, main): Update
      clients.
      * src/cpu/cpu_map.c (CPUMAPFILE): Likewise.
      * src/driver.c (DEFAULT_DRIVER_DIR): Likewise.
      * src/internal.h (_): Likewise.
      * src/libvirt.c (virInitialize): Likewise.
      * src/lxc/lxc_conf.h (LXC_CONFIG_DIR, LXC_STATE_DIR, LXC_LOG_DIR):
      Likewise.
      * src/lxc/lxc_conf.c (lxcCapsInit, lxcLoadDriverConfig):
      Likewise.
      * src/network/bridge_driver.c (NETWORK_PID_DIR)
      (NETWORK_STATE_DIR, DNSMASQ_STATE_DIR, networkStartup): Likewise.
      * src/nwfilter/nwfilter_driver.c (nwfilterDriverStartup):
      Likewise.
      * src/qemu/qemu_conf.c (qemudLoadDriverConfig): Likewise.
      * src/qemu/qemu_driver.c (qemudStartup): Likewise.
      * src/remote/remote_driver.h (LIBVIRTD_PRIV_UNIX_SOCKET)
      (LIBVIRTD_PRIV_UNIX_SOCKET_RO, LIBVIRTD_CONFIGURATION_FILE)
      (LIBVIRT_PKI_DIR): Likewise.
      * src/secret/secret_driver.c (secretDriverStartup): Likewise.
      * src/security/security_apparmor.c (VIRT_AA_HELPER): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/storage/storage_backend_disk.c (PARTHELPER): Likewise.
      * src/storage/storage_driver.c (storageDriverStartup): Likewise.
      * src/uml/uml_driver.c (TEMPDIR, umlStartup): Likewise.
      * src/util/hooks.c (LIBVIRT_HOOK_DIR): Likewise.
      * tools/virsh.c (main): Likewise.
      * docs/hooks.html.in: Likewise.
      0d5f54bb
    • S
      deprecate fclose() and introduce VIR_{FORCE_}FCLOSE() · 7b7cb1ec
      Stefan Berger 提交于
      Similarly to deprecating close(), I am now deprecating fclose() and
      introduce VIR_FORCE_FCLOSE() and VIR_FCLOSE(). Also, fdopen() is replaced with
      VIR_FDOPEN().
      
      Most of the files are opened in read-only mode, so usage of
      VIR_FORCE_CLOSE() seemed appropriate. Others that are opened in write
      mode already had the fclose()<  0 check and I converted those to
      VIR_FCLOSE()<  0.
      
      I did not find occurrences of possible double-closed files on the way.
      7b7cb1ec
  3. 10 11月, 2010 1 次提交
    • S
      bye to close(), welcome to VIR_(FORCE_)CLOSE() · 60ae1c34
      Stefan Berger 提交于
      Using automated replacement with sed and editing I have now replaced all
      occurrences of close() with VIR_(FORCE_)CLOSE() except for one, of
      course. Some replacements were straight forward, others I needed to pay
      attention. I hope I payed attention in all the right places... Please
      have a look. This should have at least solved one more double-close
      error.
      60ae1c34
  4. 28 10月, 2010 1 次提交
  5. 20 8月, 2010 2 次提交
    • E
      storage: avoid s[n]printf · 4bcac75b
      Eric Blake 提交于
      * src/storage/storage_backend.c (virStorageBackendCreateQemuImg)
      (virStorageBackendCreateQcowCreate): Use virAsprintf instead.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskCreateVol, virStorageBackendDiskPartFormat):
      Likewise.
      4bcac75b
    • E
      maint: whitespace cleanups · 57ae4c04
      Eric Blake 提交于
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskPartFormat): Fix spacing.
      57ae4c04
  6. 03 8月, 2010 1 次提交
  7. 31 7月, 2010 1 次提交
    • E
      storage: kill dead stores · 549b8399
      Eric Blake 提交于
      Found by clang.  Clang complained that virStorageBackendProbeTarget
      could dereference NULL if backingStoreFormat was NULL, but since all
      callers passed a valid pointer, I added attributes instead of null
      checks.
      
      * src/storage/storage_backend.c
      (virStorageBackendQEMUImgBackingFormat): Kill dead store.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.  Skip null checks, by adding attributes.
      549b8399
  8. 22 7月, 2010 4 次提交
    • L
      Remove erroneous setting of return value to errno. · ae3d31bf
      Laine Stump 提交于
      One error exit in virStorageBackendCreateBlockFrom was setting the
      return value to errno. The convention for volume build functions is to
      return 0 on success or -1 on failure. Not only was it not necessary to
      set the return value (it defaults to -1, and is set to 0 when
      everything has been successfully completed), in the case that some
      caller were checking for < 0 rather than != 0, they would incorrectly
      believe that it completed successfully.
      ae3d31bf
    • L
      Change virDirCreate to return -errno on failure. · 3e0f05fc
      Laine Stump 提交于
      virDirCreate also previously returned 0 on success and errno on
      failure. This makes it fit the recommended convention of returning 0
      on success, -errno (ie a negative number) on failure.
      3e0f05fc
    • L
      Make virStorageBackendCopyToFD return -errno. · ace1a2ba
      Laine Stump 提交于
      Previously virStorageBackendCopyToFD would simply return -1 on
      error. This made the error return from one of its callers inconsistent
      (createRawFileOpHook is supposed to return -errno, but if
      virStorageBackendCopyToFD failed, createRawFileOpHook would just
      return -1). Since there is a useful errno in every case of error
      return from virStorageBackendCopyToFD, and since the other uses of
      that function ignore the return code (beyond simply checking to see if
      it is < 0), this is a safe change.
      ace1a2ba
    • L
      Change virFileOperation to return -errno (ie < 0) on error. · 2ad04f78
      Laine Stump 提交于
      virFileOperation previously returned 0 on success, or the value of
      errno on failure. Although there are other functions in libvirt that
      use this convention, the preferred (and more common) convention is to
      return 0 on success and -errno (or simply -1 in some cases) on
      failure. This way the check for failure is always (ret < 0).
      
      * src/util/util.c - change virFileOperation and virFileOperationNoFork to
                          return -errno on failure.
      
      * src/storage/storage_backend.c, src/qemu/qemu_driver.c
        - change the hook functions passed to virFileOperation to return
          -errno on failure.
      2ad04f78
  9. 20 7月, 2010 5 次提交
    • L
      fsync new storage volumes even if new volume was copied. · e0f26c46
      Laine Stump 提交于
      Originally the storage volume files were opened with O_DSYNC to make
      sure they were flushed to disk immediately. It turned out that this
      was extremely slow in some cases, so the O_DSYNC was removed in favor
      of just calling fsync() after all the data had been written. However,
      this call to fsync was inside the block that is executed to zero-fill
      the end of the volume file. In cases where the new volume is copied
      from an old volume, and they are the same length, this fsync would
      never take place.
      
      Now the fsync is *always* done, unless there is an error (in which
      case it isn't important, and is most likely inappropriate.
      e0f26c46
    • L
      Don't skip zero'ing end of volume file when inputvol is shorter than newvol · 35bebb57
      Laine Stump 提交于
      A missing set of braces around an error condition caused us to skip
      zero'ing out the remainder of a new volume file if the new volume was
      longer than the original (the goto was supposed to be taken only in
      the case of error, but was always being taken).
      35bebb57
    • D
      Use the extract backing store format in storage volume lookup · 187da82f
      Daniel P. Berrange 提交于
      The storage volume lookup code was probing for the backing store
      format, instead of using the format extracted from the file
      itself. This meant it could report in accurate information. If
      a format is included in the file, then use that in preference,
      with probing as a fallback.
      
      * src/storage/storage_backend_fs.c: Use extracted backing store
        format
      187da82f
    • D
      Rewrite qemu-img backing store format handling · 27f45438
      Daniel P. Berrange 提交于
      When creating qcow2 files with a backing store, it is important
      to set an explicit format to prevent QEMU probing. The storage
      backend was only doing this if it found a 'kvm-img' binary. This
      is wrong because plenty of kvm-img binaries don't support an
      explicit format, and plenty of 'qemu-img' binaries do support
      a format. The result was that most qcow2 files were not getting
      a backing store format.
      
      This patch runs 'qemu-img -h' to check for the two support
      argument formats
      
        '-o backing_format=raw'
        '-F raw'
      
      and use whichever option it finds
      
      * src/storage/storage_backend.c: Query binary to determine
        how to set the backing store format
      27f45438
    • D
      Require format to be passed into virStorageFileGetMetadata · bf80fc68
      Daniel P. Berrange 提交于
      Require the disk image to be passed into virStorageFileGetMetadata.
      If this is set to VIR_STORAGE_FILE_AUTO, then the format will be
      resolved using probing. This makes it easier to control when
      probing will be used
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_security_dac.c,
        src/security/security_selinux.c, src/security/virt-aa-helper.c:
        Set VIR_STORAGE_FILE_AUTO when calling virStorageFileGetMetadata.
      * src/storage/storage_backend_fs.c: Probe for disk format before
        calling virStorageFileGetMetadata.
      * src/util/storage_file.h, src/util/storage_file.c: Remove format
        from virStorageFileMeta struct & require it to be passed into
        method.
      bf80fc68
  10. 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
  11. 15 6月, 2010 2 次提交
    • 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
    • D
      Fix enumeration of partitions in disks with a trailing digit in path · bc8d9f20
      Daniel P. Berrange 提交于
      Disks with a trailing digit in their path (eg /dev/loop0 or
      /dev/dm0) have an extra 'p' appended before the partition
      number (eg, to form /dev/loop0p1 not /dev/loop01). Fix the
      partition lookup to append this extra 'p' when required
      
      * src/storage/parthelper.c: Add a 'p' before partition
        number if required
      bc8d9f20
  12. 08 6月, 2010 2 次提交
    • D
      Fix error codes for missing storage pools · 627409d1
      Daniel P. Berrange 提交于
      The storage pool driver is mistakenly using the error code
      VIR_ERR_INVALID_STORAGE_POOL which is for diagnosing invalid
      pointers. This patch switches it to use VIR_ERR_NO_STORAGE_POOL
      which is the correct code for cases where the storage pool does
      not exist
      
      * src/storage/storage_driver.c: Replace VIR_ERR_INVALID_STORAGE_POOL
        with VIR_ERR_NO_STORAGE_POOL
      627409d1
    • D
      Storage pool duplicate UUID/name checking · e9364d9f
      Daniel P. Berrange 提交于
      The storage pool driver is not doing correct checking for
      duplicate UUID/name values. This introduces a new method
      virStoragePoolObjIsDuplicate, based on the previously
      written virDomainObjIsDuplicate.
      
      * src/conf/storage_conf.c, src/conf/storage_conf.c,
        src/libvirt_private.syms: Add virStoragePoolObjIsDuplicate,
      * src/storage/storage_driver.c: Call virStoragePoolObjIsDuplicate
        for checking uniqueness of uuid/names
      e9364d9f
  13. 29 5月, 2010 2 次提交
    • J
      build: make cpp indentation conform · f9a4df5a
      Jim Meyering 提交于
      * src/storage/storage_backend.h (VIR_STORAGE_VOL_OPEN_DEFAULT):
      Adjust s/#define/# define/, and align continued lines.
      f9a4df5a
    • C
      storage: Check for invalid storage mode before opening · 4a1abb3f
      Cole Robinson 提交于
      If a directory pool contains pipes or sockets, a pool start can fail or hang:
      
      https://bugzilla.redhat.com/show_bug.cgi?id=589577
      
      We already try to avoid these special files, but only attempt after
      opening the path, which is where the problems lie. Unify volume opening
      into helper functions, which use the proper open() flags to avoid error,
      followed by fstat to validate storage mode.
      
      Previously, virStorageBackendUpdateVolTargetInfoFD attempted to enforce the
      storage mode check, but allowed callers to detect this case and silently
      continue. In practice, only the FS backend was using this feature, the rest
      were treating unknown mode as an error condition. Unfortunately the InfoFD
      function wasn't raising an error message here, so error reporting was
      busted.
      
      This patch adds 2 functions: virStorageBackendVolOpen, and
      virStorageBackendVolOpenModeSkip. The latter retains the original opt out
      semantics, the former now throws an explicit error.
      
      This patch maintains the previous volume mode checks: allowing specific
      modes for specific pool types requires a bit of surgery, since VolOpen
      is called through several different helper functions.
      
      v2: Use ATTRIBUTE_NONNULL. Drop stat check, just open with
          O_NONBLOCK|O_NOCTTY.
      
      v3: Move mode check logic back to VolOpen. Use 2 VolOpen functions with
          different error semantics.
      
      v4: Make second VolOpen function more extensible. Didn't opt to change
          FS backend defaults, this can just be to fix the original bug.
      
      v5: Prefix default flags with VIR_, use ATTRIBUTE_RETURN_CHECK
      4a1abb3f
  14. 26 5月, 2010 1 次提交
  15. 25 5月, 2010 1 次提交
  16. 24 5月, 2010 2 次提交
    • C
      storage: Combine some duplicate code · e40a285b
      Cole Robinson 提交于
      Volume detection in the scsi backend was duplicating code already
      present in storage_backend.c. Let's drop the duplicate code.
      
      Also, change the shared function name to be less generic, and remove
      some error squashing in the other call site.
      e40a285b
    • C
      storage: mpath: Clean up some error handling · 5086f85c
      Cole Robinson 提交于
      We were squashing error messages in a few cases. Recode to follow common
      ret = -1 convention.
      
      v2: Handle more error squashing issues further up in MakeNewVol and
          CreateVols. Use ret = -1 convention in MakeVols.
      5086f85c
  17. 21 5月, 2010 2 次提交
  18. 18 5月, 2010 1 次提交
    • E
      virFileResolveLink: fix return value · d533a98e
      Eric Blake 提交于
      virFileResolveLink was returning a positive value on error,
      thus confusing callers that assumed failure was < 0.  The
      confusion is further evidenced by callers that would have
      ended up calling virReportSystemError with a negative value
      instead of a valid errno.
      
      Fixes Red Hat BZ #591363.
      
      * src/util/util.c (virFileResolveLink): Live up to documentation.
      * src/qemu/qemu_security_dac.c
      (qemuSecurityDACRestoreSecurityFileLabel): Adjust callers.
      * src/security/security_selinux.c
      (SELinuxRestoreSecurityFileLabel): Likewise.
      * src/storage/storage_backend_disk.c
      (virStorageBackendDiskDeleteVol): Likewise.
      d533a98e
  19. 07 5月, 2010 1 次提交
    • E
      build: use gnulib's sys/wait.h · 8acaeb73
      Eric Blake 提交于
      * configure.ac: Drop sys/wait.h check.
      * src/libvirt.c (includes): Use header unconditionally.
      * src/remote/remote_driver.c (includes): Likewise.
      * src/storage/storage_backend.c (includes): Likewise.
      * src/util/ebtables.c (includes): Likewise.
      * src/util/hooks.c (includes): Likewise.
      * src/util/iptables.c (includes): Likewise.
      * src/util/util.c (includes): Likewise.
      8acaeb73
  20. 04 5月, 2010 1 次提交
    • E
      build: prefer WIN32 over __MINGW32__ checks · 9f87b631
      Eric Blake 提交于
      WIN32 is always defined when __MINGW32__ is defined, but the
      converse is not true.  WIN32 is more generic, if someone were
      to ever attempt porting to a microsoft compiler.  This does
      not affect Cygwin, which intentionally does not define WIN32.
      
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Use more
      generic flag macro.
      * src/storage/storage_backend.c
      (virStorageBackendUpdateVolTargetInfoFD)
      (virStorageBackendRunProgRegex): Likewise.
      * tools/console.h (vshRunConsole): Likewise.
      9f87b631
  21. 30 4月, 2010 1 次提交
  22. 16 4月, 2010 1 次提交
  23. 14 4月, 2010 2 次提交
  24. 08 4月, 2010 1 次提交
  25. 06 4月, 2010 1 次提交