Class: MiqVimHost
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#advancedOptionManager ⇒ Object
-
#cfManager ⇒ Object
-
#configManager(mgr_type = nil) ⇒ Object
-
#datastoreSystem ⇒ Object
-
#dvsConfig(refresh = false) ⇒ Object
Distributed virtual switch methods.
-
#dvsPortGroupByFilter(filter, refresh = false) ⇒ Object
-
#dvsSwitchByFilter(filter, refresh = false) ⇒ Object
-
#enterMaintenanceMode(timeout = 0, evacuatePoweredOffVms = false, wait = true) ⇒ Object
-
#exitMaintenanceMode(timeout = 0, wait = true) ⇒ Object
-
#fileSystemVolume(selSpec = nil) ⇒ Object
-
#firewallSystem ⇒ Object
-
#hh ⇒ Object
-
#hMor ⇒ Object
-
#hostConfigSpec ⇒ Object
-
#hostVirtualNicManager ⇒ Object
-
#initialize(invObj, hh) ⇒ MiqVimHost
constructor
A new instance of MiqVimHost.
-
#inMaintenanceMode? ⇒ Boolean
-
#maintenanceModeSupported? ⇒ Boolean
-
#networkSystem ⇒ Object
-
#nfsSupported? ⇒ Boolean
-
#powerDownHostToStandBy(timeout = 0, evacuatePoweredOffVms = false, wait = true) ⇒ Object
-
#powerState ⇒ Object
-
#powerUpHostFromStandBy(timeout = 0, wait = true) ⇒ Object
-
#quickStats ⇒ Object
-
#rebootHost(force = false, wait = true) ⇒ Object
-
#rebootSupported? ⇒ Boolean
-
#release ⇒ Object
(also: #release_orig)
-
#sanSupported? ⇒ Boolean
-
#serviceSystem ⇒ Object
-
#setCustomField(name, value) ⇒ Object
-
#shutdownHost(force = false, wait = true) ⇒ Object
-
#shutdownSupported? ⇒ Boolean
-
#snmpSystem ⇒ Object
-
#standbySupported? ⇒ Boolean
-
#storageDevice(selSpec = nil) ⇒ Object
-
#storageSystem ⇒ Object
-
#storageVMotionSupported? ⇒ Boolean
-
#vmotionSupported? ⇒ Boolean
-
#vmotionWithStorageVMotionSupported? ⇒ Boolean
-
#waitForTask(tmor) ⇒ Object
#connectionRemoved?
#holdBrokerObj, #registerBrokerObj, #unregisterBrokerObj
Constructor Details
#initialize(invObj, hh) ⇒ MiqVimHost
Returns a new instance of MiqVimHost.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 19
def initialize(invObj, hh)
@invObj = invObj
@sic = invObj.sic
@cfManager = nil
@configManager = nil
@datastoreSystem = nil
@storageSystem = nil
@firewallSystem = nil
@serviceSystem = nil
@networkSystem = nil
@hostVirtualNicManager = nil
@advancedOptionManager = nil
@snmpSystem = nil
@dvsConfig = nil
@hh = hh
@name = hh['summary']['config']['name']
@hMor = hh['summary']['host']
end
|
Instance Attribute Details
#invObj ⇒ Object
Returns the value of attribute invObj.
17
18
19
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 17
def invObj
@invObj
end
|
#name ⇒ Object
Returns the value of attribute name.
17
18
19
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 17
def name
@name
end
|
Instance Method Details
#advancedOptionManager ⇒ Object
211
212
213
214
215
216
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 211
def advancedOptionManager
return @advancedOptionManager if @advancedOptionManager
return nil unless (ao = configManager('advancedOption'))
@advancedOptionManager = MiqHostAdvancedOptionManager.new(ao, @invObj)
@advancedOptionManager
end
|
#cfManager ⇒ Object
280
281
282
283
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 280
def cfManager
@cfManager = @invObj.getMiqCustomFieldsManager unless @cfManager
@cfManager
end
|
#configManager(mgr_type = nil) ⇒ Object
158
159
160
161
162
163
164
165
166
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 158
def configManager(mgr_type = nil)
if @configManager.nil?
mgr = @invObj.getMoProp(@hMor, "configManager")
@configManager = mgr['configManager'] unless mgr.nil?
end
return @configManager[mgr_type] if mgr_type && @configManager
@configManager
end
|
#datastoreSystem ⇒ Object
168
169
170
171
172
173
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 168
def datastoreSystem
return @datastoreSystem if @datastoreSystem
return nil unless (dss = configManager('datastoreSystem'))
@datastoreSystem = MiqHostDatastoreSystem.new(dss, @invObj)
@datastoreSystem
end
|
#dvsConfig(refresh = false) ⇒ Object
Distributed virtual switch methods.
294
295
296
297
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 294
def dvsConfig(refresh = false)
return @dvsConfig unless refresh || !@dvsConfig
@dvsConfig = @invObj.queryDvsConfigTarget(@invObj.sic.dvSwitchManager, @hMor, nil)
end
|
#dvsPortGroupByFilter(filter, refresh = false) ⇒ Object
299
300
301
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 299
def dvsPortGroupByFilter(filter, refresh = false)
@invObj.applyFilter(dvsConfig(refresh).distributedVirtualPortgroup, filter)
end
|
#dvsSwitchByFilter(filter, refresh = false) ⇒ Object
303
304
305
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 303
def dvsSwitchByFilter(filter, refresh = false)
@invObj.applyFilter(dvsConfig(refresh).distributedVirtualSwitch, filter)
end
|
#enterMaintenanceMode(timeout = 0, evacuatePoweredOffVms = false, wait = true) ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 110
def enterMaintenanceMode(timeout = 0, evacuatePoweredOffVms = false, wait = true)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: calling enterMaintenanceMode_Task" if $vim_log
taskMor = @invObj.enterMaintenanceMode_Task(@hMor, timeout, evacuatePoweredOffVms)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: returned from enterMaintenanceMode_Task" if $vim_log
return taskMor unless wait
waitForTask(taskMor)
end
|
#exitMaintenanceMode(timeout = 0, wait = true) ⇒ Object
118
119
120
121
122
123
124
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 118
def exitMaintenanceMode(timeout = 0, wait = true)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: calling exitMaintenanceMode_Task" if $vim_log
taskMor = @invObj.exitMaintenanceMode_Task(@hMor, timeout)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: returned from exitMaintenanceMode_Task" if $vim_log
return taskMor unless wait
waitForTask(taskMor)
end
|
#fileSystemVolume(selSpec = nil) ⇒ Object
256
257
258
259
260
261
262
263
264
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 256
def fileSystemVolume(selSpec = nil)
if selSpec.nil?
return @invObj.getMoProp(@hMor, "config.fileSystemVolume")
else
propPath = @invObj.selSpecToPropPath(selSpec)
sd = @invObj.getMoProp(@hMor, propPath)
return @invObj.applySelector(sd, selSpec)
end
end
|
#firewallSystem ⇒ Object
182
183
184
185
186
187
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 182
def firewallSystem
return @firewallSystem if @firewallSystem
return nil unless (fws = configManager('firewallSystem'))
@firewallSystem = MiqHostFirewallSystem.new(fws, @invObj)
@firewallSystem
end
|
#hh ⇒ Object
48
49
50
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 48
def hh
(@hh)
end
|
#hMor ⇒ Object
44
45
46
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 44
def hMor
(@hMor)
end
|
#hostConfigSpec ⇒ Object
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 225
def hostConfigSpec
VimHash.new('HostConfigSpec') do |hcs|
hcs.datastorePrincipal = @hh.config.datastorePrincipal if @hh.config.datastorePrincipal
hcs.firewall = VimHash.new('HostFirewallConfig') do |hfc|
fi = firewallSystem.firewallInfo
hfc.defaultBlockingPolicy = fi.defaultPolicy
hfc.rule = VimArray.new('ArrayOfHostFirewallConfigRuleSetConfig') do |hfcrca|
fi.ruleset.each do |rs|
hfcrca << VimHash.new('HostFirewallConfigRuleSetConfig') do |hfcrc|
hfcrc.enabled = rs.enabled
hfcrc.rulesetId = rs.key
end
end
end
end
hcs.service = VimArray.new('ArrayOfHostServiceConfig') do |hsca|
serviceSystem.serviceInfo.service.each do |svc|
hsca << VimHash.new('HostServiceConfig') do |hsc|
hsc.serviceId = svc.key
hsc.startupPolicy = svc.policy
end
end
end
hcs.nicTypeSelection = VimArray.new('ArrayOfHostVirtualNicManagerNicTypeSelection') do |_hvnmntsa|
end
end
end
|
#hostVirtualNicManager ⇒ Object
203
204
205
206
207
208
209
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 203
def hostVirtualNicManager
raise "hostVirtualNicManager not supported in VIM #{@invObj.apiVersion}" if @invObj.v2
return @hostVirtualNicManager if @hostVirtualNicManager
return nil unless (vns = configManager('virtualNicManager'))
@hostVirtualNicManager = MiqHostVirtualNicManager.new(vns, @invObj)
@hostVirtualNicManager
end
|
#inMaintenanceMode? ⇒ Boolean
102
103
104
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 102
def inMaintenanceMode?
@invObj.getMoProp(@hMor, "runtime.inMaintenanceMode")['runtime']['inMaintenanceMode'] == "true"
end
|
#maintenanceModeSupported? ⇒ Boolean
56
57
58
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 56
def maintenanceModeSupported?
capabilityBool("maintenanceModeSupported")
end
|
#networkSystem ⇒ Object
196
197
198
199
200
201
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 196
def networkSystem
return @networkSystem if @networkSystem
return nil unless (ns = configManager('networkSystem'))
@networkSystem = MiqHostNetworkSystem.new(ns, @invObj)
@networkSystem
end
|
#nfsSupported? ⇒ Boolean
60
61
62
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 60
def nfsSupported?
capabilityBool("nfsSupported")
end
|
#powerDownHostToStandBy(timeout = 0, evacuatePoweredOffVms = false, wait = true) ⇒ Object
126
127
128
129
130
131
132
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 126
def powerDownHostToStandBy(timeout = 0, evacuatePoweredOffVms = false, wait = true)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: calling powerDownHostToStandBy_Task" if $vim_log
taskMor = @invObj.powerDownHostToStandBy_Task(@hMor, timeout, evacuatePoweredOffVms)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: returned from powerDownHostToStandBy_Task" if $vim_log
return taskMor unless wait
waitForTask(taskMor)
end
|
#powerState ⇒ Object
106
107
108
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 106
def powerState
@invObj.getMoProp(@hMor, "runtime.powerState")['runtime']['powerState']
end
|
#powerUpHostFromStandBy(timeout = 0, wait = true) ⇒ Object
134
135
136
137
138
139
140
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 134
def powerUpHostFromStandBy(timeout = 0, wait = true)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: calling powerUpHostFromStandBy_Task" if $vim_log
taskMor = @invObj.powerUpHostFromStandBy_Task(@hMor, timeout)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: returned from powerUpHostFromStandBy_Task" if $vim_log
return taskMor unless wait
waitForTask(taskMor)
end
|
#quickStats ⇒ Object
98
99
100
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 98
def quickStats
@invObj.getMoProp(@hMor, "summary.quickStats")['summary']['quickStats']
end
|
#rebootHost(force = false, wait = true) ⇒ Object
142
143
144
145
146
147
148
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 142
def rebootHost(force = false, wait = true)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: calling rebootHost_Task" if $vim_log
taskMor = @invObj.rebootHost_Task(@hMor, force)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: returned from rebootHost_Task" if $vim_log
return taskMor unless wait
waitForTask(taskMor)
end
|
#rebootSupported? ⇒ Boolean
64
65
66
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 64
def rebootSupported?
capabilityBool("rebootSupported")
end
|
#release ⇒ Object
Also known as:
release_orig
40
41
42
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 40
def release
end
|
#sanSupported? ⇒ Boolean
68
69
70
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 68
def sanSupported?
capabilityBool("sanSupported")
end
|
#serviceSystem ⇒ Object
189
190
191
192
193
194
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 189
def serviceSystem
return @serviceSystem if @serviceSystem
return nil unless (ss = configManager('serviceSystem'))
@serviceSystem = MiqHostServiceSystem.new(ss, @invObj)
@serviceSystem
end
|
#setCustomField(name, value) ⇒ Object
285
286
287
288
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 285
def setCustomField(name, value)
fk = cfManager.getFieldKey(name, @hMor.vimType)
cfManager.setField(@hMor, fk, value)
end
|
#shutdownHost(force = false, wait = true) ⇒ Object
150
151
152
153
154
155
156
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 150
def shutdownHost(force = false, wait = true)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: calling shutdownHost_Task" if $vim_log
taskMor = @invObj.shutdownHost_Task(@hMor, force)
$vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: returned from shutdownHost_Task" if $vim_log
return taskMor unless wait
waitForTask(taskMor)
end
|
#shutdownSupported? ⇒ Boolean
72
73
74
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 72
def shutdownSupported?
capabilityBool("shutdownSupported")
end
|
#snmpSystem ⇒ Object
218
219
220
221
222
223
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 218
def snmpSystem
return @snmpSystem if @snmpSystem
return nil unless (ss = configManager('snmpSystem'))
@snmpSystem = MiqHostSnmpSystem.new(ss, @invObj)
@snmpSystem
end
|
#standbySupported? ⇒ Boolean
76
77
78
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 76
def standbySupported?
capabilityBool("standbySupported")
end
|
#storageDevice(selSpec = nil) ⇒ Object
266
267
268
269
270
271
272
273
274
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 266
def storageDevice(selSpec = nil)
if selSpec.nil?
return @invObj.getMoProp(@hMor, "config.storageDevice")
else
propPath = @invObj.selSpecToPropPath(selSpec)
sd = @invObj.getMoProp(@hMor, propPath)
return @invObj.applySelector(sd, selSpec)
end
end
|
#storageSystem ⇒ Object
175
176
177
178
179
180
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 175
def storageSystem
return @storageSystem if @storageSystem
return nil unless (hss = configManager('storageSystem'))
@storageSystem = MiqHostStorageSystem.new(hss, @invObj)
@storageSystem
end
|
#storageVMotionSupported? ⇒ Boolean
80
81
82
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 80
def storageVMotionSupported?
capabilityBool("storageVMotionSupported")
end
|
#vmotionSupported? ⇒ Boolean
84
85
86
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 84
def vmotionSupported?
capabilityBool("vmotionSupported")
end
|
#vmotionWithStorageVMotionSupported? ⇒ Boolean
88
89
90
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 88
def vmotionWithStorageVMotionSupported?
capabilityBool("vmotionWithStorageVMotionSupported")
end
|
#waitForTask(tmor) ⇒ Object
307
308
309
|
# File 'lib/VMwareWebService/MiqVimHost.rb', line 307
def waitForTask(tmor)
@invObj.waitForTask(tmor, self.class.to_s)
end
|