1. 01 10月, 2011 1 次提交
    • S
      lvm storage backend: handle command_names=1 in lvm.conf · 30f555c6
      Serge E. Hallyn 提交于
      If the regexes supported (?:pvs)?, then we could handle this by
      optionally matching but not returning the initial command name.  But it
      doesn't.  So add a new char* argument to
      virStorageBackendRunProgRegex().  If that argument is NULL then we act
      as usual.  Otherwise, if the string at that argument is found at the
      start of a returned line, we drop that before running the regex.
      
      With this patch, virt-manager shows me lvs with command_names 1 or 0.
      
      The definitions of PVS_BASE etc may want to be moved into the configure
      scripts (though given how PVS is found, IIUC that could only happen if
      pvs was a link to pvs_real), but in any case no sense dealing with that
      until we're sure this is an ok way to handle it.
      Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      30f555c6
  2. 01 9月, 2011 1 次提交
  3. 23 8月, 2011 1 次提交
  4. 19 8月, 2011 1 次提交
    • M
      storage: Flush host cache after write · b32f8b19
      Michal Privoznik 提交于
      Although we are flushing cache after some critical writes (e.g.
      volume creation), after some others we do not (e.g. volume cloning).
      This patch fix this issue. That is for volume cloning, writing
      header of logical volume, and storage wipe.
      b32f8b19
  5. 22 7月, 2011 1 次提交
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  6. 13 7月, 2011 1 次提交
    • E
      storage: reject unknown flags · 64bd1b9d
      Eric Blake 提交于
      * src/storage/storage_backend.c (virStorageBackendCreateBlockFrom)
      (virStorageBackendCreateQemuImg)
      (virStorageBackendCreateQcowCreate): Reject unknown flags.
      * src/storage/storage_backend_disk.c (virStorageBackendDiskBuildPool)
      (virStorageBackendDiskDeleteVol): Likewise.
      * src/storage/storage_backend_fs.c
      (virStorageBackendFileSystemNetFindPoolSources)
      (virStorageBackendFileSystemBuild)
      (virStorageBackendFileSystemDelete, createFileDir)
      (virStorageBackendFileSystemVolBuildFrom)
      (virStorageBackendFileSystemVolDelete): Likewise.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSIFindPoolSources): Likewise.
      * src/storage/storage_backend_logical.c
      (virStorageBackendLogicalFindPoolSources)
      (virStorageBackendLogicalBuildPool)
      (virStorageBackendLogicalDeletePool)
      (virStorageBackendLogicalDeleteVol): Likewise.
      * src/storage/storage_driver.c (storageOpen, storagePoolCreate)
      (storagePoolDefine, storagePoolRefresh, storagePoolGetXMLDesc)
      (storageVolumeCreateXML, storageVolumeCreateXMLFrom)
      (storageVolumeGetXMLDesc): Likewise.
      64bd1b9d
  7. 08 7月, 2011 1 次提交
    • E
      util: drop unused safezero argument · 17da0669
      Eric Blake 提交于
      No caller was using the flags argument, and this function is internal
      only, so we might as well skip it.
      
      * src/util/util.h (safezero): Update signature.
      * src/util/util.c (safezero): Update function.
      * src/locking/lock_driver_sanlock.c
      (virLockManagerSanlockSetupLockspace)
      (virLockManagerSanlockCreateLease): Update all callers.
      * src/storage/storage_backend.c (createRawFile): Likewise.
      17da0669
  8. 04 7月, 2011 1 次提交
    • O
      storage: Do not override the exact error of createRawFile · 49826eda
      Osier Yang 提交于
      virStorageBackendCreateRaw: createRawFile already reported the
      exact error.
      
      Before the fix:
      
      error: Failed to create vol vol-create.img
      error: cannot create path '/var/lib/libvirt/images/vol-create.img': Unknown error 18446744073709551597
      
      After the fix:
      
      error: Failed to create vol vol-create.img
      error: cannot fill file '/var/lib/libvirt/images/vol-create.img': No space left on device
      49826eda
  9. 17 6月, 2011 1 次提交
    • D
      Fix errno return in safezero() · a8182206
      Daniel P. Berrange 提交于
      Most of the safezero() implementations return -1 on error,
      setting errno. The safezero() impl using posix_fallocate()
      though returned a positive errno value on error (due to
      the unusual API contract of posix_fallocate() compared to
      most syscall APIs).
      
      * src/util/util.c: Ensure safezero() returns -1 and sets
        errno on error.
      * src/storage/storage_backend.c: Change safezero != 0 to
        < 0 for detecting errors
      a8182206
  10. 14 6月, 2011 1 次提交
  11. 01 6月, 2011 1 次提交
    • C
      storage: List directory volumes for dir/fs/netfs pools · 8077d64f
      Cole Robinson 提交于
      Since directories can be used for <filesystem> passthrough, they are
      basically storage volumes.
      
      v2:
          Skip ., .., lost+found dirs
      
      v3:
          Use gnulib last_component
      
      v4:
          Use gnulib "dirname.h", not system <dirname.h>
          Don't skip lost+found
      8077d64f
  12. 24 5月, 2011 2 次提交
  13. 23 5月, 2011 1 次提交
  14. 17 5月, 2011 3 次提交
  15. 14 5月, 2011 1 次提交
  16. 12 4月, 2011 1 次提交
    • E
      maint: fix grammar errors · 99fa3080
      Eric Blake 提交于
      Jim Meyering recently improved gnulib to catch various grammar
      errors during 'make syntax-check'.
      
      * .gnulib: Update to latest, for syntax-check improvements.
      * include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
      cannot rather than two words.
      * src/driver.c: Likewise.
      * src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
      * src/remote/remote_driver.c (initialize_gnutls): Likewise.
      * src/util/pci.c (pciBindDeviceToStub): Likewise.
      * src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
      Likewise.
      (virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
      * docs/formatdomain.html.in: Likewise.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
      (exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
      existing translation problems.
      99fa3080
  17. 05 4月, 2011 1 次提交
    • J
      Allow relative path for qemu backing file · 33da939b
      Jesse Cook 提交于
      This patch enables the relative backing file path support provided by
      qemu-img create.
      
      If a relative path is specified for the backing file, it is converted
      to an absolute path using the storage pool path. The absolute path is
      used to verify that the backing file exists. If the backing file exists,
      the relative path is allowed and will be provided to qemu-img create.
      33da939b
  18. 29 3月, 2011 3 次提交
    • E
      qemu, storage: improve type safety · 1a369dfb
      Eric Blake 提交于
      * src/storage/storage_backend.c (createRawFileOpHook): Change
      signature.
      (struct createRawFileOpHookData): Delete unused struct.
      (virStorageBackendCreateRaw): Adjust caller.
      * src/qemu/qemu_driver.c (struct fileOpHookData): Delete unused
      struct.
      (qemudDomainSaveFileOpHook): Rename...
      (qemuDomainSaveFileOpHook): ...and change signature.
      (qemudDomainSaveFlag): Adjust caller.
      1a369dfb
    • E
      util: rename virFileOperation to virFileOpenAs · 1fdd50f9
      Eric Blake 提交于
      This patch intentionally doesn't change indentation, in order to
      make it easier to review the real changes.
      
      * src/util/util.h (VIR_FILE_OP_RETURN_FD, virFileOperationHook):
      Delete.
      (virFileOperation): Rename...
      (virFileOpenAs): ...and reduce parameters.
      * src/util/util.c (virFileOperationNoFork, virFileOperation):
      Rename and simplify.
      * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust caller.
      * src/storage/storage_backend.c (virStorageBackendCreateRaw):
      Likewise.
      * src/libvirt_private.syms: Reflect rename.
      1fdd50f9
    • E
      storage: simplify fd handling · fe303a42
      Eric Blake 提交于
      * src/storage/storage_backend.c (virStorageBackendCreateRaw): Use
      new virFileOperation flag.
      fe303a42
  19. 25 3月, 2011 1 次提交
    • E
      command: properly diagnose process exit via signal · 208a044a
      Eric Blake 提交于
      Child processes don't always reach _exit(); if they die from a
      signal, then any messages should still be accurate.  Most users
      either expect a 0 status (thankfully, if status==0, then
      WIFEXITED(status) is true and WEXITSTATUS(status)==0 for all
      known platforms) or were filtering on WIFEXITED before printing
      a status, but a few were missing this check.  Additionally,
      nwfilter_ebiptables_driver was making an assumption that works
      on Linux (where WEXITSTATUS shifts and WTERMSIG just masks)
      but fails on other platforms (where WEXITSTATUS just masks and
      WTERMSIG shifts).
      
      * src/util/command.h (virCommandTranslateStatus): New helper.
      * src/libvirt_private.syms (command.h): Export it.
      * src/util/command.c (virCommandTranslateStatus): New function.
      (virCommandWait): Use it to also diagnose status from signals.
      * src/security/security_apparmor.c (load_profile): Likewise.
      * src/storage/storage_backend.c
      (virStorageBackendQEMUImgBackingFormat): Likewise.
      * src/util/util.c (virExecDaemonize, virRunWithHook)
      (virFileOperation, virDirCreate): Likewise.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
      Likewise.
      208a044a
  20. 15 3月, 2011 1 次提交
  21. 10 3月, 2011 2 次提交
  22. 09 3月, 2011 1 次提交
    • C
      Don't overwrite virRun error messages · 91893014
      Cole Robinson 提交于
      virRun gives pretty useful error output, let's not overwrite it unless there
      is a good reason. Some places were providing more information about what
      the commands were _attempting_ to do, however that's usually less useful from
      a debugging POV than what actually happened.
      91893014
  23. 29 1月, 2011 1 次提交
    • M
      Add VIR_DIV_UP to divide memory or storage request sizes with round up · d9ad8ac3
      Matthias Bolte 提交于
      Use it in all places where a memory or storage request size is converted
      to a larger granularity. This avoids requesting too small memory or storage
      sizes that could result from the truncation done by a simple division.
      
      This extends the round up fix in 6002e040
      to the whole codebase.
      
      Instead of reporting errors for odd values in the VMX code round them up.
      
      Update the QEMU Argv tests accordingly as the original memory size 219200
      isn't a even multiple of 1024 and is rounded up to 215 megabyte now. Change
      it to 219100 and 219136. Use two different values intentionally to make
      sure that rounding up works.
      
      Update virsh.pod accordingly, as rounding down and rejecting are replaced
      by rounding up.
      d9ad8ac3
  24. 19 1月, 2011 1 次提交
  25. 21 12月, 2010 1 次提交
  26. 25 11月, 2010 1 次提交
    • E
      security, storage: plug memory leaks for security_context_t · d95488dc
      Eric Blake 提交于
      security_context_t happens to be a typedef for char*, and happens to
      begin with a string usable as a raw context string.  But in reality,
      it is an opaque type that may or may not have additional information
      after the first NUL byte, where that additional information can
      include pointers that can only be freed via freecon().
      
      Proof is from this valgrind run of daemon/libvirtd:
      
      ==6028== 839,169 (40 direct, 839,129 indirect) bytes in 1 blocks are definitely lost in loss record 274 of 274
      ==6028==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
      ==6028==    by 0x3022E0D48C: selabel_open (label.c:165)
      ==6028==    by 0x3022E11646: matchpathcon_init_prefix (matchpathcon.c:296)
      ==6028==    by 0x3022E1190D: matchpathcon (matchpathcon.c:317)
      ==6028==    by 0x4F9D842: SELinuxRestoreSecurityFileLabel (security_selinux.c:382)
      
      800k is a lot of memory to be leaking.
      
      * src/storage/storage_backend.c
      (virStorageBackendUpdateVolTargetInfoFD): Avoid leak on error.
      * src/security/security_selinux.c
      (SELinuxReserveSecurityLabel, SELinuxGetSecurityProcessLabel)
      (SELinuxRestoreSecurityFileLabel): Use correct function to free
      security_context_t.
      d95488dc
  27. 17 11月, 2010 1 次提交
    • 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
  28. 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
  29. 20 8月, 2010 1 次提交
    • 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
  30. 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
  31. 22 7月, 2010 3 次提交
    • 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
      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
  32. 20 7月, 2010 1 次提交
    • 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