Class: MiqHostDatastoreSystem
- Inherits:
-
Object
- Object
- MiqHostDatastoreSystem
- Includes:
- DRb::DRbUndumped, MiqBrokerVimConnectionCheck
- Defined in:
- lib/VMwareWebService/MiqVimBrokerMods.rb,
lib/VMwareWebService/MiqHostDatastoreSystem.rb
Instance Attribute Summary collapse
-
#invObj ⇒ Object
readonly
Returns the value of attribute invObj.
Instance Method Summary collapse
-
#addNasDatastoreByName(dsName, accessMode = "readWrite") ⇒ Object
Utility method to add an existing NAS datastore to the host in question.
- #capabilities ⇒ Object
- #createNasDatastore(remoteHost, remotePath, localPath, accessMode = "readWrite", type = "nfs", userName = nil, password = nil) ⇒ Object
- #datastore ⇒ Object
-
#initialize(dssMor, invObj) ⇒ MiqHostDatastoreSystem
constructor
A new instance of MiqHostDatastoreSystem.
Methods included from MiqBrokerVimConnectionCheck
Constructor Details
#initialize(dssMor, invObj) ⇒ MiqHostDatastoreSystem
Returns a new instance of MiqHostDatastoreSystem.
4 5 6 7 |
# File 'lib/VMwareWebService/MiqHostDatastoreSystem.rb', line 4 def initialize(dssMor, invObj) @invObj = invObj @dssMor = dssMor end |
Instance Attribute Details
#invObj ⇒ Object (readonly)
Returns the value of attribute invObj.
2 3 4 |
# File 'lib/VMwareWebService/MiqHostDatastoreSystem.rb', line 2 def invObj @invObj end |
Instance Method Details
#addNasDatastoreByName(dsName, accessMode = "readWrite") ⇒ Object
Utility method to add an existing NAS datastore to the host in question.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/VMwareWebService/MiqHostDatastoreSystem.rb', line 33 def addNasDatastoreByName(dsName, accessMode = "readWrite") if (dsh = @invObj.dataStoresByFilter_local("summary.name" => dsName).first).nil? raise "MiqHostDatastoreSystem.addNasDatastoreByName: datastore #{sdName} not found" end unless dsh.summary.type.casecmp('nfs') == 0 || dsh.summary.type.casecmp('nas') == 0 raise "MiqHostDatastoreSystem.addNasDatastoreByName: datastore #{dsName} is not NAS" end remoteHost = dsh.info.nas.remoteHost remotePath = dsh.info.nas.remotePath localPath = dsh.info.nas.name type = dsh.info.nas.type $vim_log.info "MiqHostDatastoreSystem.addNasDatastoreByName: remoteHost = #{remoteHost}, remotePath = #{remotePath}, localPath = #{localPath}" createNasDatastore(remoteHost, remotePath, localPath, accessMode, type) end |
#capabilities ⇒ Object
9 10 11 |
# File 'lib/VMwareWebService/MiqHostDatastoreSystem.rb', line 9 def capabilities @capabilities ||= @invObj.getMoProp(@dssMor, 'capabilities')['capabilities'] end |
#createNasDatastore(remoteHost, remotePath, localPath, accessMode = "readWrite", type = "nfs", userName = nil, password = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/VMwareWebService/MiqHostDatastoreSystem.rb', line 17 def createNasDatastore(remoteHost, remotePath, localPath, accessMode = "readWrite", type = "nfs", userName = nil, password = nil) spec = VimHash.new('HostNasVolumeSpec') do |s| s.remoteHost = remoteHost s.remotePath = remotePath s.localPath = localPath s.accessMode = accessMode s.type = type s.userName = userName s.password = password end @invObj.createNasDatastore(@dssMor, spec) end |
#datastore ⇒ Object
13 14 15 |
# File 'lib/VMwareWebService/MiqHostDatastoreSystem.rb', line 13 def datastore @invObj.getMoProp(@dssMor, 'datastore')['datastore'] end |