Class: MiqVimCluster

Inherits:
Object
  • Object
show all
Includes:
DRb::DRbUndumped, MiqBrokerObjRegistry, MiqBrokerVimConnectionCheck
Defined in:
lib/VMwareWebService/MiqVimCluster.rb,
lib/VMwareWebService/MiqVimBrokerMods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MiqBrokerVimConnectionCheck

#connectionRemoved?

Methods included from MiqBrokerObjRegistry

#holdBrokerObj, #registerBrokerObj, #unregisterBrokerObj

Constructor Details

#initialize(invObj, ch) ⇒ MiqVimCluster

Returns a new instance of MiqVimCluster.



4
5
6
7
8
9
10
11
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 4

def initialize(invObj, ch)
  @invObj   = invObj
  @sic    = invObj.sic

  @ch     = ch
  @name   = @ch["name"]
  @cMor   = @ch["MOR"]
end

Instance Attribute Details

#invObjObject (readonly)

Returns the value of attribute invObj.



2
3
4
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 2

def invObj
  @invObj
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 2

def name
  @name
end

Instance Method Details

#addHost(hostName, userName, password, *args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 25

def addHost(hostName, userName, password, *args)
  ah = {:force => false, :wait => true, :asConnected => true}

  if args.length == 1 && args.first.kind_of?(Hash)
    ah.merge!(args.first)
  elsif args.length > 1
    ah.merge!(Hash[*args])
  end

  cspec = VimHash.new('HostConnectSpec') do |cs|
    cs.force        = ah[:force].to_s
    cs.hostName       = hostName
    cs.userName       = userName
    cs.password       = password
    cs.managementIp     = ah[:managementIp]     unless ah[:managementIp].nil?
    cs.port         = ah[:port]         unless ah[:port].nil?
    cs.sslThumbprint    = ah[:sslThumbprint]    unless ah[:sslThumbprint].nil?
    cs.vimAccountName   = ah[:vimAccountName]   unless ah[:vimAccountName].nil?
    cs.vimAccountPassword = ah[:vimAccountPassword] unless ah[:vimAccountPassword].nil?
    cs.vmFolder       = ah[:vmFolder]       unless ah[:vmFolder].nil?
  end

  $vim_log.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addHost: calling addHost_Task" if $vim_log
  taskMor = @invObj.addHost_Task(@cMor, cspec, ah[:asConnected].to_s, ah[:resourcePool], ah[:license])
  $vim_log.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addHost: returned from addHost_Task" if $vim_log
  return taskMor unless ah[:wait]
  waitForTask(taskMor)
end

#chObject



21
22
23
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 21

def ch
  (@ch)
end

#cMorObject



17
18
19
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 17

def cMor
  (@cMor)
end

#releaseObject Also known as: release_orig



13
14
15
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 13

def release
  # @invObj.releaseObj(self)
end

#waitForTask(tmor) ⇒ Object

def addHost



54
55
56
# File 'lib/VMwareWebService/MiqVimCluster.rb', line 54

def waitForTask(tmor)
  @invObj.waitForTask(tmor, self.class.to_s)
end