bosh_vsphere_cpi/lib/cloud/vsphere/resources/scorer.rb
def consume_disk(pool, size, min)
        unless pool.empty?
          pool.sort! { |a, b| b <=> a }
          if pool[0] >= size + DISK_THRESHOLD
            pool[0] -= size
            pool.delete_at(0) if pool[0] < min + DISK_THRESHOLD
            return true
          end
        end
        false
      end
# Consumes disk space from a datastore pool.
#
# @param [Array<Integer>] pool datastore pool.
# @param [Integer] size requested disk size.
# @param [Integer] min requested disk size, so the datastore can be
#   removed from the pool if it falls below this threshold.
# @return [true, false] boolean indicating that the disk space was
#   consumed.
Consumes disk space from a datastore pool.
Consumes disk space from a datastore pool .
def consume_disk(pool, size, min)
        unless pool.empty?
          pool.sort! { |a, b| b <=> a }
          if pool[0] >= size + DISK_THRESHOLD
            pool[0] -= size
            pool.delete_at(0) if pool[0] < min + DISK_THRESHOLD
            return true
          end
        end
        false
      end
def consume_disk ( pool , size , min ) unless pool . empty? pool . sort! { | a , b | b <=> a } if pool [ 0 ] >= size + DISK_THRESHOLD pool [ 0 ] -= size pool . delete_at ( 0 ) if pool [ 0 ] < min + DISK_THRESHOLD return true end end false end
Consumes disk space from a datastore pool.
Consumes disk space from a datastore pool .
boolean indicating that the disk space was consumed.
boolean indicating that the disk space was consumed .
true, false
pool
size
min
min requested disk size, so the datastore can be removed from the pool if it falls below this threshold.
min requested disk size so the datastore can be removed from the pool if it falls below this threshold .