vmware_web_service 2.0.3 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/VMwareWebService/MiqHostDatastoreSystem.rb +5 -1
  3. data/lib/VMwareWebService/MiqVim.rb +80 -56
  4. data/lib/VMwareWebService/MiqVimClientBase.rb +11 -10
  5. data/lib/VMwareWebService/MiqVimCluster.rb +6 -2
  6. data/lib/VMwareWebService/MiqVimDataStore.rb +9 -6
  7. data/lib/VMwareWebService/MiqVimDump.rb +1 -1
  8. data/lib/VMwareWebService/MiqVimEventHistoryCollector.rb +5 -1
  9. data/lib/VMwareWebService/MiqVimEventMonitor.rb +22 -20
  10. data/lib/VMwareWebService/MiqVimFolder.rb +15 -11
  11. data/lib/VMwareWebService/MiqVimHost.rb +15 -13
  12. data/lib/VMwareWebService/MiqVimInventory.rb +78 -79
  13. data/lib/VMwareWebService/MiqVimPerfHistory.rb +13 -10
  14. data/lib/VMwareWebService/MiqVimUpdate.rb +50 -50
  15. data/lib/VMwareWebService/MiqVimVdlMod.rb +7 -7
  16. data/lib/VMwareWebService/MiqVimVm.rb +102 -101
  17. data/lib/VMwareWebService/VimService.rb +5 -2
  18. data/lib/VMwareWebService/VixDiskLib/VixDiskLib.rb +15 -7
  19. data/lib/VMwareWebService/VixDiskLib/VixDiskLibServer.rb +15 -15
  20. data/lib/VMwareWebService/VixDiskLib/vdl_wrapper.rb +26 -27
  21. data/lib/VMwareWebService/exception.rb +0 -2
  22. data/lib/VMwareWebService/logging.rb +16 -0
  23. data/lib/VMwareWebService/version.rb +1 -1
  24. data/lib/vmware_web_service.rb +2 -0
  25. metadata +15 -48
  26. data/lib/VMwareWebService/DMiqVim.rb +0 -95
  27. data/lib/VMwareWebService/DMiqVimSync.rb +0 -45
  28. data/lib/VMwareWebService/MiqVimBroker.rb +0 -581
  29. data/lib/VMwareWebService/MiqVimBrokerMods.rb +0 -222
  30. data/lib/VMwareWebService/MiqVimCoreUpdater.rb +0 -269
  31. data/lib/VMwareWebService/miq_fault_tolerant_vim.rb +0 -246
@@ -1,4 +1,8 @@
1
+ require 'VMwareWebService/logging'
2
+
1
3
  class MiqVimFolder
4
+ include VMwareWebService::Logging
5
+
2
6
  attr_reader :name, :invObj
3
7
 
4
8
  def initialize(invObj, fh)
@@ -36,10 +40,10 @@ class MiqVimFolder
36
40
  hmor = (host.kind_of?(Hash) ? host['MOR'] : host) if host
37
41
  pmor = (pool.kind_of?(Hash) ? pool['MOR'] : pool) if pool
38
42
 
39
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: calling registerVM_Task" if $vim_log
43
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: calling registerVM_Task"
40
44
  taskMor = @invObj.registerVM_Task(@fMor, path, name, asTemplate.to_s, pmor, hmor)
41
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: returned from registerVM_Task" if $vim_log
42
- $vim_log.debug "MiqVimFolder::registerVM: taskMor = #{taskMor}" if $vim_log
45
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).registerVM: returned from registerVM_Task"
46
+ logger.debug "MiqVimFolder::registerVM: taskMor = #{taskMor}"
43
47
  waitForTask(taskMor)
44
48
  end
45
49
 
@@ -65,9 +69,9 @@ class MiqVimFolder
65
69
  cs.vmFolder = ah[:vmFolder] unless ah[:vmFolder].nil?
66
70
  end
67
71
 
68
- $vim_log.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: calling addStandaloneHost_Task" if $vim_log
72
+ logger.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: calling addStandaloneHost_Task"
69
73
  taskMor = @invObj.addStandaloneHost_Task(@fMor, cspec, ah[:asConnected].to_s, ah[:license])
70
- $vim_log.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: returned from addStandaloneHost_Task" if $vim_log
74
+ logger.info "MiqVimCluster(#{@invObj.server}, #{@invObj.username}).addStandaloneHost: returned from addStandaloneHost_Task"
71
75
  return taskMor unless ah[:wait]
72
76
  waitForTask(taskMor)
73
77
  end # def addStandaloneHost
@@ -77,10 +81,10 @@ class MiqVimFolder
77
81
  oMor = nil
78
82
  oMor = (vCenterObject.kind_of?(Hash) ? vCenterObject['MOR'] : vCenterObject) if vCenterObject
79
83
 
80
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: calling moveIntoFolder_Task" if $vim_log
84
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: calling moveIntoFolder_Task"
81
85
  taskMor = @invObj.moveIntoFolder_Task(@fMor, oMor)
82
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: returned from moveIntoFolder_Task" if $vim_log
83
- $vim_log.debug "MiqVimFolder::moveIntoFolder: taskMor = #{taskMor}" if $vim_log
86
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).moveIntoFolder: returned from moveIntoFolder_Task"
87
+ logger.debug "MiqVimFolder::moveIntoFolder: taskMor = #{taskMor}"
84
88
  waitForTask(taskMor)
85
89
  end
86
90
 
@@ -96,10 +100,10 @@ class MiqVimFolder
96
100
  hMor = (host.kind_of?(Hash) ? host['MOR'] : host) if host
97
101
  pMor = (pool.kind_of?(Hash) ? pool['MOR'] : pool) if pool
98
102
 
99
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM calling createVM_Task" if $vim_log
103
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM calling createVM_Task"
100
104
  taskMor = @invObj.createVM_Task(@fMor, configSpec, pMor, hMor)
101
- $vim_log.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM returned from createVM_Task" if $vim_log
102
- $vim_log.debug "MiqVimFolder::createVM: taskMor = #{taskMor}" if $vim_log
105
+ logger.info "MiqVimFolder(#{@invObj.server}, #{@invObj.username}).createVM returned from createVM_Task"
106
+ logger.debug "MiqVimFolder::createVM: taskMor = #{taskMor}"
103
107
  waitForTask(taskMor)
104
108
  end
105
109
 
@@ -1,9 +1,9 @@
1
1
  require 'sync'
2
2
 
3
- require 'enumerator'
4
3
  require "ostruct"
5
4
 
6
5
  require 'more_core_extensions/core_ext/hash'
6
+ require 'VMwareWebService/logging'
7
7
  require 'VMwareWebService/MiqHostDatastoreSystem'
8
8
  require 'VMwareWebService/MiqHostStorageSystem'
9
9
  require 'VMwareWebService/MiqHostFirewallSystem'
@@ -14,6 +14,8 @@ require 'VMwareWebService/MiqHostAdvancedOptionManager'
14
14
  require 'VMwareWebService/MiqHostSnmpSystem'
15
15
 
16
16
  class MiqVimHost
17
+ include VMwareWebService::Logging
18
+
17
19
  attr_reader :name, :invObj
18
20
 
19
21
  def initialize(invObj, hh)
@@ -108,49 +110,49 @@ class MiqVimHost
108
110
  end
109
111
 
110
112
  def enterMaintenanceMode(timeout = 0, evacuatePoweredOffVms = false, wait = true)
111
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: calling enterMaintenanceMode_Task" if $vim_log
113
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: calling enterMaintenanceMode_Task"
112
114
  taskMor = @invObj.enterMaintenanceMode_Task(@hMor, timeout, evacuatePoweredOffVms)
113
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: returned from enterMaintenanceMode_Task" if $vim_log
115
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).enterMaintenanceMode: returned from enterMaintenanceMode_Task"
114
116
  return taskMor unless wait
115
117
  waitForTask(taskMor)
116
118
  end
117
119
 
118
120
  def exitMaintenanceMode(timeout = 0, wait = true)
119
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: calling exitMaintenanceMode_Task" if $vim_log
121
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: calling exitMaintenanceMode_Task"
120
122
  taskMor = @invObj.exitMaintenanceMode_Task(@hMor, timeout)
121
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: returned from exitMaintenanceMode_Task" if $vim_log
123
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).exitMaintenanceMode: returned from exitMaintenanceMode_Task"
122
124
  return taskMor unless wait
123
125
  waitForTask(taskMor)
124
126
  end
125
127
 
126
128
  def powerDownHostToStandBy(timeout = 0, evacuatePoweredOffVms = false, wait = true)
127
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: calling powerDownHostToStandBy_Task" if $vim_log
129
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: calling powerDownHostToStandBy_Task"
128
130
  taskMor = @invObj.powerDownHostToStandBy_Task(@hMor, timeout, evacuatePoweredOffVms)
129
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: returned from powerDownHostToStandBy_Task" if $vim_log
131
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerDownHostToStandBy: returned from powerDownHostToStandBy_Task"
130
132
  return taskMor unless wait
131
133
  waitForTask(taskMor)
132
134
  end
133
135
 
134
136
  def powerUpHostFromStandBy(timeout = 0, wait = true)
135
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: calling powerUpHostFromStandBy_Task" if $vim_log
137
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: calling powerUpHostFromStandBy_Task"
136
138
  taskMor = @invObj.powerUpHostFromStandBy_Task(@hMor, timeout)
137
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: returned from powerUpHostFromStandBy_Task" if $vim_log
139
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).powerUpHostFromStandBy: returned from powerUpHostFromStandBy_Task"
138
140
  return taskMor unless wait
139
141
  waitForTask(taskMor)
140
142
  end
141
143
 
142
144
  def rebootHost(force = false, wait = true)
143
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: calling rebootHost_Task" if $vim_log
145
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: calling rebootHost_Task"
144
146
  taskMor = @invObj.rebootHost_Task(@hMor, force)
145
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: returned from rebootHost_Task" if $vim_log
147
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).rebootHost: returned from rebootHost_Task"
146
148
  return taskMor unless wait
147
149
  waitForTask(taskMor)
148
150
  end
149
151
 
150
152
  def shutdownHost(force = false, wait = true)
151
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: calling shutdownHost_Task" if $vim_log
153
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: calling shutdownHost_Task"
152
154
  taskMor = @invObj.shutdownHost_Task(@hMor, force)
153
- $vim_log.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: returned from shutdownHost_Task" if $vim_log
155
+ logger.info "MiqVimHost(#{@invObj.server}, #{@invObj.username}).shutdownHost: returned from shutdownHost_Task"
154
156
  return taskMor unless wait
155
157
  waitForTask(taskMor)
156
158
  end