1. 29 5月, 2015 2 次提交
    • J
      storage: Don't adjust pool alloc/avail values for disk backend · 48809204
      John Ferlan 提交于
      Commit id '2ac0e647' for https://bugzilla.redhat.com/show_bug.cgi?id=1206521
      was meant to be a generic check for the CreateVol, CreateVolFrom, and
      DeleteVol paths to check if the storage backend's changed the pool's view
      of allocation or available values.
      
      Unfortunately as it turns out this caused a side effect when the disk backend
      created an extended partition there would be no actual storage removed from
      the pool, thus the changes would not find any change in allocation or
      available and incorrectly update the pool values using the size of the
      extended partition. A subsequent refresh of the pool would reset the
      values appropriately.
      
      This patch modifies those checks in order to specifically not update the
      pool allocation and available for only the disk backend rather than be
      generic before and after checks.
      48809204
    • J
      Revert "storage: Don't duplicate efforts of backend driver" · 6727bfd7
      John Ferlan 提交于
      This reverts commit 2ac0e647.
      6727bfd7
  2. 28 5月, 2015 2 次提交
    • J
      Fix shrinking volumes with the delta flag · 8b316fe5
      Ján Tomko 提交于
      This never worked.
      
      In 0.9.10 when this API was introduced, it was intended that
      the SHRINK flag combined with DELTA would shrink the volume by
      the specified capacity (to avoid passing negative numbers).
      See commit 055bbf45.
      
      When the SHRINK flag was finally implemented for the first backend
      in 1.2.13 (commit aa9aa6a9), it was only implemented for the absolute
      values and with the delta flag the volume is always extended,
      regardless of the SHRINK flag.
      
      Treat the SHRINK flag as a minus sign when used together with DELTA,
      to allow shrinking volumes as was documented in the API since 0.9.10.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1220213
      8b316fe5
    • J
      Simplify allocation check in storageVolResize · 7211f66a
      Ján Tomko 提交于
      Since shrinking a volume below existing allocation is not allowed,
      it is not possible for a successful resize with VOL_RESIZE_ALLOCATE
      to increase the pool's available value.
      
      Even with the SHRINK flag it is possible to extend the current
      allocation or even the capacity. Remove the overflow when
      computing delta with this flag and do the check even if the
      flag was specified.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1073305
      7211f66a
  3. 27 5月, 2015 1 次提交
  4. 26 5月, 2015 2 次提交
    • C
      storage: fs: Only force directory permissions if required · db1140f1
      Cole Robinson 提交于
      Only set directory permissions at pool build time, if:
      
      - User explicitly requested a mode via the XML
      - The directory needs to be created
      - We need to do the crazy NFS root-squash workaround
      
      This allows qemu:///session to call build on an existing directory
      like /tmp.
      db1140f1
    • C
      storage: conf: Don't set any default <mode> in the XML · 7c2d65dd
      Cole Robinson 提交于
      The XML parser sets a default <mode> if none is explicitly passed in.
      This is then used at pool/vol creation time, and unconditionally reported
      in the XML.
      
      The problem with this approach is that it's impossible for other code
      to determine if the user explicitly requested a storage mode. There
      are some cases where we want to make this distinction, but we currently
      can't.
      
      Handle <mode> parsing like we handle <owner>/<group>: if no value is
      passed in, set it to -1, and adjust the internal consumers to handle
      it.
      7c2d65dd
  5. 24 5月, 2015 1 次提交
  6. 20 5月, 2015 1 次提交
  7. 05 5月, 2015 2 次提交
  8. 04 5月, 2015 1 次提交
  9. 30 4月, 2015 1 次提交
  10. 28 4月, 2015 5 次提交
  11. 27 4月, 2015 1 次提交
  12. 21 4月, 2015 5 次提交
    • J
      scsi: Adjust return values from processLU · 98322052
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1171933
      
      Adjust the processLU error returns to be a bit more logical. Currently,
      the calling code cannot determine the difference between a non disk/lun
      volume and a processed/found disk/lun. It can also not differentiate
      between perhaps real/fatal error and one that won't necessarily stop
      the code from finding other volumes.
      
      After this patch virStorageBackendSCSIFindLUsInternal will stop processing
      as soon as a "fatal" message occurs rather than continuting processing
      for no apparent reason. It will also only set the *found value when
      at least one of the processLU's was successful.
      
      With the failed return, if the reason for the stop was that the pool
      target path did not exist, was /dev, was /dev/, or did not start with
      /dev, then iSCSI pool startup and refresh will fail.
      98322052
    • J
      scsi: Change return values for virStorageBackendSCSIFindLUs · 1e13eff4
      John Ferlan 提交于
      Rather than passing/returning a pointer to a boolean to indicate that
      perhaps we should try again - adjust the return of the call to return
      the count of LU's found during processing, then let the caller decide
      what to do with that value.
      1e13eff4
    • J
      scsi: Adjust return value for virStorageBackendSCSINewLun · adb182fa
      John Ferlan 提交于
      Use virStorageBackendPoolUseDevPath API to determine whether creation of
      stable target path is possible for the volume.
      
      This will differentiate a failed virStorageBackendStablePath which won't
      need to be fatal. Thus, we'll add a -2 return value to differentiate that
      the failure was a result of either the inability to find the symlink for
      the device or failure to open the target path directory
      adb182fa
    • J
      storage: Fix check for stable path check · 9e5e1ca1
      John Ferlan 提交于
      Fix the if (!STRPREFIX(path, "/dev")) to be if (!STRPREFIX(path, "/dev/"))
      to ensure a path such as "/device" isn't declared stable.
      9e5e1ca1
    • J
      storage: Split out the stable path check · 9126161d
      John Ferlan 提交于
      For virStorageBackendStablePath, in order to make decisions in other code
      split out the checks regarding whether the pool's target is empty, using /dev,
      using /dev/, or doesn't start with /dev
      9126161d
  13. 17 4月, 2015 1 次提交
  14. 16 4月, 2015 1 次提交
  15. 13 4月, 2015 3 次提交
  16. 10 4月, 2015 3 次提交
    • J
      storage: Don't duplicate efforts of backend driver · 2ac0e647
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1206521
      
      If the backend driver updates the pool available and/or allocation values,
      then the storage_driver VolCreateXML, VolCreateXMLFrom, and VolDelete APIs
      should not change the value; otherwise, it will appear as if the values
      were "doubled" for each change.  Additionally since unsigned arithmetic will
      be used depending on the size and operation, either or both values could be
      appear to be much larger than they should be (in the EiB range).
      
      Currently only the disk pool updates the values, but other pools could.
      Assume a "fresh" disk pool of 500 MiB using /dev/sde:
      
      $ virsh pool-info disk-pool
      ...
      Capacity:       509.88 MiB
      Allocation:     0.00 B
      Available:      509.84 MiB
      
      $ virsh vol-create-as disk-pool sde1 --capacity 300M
      
      $ virsh pool-info disk-pool
      ...
      Capacity:       509.88 MiB
      Allocation:     600.47 MiB
      Available:      16.00 EiB
      
      Following assumes disk backend updated to refresh the disk pool at deletion
      of primary partition as well as extended partition:
      
      $ virsh vol-delete --pool disk-pool sde1
      Vol sde1 deleted
      
      $ virsh pool-info disk-pool
      ...
      Capacity:       509.88 MiB
      Allocation:     9.73 EiB
      Available:      6.27 EiB
      
      This patch will check if the backend updated the pool values and honor that
      update.
      2ac0e647
    • J
      storage: Need to update freeExtent at delete primary partition · 1ffd82bb
      John Ferlan 提交于
      Commit id '471e1c4e' only considered updating the pool if the extended
      partition was removed. As it turns out removing a primary partition
      would also need to update the freeExtent list otherwise the following
      sequence would fail (assuming a "fresh" disk pool for /dev/sde of 500M):
      
      $  virsh pool-info disk-pool
      ...
      Capacity:       509.88 MiB
      Allocation:     0.00 B
      Available:      509.84 MiB
      
      $ virsh vol-create-as disk-pool sde1 --capacity 300M
      $ virsh vol-delete --pool disk-pool sde1
      $ virsh vol-create-as disk-pool sde1 --capacity 300M
      error: Failed to create vol sde1
      error: internal error: no large enough free extent
      
      $
      
      This patch will refresh the pool, rereading the partitions, and
      return
      1ffd82bb
    • J
      storage: Fix issues in storageVolResize · 1095230d
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1073305
      
      When creating a volume in a pool, the creation allows the 'capacity'
      value to be larger than the available space in the pool. As long as
      the 'allocation' value will fit in the space, the volume will be created.
      
      However, resizing the volume checks were made with the new absolute
      capacity value against existing capacity + the available space without
      regard for whether the new absolute capacity was actually allocating
      space or not.  For example, a pool with 75G of available space creates
      a volume of 10G using a capacity of 100G and allocation of 10G will succeed;
      however, if the allocation used a capacity of 10G instead and then tried
      to resize the allocation to 100G the code would fail to allow the backend
      to try the resize.
      
      Furthermore, when updating the pool "available" and "allocation" values,
      the resize code would just "blindly" adjust them regardless of whether
      space was "allocated" or just "capacity" was being adjusted.  This left
      a scenario whereby a resize to 100G would fail; however, a resize to 50G
      followed by one to 100G would both succeed.  Again, neither was adjusting
      the allocation value, just the "capacity" value.
      
      This patch adds more logic to the resize code to understand whether the
      new capacity value is actually "allocating" space as well and whether it
      shrinking or expanding. Since unsigned arithmatic is involved, the possibility
      that we adjust the pool size values incorrectly is probable.
      
      This patch also ensures that updates to the pool values only occur if we
      actually performed the allocation.
      
      NB: The storageVolDelete, storageVolCreateXML, and storageVolCreateXMLFrom
      each only updates the pool allocation/availability values by the target
      volume allocation value.
      1095230d
  17. 07 4月, 2015 3 次提交
    • E
      storage: Introduce storagePoolUpdateAllState function · 2a31c5f0
      Erik Skultety 提交于
      The 'checkPool' callback was originally part of the storageDriverAutostart function,
      but the pools need to be checked earlier during initialization phase,
      otherwise we can't start a domain which mounts a volume after the
      libvirtd daemon restarted. This is because qemuProcessReconnect is called
      earlier than storageDriverAutostart. Therefore the 'checkPool' logic has been
      moved to storagePoolUpdateAllState which is called inside storageDriverInitialize.
      
      We also need a valid 'conn' reference to be able to execute 'refreshPool'
      during initialization phase. Though it isn't available until storageDriverAutostart
      all of our storage backends do ignore 'conn' pointer, except for RBD,
      but RBD doesn't support 'checkPool' callback, so it's safe to pass
      conn = NULL in this case.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177733
      2a31c5f0
    • E
      conf: Introduce virStoragePoolLoadAllState && virStoragePoolLoadState · a9700771
      Erik Skultety 提交于
      These functions operate exactly the same as their network equivalents
      virNetworkLoadAllState, virNetworkLoadState.
      a9700771
    • E
      storage: Add support for storage pool state XML · 723143a1
      Erik Skultety 提交于
      This patch introduces new virStorageDriverState element stateDir.
      Also adds necessary changes to storageStateInitialize, so that
      directories initialization becomes more generic.
      723143a1
  18. 02 4月, 2015 4 次提交
  19. 13 3月, 2015 1 次提交
    • J
      Introduce virBitmapIsBitSet · 22fd3ac3
      Ján Tomko 提交于
      A helper that never returns an error and treats bits out of bitmap range
      as false.
      
      Use it everywhere we use ignore_value on virBitmapGetBit, or loop over
      the bitmap size.
      22fd3ac3