1. 27 9月, 2017 3 次提交
    • J
      Shrink volume even with ALLOCATE flag · 959fe7de
      Ján Tomko 提交于
      Calling fallocate on the new (smaller) capacity ensures
      that the whole file is allocated, but it does not reduce
      the file size.
      
      Also call ftruncate after fallocate.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1366446
      959fe7de
    • J
      virStorageFileResize: fallocate the whole capacity · 3f702f5a
      Ján Tomko 提交于
      We have been trying to implement the ALLOCATE flag to mean
      "the volume should be fully allocated after the resize".
      
      Since commit b0579ed9 we do not allocate from the existing
      capacity, but from the existing allocation value.
      However this value is a total of all the allocated bytes,
      not an offset.
      
      For a sparsely allocated file:
      $ perl -e 'print "x"x8192;' > vol1
      $ fallocate -p -o 0 -l 4096 vol1
      $ virsh vol-info vol1 default
      Capacity:       8.00 KiB
      Allocation:     4.00 KiB
      
      Treating allocation as an offset would result in an incompletely
      allocated file:
      $ virsh vol-resize vol1 --pool default 16384 --allocate
      Capacity:       16.00 KiB
      Allocation:     12.00 KiB
      
      Call fallocate from zero on the whole requested capacity to fully
      allocate the file. After that, the volume is fully allocated
      after the resize:
      $ virsh vol-resize vol1 --pool default 16384 --allocate
      $ virsh vol-info vol1 default
      Capacity:       16.00 KiB
      Allocation:     16.00 KiB
      3f702f5a
    • J
      use virFileAllocate in virStorageFileResize · 5463d959
      Ján Tomko 提交于
      Introduce a new function virFileAllocate that will call the
      non-destructive variants of safezero, essentially reverting
      my commit 1390c268
          safezero: fall back to writing zeroes even when resizing
      back to the state as of commit 18f03166
          virstoragefile: Have virStorageFileResize use safezero
      
      This means that _ALLOCATE flag will no longer work on platforms
      without the allocate syscalls, but it will not overwrite data
      either.
      5463d959
  2. 22 9月, 2017 1 次提交
  3. 20 9月, 2017 2 次提交
  4. 12 9月, 2017 1 次提交
  5. 27 7月, 2017 1 次提交
  6. 24 7月, 2017 2 次提交
  7. 14 7月, 2017 3 次提交
  8. 11 7月, 2017 3 次提交
  9. 24 6月, 2017 1 次提交
    • J
      util: Force reading of meta data to get encryption capacity value · 5431055d
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1371892
      
      As it turns out the volume create, build, and refresh path was not peeking
      at the meta data, so immediately after a create operation the value displayed
      for capacity was still incorrect. However, if a pool refresh was done the
      correct value was fetched as a result of a meta data peek.
      
      The reason is it seems historically if the file type is RAW then peeking
      at the file just took the physical value for the capacity. However, since
      we know if it's an encrypted file, then peeking at the meta data will be
      required in order to get a true capacity value.
      
      So check for encryption in the source and if present, use the meta data
      in order to fill in the capacity value and set the payload_offset.
      5431055d
  10. 20 6月, 2017 10 次提交
  11. 19 6月, 2017 3 次提交
  12. 02 6月, 2017 2 次提交
  13. 15 5月, 2017 1 次提交
  14. 05 4月, 2017 1 次提交
  15. 04 4月, 2017 1 次提交
    • J
      storage: Fix capacity value for LUKS encrypted volumes · b7d44f45
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1371892
      
      The 'capacity' value (e.g. guest logical size) for a LUKS volume is
      smaller than the 'physical' value of the file in the file system, so
      we need to account for that.
      
      When peeking at the encryption information about the volume add a fetch
      of the payload_offset which is described as the offset to the start of
      the volume data (in 512 byte sectors) in QEMU's QCryptoBlockLUKSHeader.
      
      Then adjust the ->capacity appropriately when we determine that the
      volume target encryption has a payload_offset value.
      b7d44f45
  16. 27 3月, 2017 4 次提交
    • E
      util: fix build on RHEL 6 · 04419847
      Eric Blake 提交于
      We keep forgetting that older setups don't like 'index':
      
        CC     util/libvirt_util_la-virsysinfo.lo
      cc1: warnings being treated as errors
      util/virstoragefile.c: In function 'virStorageSourceFindByNodeName':
      util/virstoragefile.c:3804: error: declaration of 'index' shadows a global declaration [-Wshadow]
      /usr/include/string.h:489: error: shadowed declaration is here [-Wshadow]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      04419847
    • M
      Fix build with GCC's static analysis · eec3b255
      Martin Kletzander 提交于
      STREQ_NULLABLE returns true if both parameters are NULL.  And that's
      not what we want here.  We just want to skop comparing source nodes
      that don't have that info set.  The function wouldn't make much sense
      with nodeName == NULL, so we don't need to check that.  Moreover, the
      function's declaration uses ATTRIBUDE_NONNULL for nodeName, which not
      only means that function expects the parameter not to be NULL, but
      actually tells the compiler that it can optimize out the NULL checks.
      That way it could end up calling strcmp on NULL (either nodeformat or
      nodebacking).  GCC figures this out if libvirt is compiled with
      lv_cv_static_analysis=yes, unfortunately not everyone uses that.
      
      Caused by cbc6d535.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      eec3b255
    • P
      util: storage: Add variables for node names into virStorageSource · cbc6d535
      Peter Krempa 提交于
      'nodeformat' should be used for strings which describe the storage
      format object, and 'nodebacking' for the actual storage object itself.
      cbc6d535
    • P
      util: storage: Split out useful bits of virStorageFileParseChainIndex · ad36f385
      Peter Krempa 提交于
      The function has very specific semantics. Split out the part that parses
      the backing store specification string into a separate helper so that it
      can be reused later while keeping the wrapper with existing semantics.
      
      Note that virStorageFileParseChainIndex is pretty well covered by the
      test suite.
      ad36f385
  17. 22 2月, 2017 1 次提交