Class: RbVmomi::VIM::Datastore::FakeDatastoreFile
- Inherits:
-
Object
- Object
- RbVmomi::VIM::Datastore::FakeDatastoreFile
- Includes:
- RVC::InventoryObject
- Defined in:
- lib/rvc/extensions/Datastore.rb
Instance Attribute Summary collapse
-
#datastore ⇒ Object
readonly
Returns the value of attribute datastore.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes included from RVC::InventoryObject
Instance Method Summary collapse
- #datastore_path ⇒ Object
- #display_info ⇒ Object
-
#initialize(datastore, path, info) ⇒ FakeDatastoreFile
constructor
A new instance of FakeDatastoreFile.
- #parent ⇒ Object
Methods included from RVC::InventoryObject
#children, included, #ls_text, #rvc_link, #rvc_path, #rvc_path_str, #rvc_relative_path, #rvc_relative_path_str, #traverse_one
Methods included from RVC::ObjectWithFields::ClassMethods
Methods included from RVC::ObjectWithFields
#field, #field_properties, #perfmetrics
Constructor Details
#initialize(datastore, path, info) ⇒ FakeDatastoreFile
Returns a new instance of FakeDatastoreFile.
159 160 161 162 163 |
# File 'lib/rvc/extensions/Datastore.rb', line 159 def initialize datastore, path, info @datastore = datastore @path = path @info = info end |
Instance Attribute Details
#datastore ⇒ Object (readonly)
Returns the value of attribute datastore.
157 158 159 |
# File 'lib/rvc/extensions/Datastore.rb', line 157 def datastore @datastore end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
157 158 159 |
# File 'lib/rvc/extensions/Datastore.rb', line 157 def path @path end |
Instance Method Details
#datastore_path ⇒ Object
165 166 167 168 |
# File 'lib/rvc/extensions/Datastore.rb', line 165 def datastore_path @ds_name ||= @datastore.name "[#{@ds_name}] #{@path}" end |
#display_info ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/rvc/extensions/Datastore.rb', line 176 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 |
#parent ⇒ Object
170 171 172 173 174 |
# File 'lib/rvc/extensions/Datastore.rb', line 170 def parent els = path.split '/' parent_path = els[0...-1].join '/' RbVmomi::VIM::Datastore::FakeDatastoreFolder.new(@datastore, parent_path) end |