Class: RbVmomi::VIM::Datastore::FakeDatastoreFile

Inherits:
Object
  • Object
show all
Includes:
RVC::InventoryObject
Defined in:
lib/rvc/extensions/Datastore.rb

Instance Attribute Summary collapse

Attributes included from RVC::InventoryObject

#rvc_arc, #rvc_parent

Instance Method Summary collapse

Methods included from RVC::InventoryObject

#children, included, #ls_text, #rvc_link, #rvc_path, #rvc_path_str, #traverse_one

Constructor Details

#initialize(datastore, path, info) ⇒ FakeDatastoreFile

Returns a new instance of FakeDatastoreFile.



154
155
156
157
158
# File 'lib/rvc/extensions/Datastore.rb', line 154

def initialize datastore, path, info
  @datastore = datastore
  @path = path
  @info = info
end

Instance Attribute Details

#datastoreObject (readonly)

Returns the value of attribute datastore.



152
153
154
# File 'lib/rvc/extensions/Datastore.rb', line 152

def datastore
  @datastore
end

#pathObject (readonly)

Returns the value of attribute path.



152
153
154
# File 'lib/rvc/extensions/Datastore.rb', line 152

def path
  @path
end

Instance Method Details

#datastore_pathObject



160
161
162
163
# File 'lib/rvc/extensions/Datastore.rb', line 160

def datastore_path
  @ds_name ||= @datastore.name
  "[#{@ds_name}] #{@path}"
end

#display_infoObject



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/rvc/extensions/Datastore.rb', line 171

def display_info
  puts "Datastore File"
  puts "datastore: #{@datastore.name}"
  puts "path: #{@path}"
  puts "size: #{@info.fileSize} bytes"
  case @info
  when RbVmomi::VIM::VmConfigFileInfo
    puts "config version: #{@info.configVersion}"
  when RbVmomi::VIM::VmDiskFileInfo
    puts "capacity: #{@info.capacityKb} KB"
    puts "hardware version: #{@info.hardwareVersion}"
    puts "controller type: #{@info.controllerType}"
    puts "thin provisioned: #{@info.thin}"
    puts "type: #{@info.diskType}"
    puts "extents:\n#{@info.diskExtents.map { |x| "  #{x}" } * "\n"}"
  end
end

#parentObject



165
166
167
168
169
# File 'lib/rvc/extensions/Datastore.rb', line 165

def parent
  els = path.split '/'
  parent_path = els[0...-1].join '/'
  RbVmomi::VIM::Datastore::FakeDatastoreFolder.new(@datastore, parent_path)
end