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.
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, #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
#datastore ⇒ Object (readonly)
Returns the value of attribute datastore.
152 153 154 |
# File 'lib/rvc/extensions/Datastore.rb', line 152 def datastore @datastore end |
#path ⇒ Object (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_path ⇒ Object
160 161 162 163 |
# File 'lib/rvc/extensions/Datastore.rb', line 160 def datastore_path @ds_name ||= @datastore.name "[#{@ds_name}] #{@path}" end |
#display_info ⇒ Object
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 |
#parent ⇒ Object
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 |