Sha256: 50b3a496e5f5f5ede5e162d625d50e694f49b2ed390eafe833f1f0df0878ceb3

Contents?: true

Size: 874 Bytes

Versions: 33

Compression:

Stored size: 874 Bytes

Contents

module Fog
  module Compute
    class Vsphere

      class Volume < Fog::Model
        DISK_SIZE_TO_GB = 1048576
        identity :id

        attribute :datastore
        attribute :mode
        attribute :size
        attribute :thin
        attribute :name
        attribute :filename
        attribute :size_gb

        def initialize(attributes={} )
          super defaults.merge(attributes)
        end

        def size_gb
          attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
        end

        def size_gb= s
          attributes[:size] = s.to_i * DISK_SIZE_TO_GB if s
        end

        def to_s
          name
        end

         private

        def defaults
          {
            :thin=>true,
            :name=>"Hard disk",
            :mode=>"persistent"
          }
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 9 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/vsphere/models/compute/volume.rb
fog-1.17.0 lib/fog/vsphere/models/compute/volume.rb
fog-1.16.0 lib/fog/vsphere/models/compute/volume.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/vsphere/models/compute/volume.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/vsphere/models/compute/volume.rb
fog-1.15.0 lib/fog/vsphere/models/compute/volume.rb
gapinc-fog-1.14.0 lib/fog/vsphere/models/compute/volume.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/vsphere/models/compute/volume.rb
fog-1.14.0 lib/fog/vsphere/models/compute/volume.rb
fog-1.13.0 lib/fog/vsphere/models/compute/volume.rb
gapinc-fog-1.12.1.2 lib/fog/vsphere/models/compute/volume.rb
gapinc-fog-1.12.1.1 lib/fog/vsphere/models/compute/volume.rb
gapinc-fog-1.12.1a lib/fog/vsphere/models/compute/volume.rb
gapinc-fog-1.12.1 lib/fog/vsphere/models/compute/volume.rb
fog-1.12.1 lib/fog/vsphere/models/compute/volume.rb
fog-1.12.0 lib/fog/vsphere/models/compute/volume.rb
hpfog-0.0.20 lib/fog/vsphere/models/compute/volume.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/vsphere/models/compute/volume.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/vsphere/models/compute/volume.rb
fog-nirvanix-1.8.2 lib/fog/vsphere/models/compute/volume.rb