Class: MiqVim
- Inherits:
-
MiqVimInventory
- Object
- Handsoap::Service
- VimService
- MiqVimClientBase
- MiqVimInventory
- MiqVim
- Includes:
- MiqVimUpdate, MiqVimVdlConnectionMod
- Defined in:
- lib/VMwareWebService/MiqVim.rb
Direct Known Subclasses
Constant Summary collapse
- @@monitor_updates =
false- @@pre_load =
false
Constants included from VimPropMaps
VimPropMaps::CorePropMap, VimPropMaps::EmsRefreshPropMap, VimPropMaps::EventMonitorPropMap, VimPropMaps::FullPropMap, VimPropMaps::PropMapVCenter, VimPropMaps::UpdatePropMapsByType, VimPropMaps::VimCoreUpdaterPropMap
Instance Attribute Summary collapse
-
#monitor_updates ⇒ Object
readonly
Returns the value of attribute monitor_updates.
-
#updateThread ⇒ Object
readonly
Returns the value of attribute updateThread.
Attributes inherited from MiqVimInventory
Attributes inherited from MiqVimClientBase
#connId, #password, #server, #username
Attributes inherited from VimService
#about, #apiVersion, #isVirtualCenter, #serviceInstanceMor, #session_cookie, #sic, #v2, #v20, #v4, #v5, #v6
Class Method Summary collapse
- .monitor_updates ⇒ Object
- .monitor_updates=(val) ⇒ Object
- .pre_load ⇒ Object
- .pre_load=(val) ⇒ Object
Instance Method Summary collapse
- #disconnect ⇒ Object
- #getMiqCustomFieldsManager ⇒ Object
- #getVimAlarmManager ⇒ Object
-
#getVimCluster(name) ⇒ Object
Cluster.
-
#getVimClusterByFilter(filter) ⇒ Object
def getVimClusterByMor.
-
#getVimClusterByMor(cMor) ⇒ Object
def getVimCluster.
- #getVimCustomizationSpecManager ⇒ Object
-
#getVimDataStore(dsName) ⇒ Object
DataStore.
- #getVimDataStoreByMor(dsMor) ⇒ Object
- #getVimEventHistory(eventFilterSpec = nil, pgSize = 20) ⇒ Object
-
#getVimFolder(name) ⇒ Object
def getVimHostByFilter.
-
#getVimFolderByFilter(filter) ⇒ Object
def getVimFolderByMor.
-
#getVimFolderByMor(fMor) ⇒ Object
def getVimFolder.
-
#getVimHost(name) ⇒ Object
def getVimVmByFilter.
-
#getVimHostByFilter(filter) ⇒ Object
Returns a MiqVimHost object for the first Host found that matches the criteria defined by the filter.
-
#getVimHostByMor(hMor) ⇒ Object
def getVimHost.
- #getVimPerfHistory ⇒ Object
- #getVimVm(path) ⇒ Object
-
#getVimVmByFilter(filter) ⇒ Object
Returns a MiqVimVm object for the first VM found that matches the criteria defined by the filter.
-
#getVimVmByMor(vmMor) ⇒ Object
def getVimVm.
-
#initialize(server, username, password, cacheScope = nil, monitor_updates = nil, preLoad = nil, debugUpdates = false, notifyMethod = nil, maxWait = 60, maxObjects = 250) ⇒ MiqVim
constructor
A new instance of MiqVim.
Methods included from MiqVimUpdate
#addObject, #debugUpdates=, #deleteObject, #forceFail, #monitorUpdates, #monitorUpdatesInitial, #monitorUpdatesSince, #notifyMethod=, #propUpdate, #stopUpdateMonitor, #updateDelay, #updateDelay=, #updateObject, #updateProps
Methods included from MiqVimVdlConnectionMod
#closeVdlConnection, #vdlConnection
Methods inherited from MiqVimInventory
#addDVPObj, #addDVSObj, #addDataStore, #addDataStoreObj, #addExtensionManager, #addHostSystem, #addHostSystemObj, #addLicenseManager, #addObjByMor, #addObjHash, #addProperty, #addStoragePodObj, #addToCollection, #addVirtualMachine, #allPropsFromCache, #applyFilter, #applySelSpec, #applySelector, #assert_no_locks, #browseDiagnosticLog, #browseDiagnosticLogEx, cacheScope, cacheScope=, #cacheStats, #cancelTask, #clusterComputeResourceByMor, #clusterComputeResources, #clusterComputeResourcesByFilter, #clusterComputeResourcesByMor, #computeResourceByMor, #computeResources, #computeResourcesByFilter, #computeResourcesByMor, #conditionalCopy, #currentSession, #dataStoreByMor, #dataStores, #dataStoresByFilter, #dataStoresByFilter_local, #dataStoresByMor, #datacenterByMor, #datacenters, #datacentersByFilter, #datacentersByMor, #datastorePath, #deepClone, #deleteProperty, #dsName2mo, #dsName2mo_local, #dsName2path, #dsPath?, dsPath?, dsRelativePath, #dsRelativePath, #dupObj, #dvPortgroupByMor, #dvPortgroups, #dvPortgroupsByMor, #dvSwitchByMor, #dvSwitches, #dvSwitchesByMor, #extensionManagerByMor, #extensionManagersByFilter, #extensionManagersByMor, #folderByMor, #folders, #foldersByFilter, #foldersByMor, #getMoProp, #getMoPropMulti, #getMoPropMultiIter, #getMoProp_local, #getSelSpec, #getSelector, #getTaskMor, #getTasks, #getTasksByFilter, #hasProp?, #hostSystemByMor, #hostSystems, #hostSystemsByFilter, #hostSystemsByMor, #hostSystemsStorageDevice, #inventoryHash, #inventoryHash_locked, #isAlive?, #isDead, #isHostAgent?, #isVirtualCenter?, #keyExistsInCache?, #keyFromCache, #licenseManagerByMor, #licenseManagersByFilter, #licenseManagersByMor, #loadCache, #localVmPath, #logCacheCounts, #logUserEvent, #objFixUp, path2dsName, #path2dsName, #pollTask, #propFromCache, #propValue, #queryLogDescriptions, #refreshExtensionManager, #refreshLicenseManager, #refreshVirtualMachine, #removeExtensionManager, #removeLicenseManager, #removeObjByMor, #removeSelector, removeSelector, #removeVirtualMachine, #resetCache, #resourcePoolByMor, #resourcePools, #resourcePoolsByFilter, #resourcePoolsByMor, #selSpecToPropPath, setSelector, #setSelector, #snapshotFixup, #spec, #storagePodByMor, #storagePods, #storagePodsByMor, #updateSpec, #updateSpecByPropMap, #virtualAppByMor, #virtualApps, #virtualAppsByFilter, #virtualAppsByMor, #virtualMachineByMor, #virtualMachines, #virtualMachinesByFilter, #virtualMachinesByMor, #vmDatacenterName, #waitForTask
Methods included from MiqVimObjectSet
Methods included from MiqVimDump
#dumpAll, #dumpArray, #dumpClass, #dumpHash, #dumpHostInfo, #dumpMors, #dumpObj, #dumpToLog=, #globalIndent=, #indentedPrint
Methods included from VimPropMaps
Methods inherited from MiqVimClientBase
#acquireCloneTicket, #connect, #currentServerTime, #receiveTimeout, receiveTimeout, #receiveTimeout=, receiveTimeout=, #sdk_uri, #verify_callback
Methods inherited from VimService
#acquireCloneTicket, #acquireMksTicket, #acquireTicket, #addHost_Task, #addInternetScsiSendTargets, #addInternetScsiStaticTargets, #addStandaloneHost_Task, #browseDiagnosticLog, #cancelTask, #cancelWaitForUpdates, #cloneVM_Task, #continueRetrievePropertiesEx, #createAlarm, #createCollectorForEvents, #createCustomizationSpec, #createFilter, #createFolder, #createNasDatastore, #createSnapshot_Task, #createVM_Task, #currentTime, #customizationSpecItemToXml, #deleteCustomizationSpec, #deselectVnicForNicType, #destroyCollector, #destroyPropertyFilter, #destroy_Task, #disableRuleset, #doesCustomizationSpecExist, #enableRuleset, #enterMaintenanceMode_Task, #exitMaintenanceMode_Task, #getAlarm, #getCustomizationSpec, #logUserEvent, #login, #logout, #markAsTemplate, #markAsVirtualMachine, #migrateVM_Task, #moveIntoFolder_Task, #powerDownHostToStandBy_Task, #powerOffVM_Task, #powerOnVM_Task, #powerUpHostFromStandBy_Task, #queryAvailablePerfMetric, #queryDescriptions, #queryDvsConfigTarget, #queryNetConfig, #queryOptions, #queryPerf, #queryPerfComposite, #queryPerfProviderSummary, #readNextEvents, #readPreviousEvents, #rebootGuest, #rebootHost_Task, #reconfigVM_Task, #reconfigureAlarm, #refreshFirewall, #refreshNetworkSystem, #refreshServices, #registerVM_Task, #relocateVM_Task, #removeAlarm, #removeAllSnapshots_Task, #removeSnapshot_Task, #renameSnapshot, #rename_Task, #resetCollector, #resetVM_Task, #restartService, #retrieveProperties, #retrievePropertiesCompat, #retrievePropertiesEx, #retrievePropertiesIter, #retrieveServiceContent, #revertToCurrentSnapshot_Task, #revertToSnapshot_Task, #rewindCollector, #searchDatastoreSubFolders_Task, #searchDatastore_Task, #selectVnicForNicType, #setCollectorPageSize, #setField, #setTaskDescription, #setTaskState, #shutdownGuest, #shutdownHost_Task, #standbyGuest, #startService, #stopService, #suspendVM_Task, #uninstallService, #unregisterVM, #updateDefaultPolicy, #updateServicePolicy, #updateSoftwareInternetScsiEnabled, #waitForUpdates, #waitForUpdatesEx, #xmlToCustomizationSpecItem
Constructor Details
#initialize(server, username, password, cacheScope = nil, monitor_updates = nil, preLoad = nil, debugUpdates = false, notifyMethod = nil, maxWait = 60, maxObjects = 250) ⇒ MiqVim
Returns a new instance of MiqVim.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/VMwareWebService/MiqVim.rb', line 33 def initialize(server, username, password, cacheScope = nil, monitor_updates = nil, preLoad = nil, debugUpdates = false, notifyMethod = nil, maxWait = 60, maxObjects = 250) super(server, username, password, cacheScope) monitor_updates = self.class.monitor_updates if monitor_updates.nil? preLoad = self.class.pre_load if preLoad.nil? @monitor_updates = monitor_updates @updateMonitorReady = false @error = nil @notifyMethod = notifyMethod @debugUpdates = debugUpdates @maxWait = maxWait @maxObjects = maxObjects start_monitor_updates_thread(preLoad) if @monitor_updates end |
Instance Attribute Details
#monitor_updates ⇒ Object (readonly)
Returns the value of attribute monitor_updates.
21 22 23 |
# File 'lib/VMwareWebService/MiqVim.rb', line 21 def monitor_updates @monitor_updates end |
#updateThread ⇒ Object (readonly)
Returns the value of attribute updateThread.
21 22 23 |
# File 'lib/VMwareWebService/MiqVim.rb', line 21 def updateThread @updateThread end |
Class Method Details
.monitor_updates ⇒ Object
53 54 55 |
# File 'lib/VMwareWebService/MiqVim.rb', line 53 def self.monitor_updates @@monitor_updates end |
.monitor_updates=(val) ⇒ Object
57 58 59 |
# File 'lib/VMwareWebService/MiqVim.rb', line 57 def self.monitor_updates=(val) @@monitor_updates = val end |
.pre_load ⇒ Object
61 62 63 |
# File 'lib/VMwareWebService/MiqVim.rb', line 61 def self.pre_load @@pre_load end |
.pre_load=(val) ⇒ Object
65 66 67 |
# File 'lib/VMwareWebService/MiqVim.rb', line 65 def self.pre_load=(val) @@pre_load = val end |
Instance Method Details
#disconnect ⇒ Object
271 272 273 274 275 |
# File 'lib/VMwareWebService/MiqVim.rb', line 271 def disconnect shutdown_monitor_updates_thread if @monitor_updates super end |
#getMiqCustomFieldsManager ⇒ Object
253 254 255 256 257 |
# File 'lib/VMwareWebService/MiqVim.rb', line 253 def getMiqCustomFieldsManager miqVimCfm = MiqCustomFieldsManager.new(self) $vim_log.info "MiqVimMod.getMiqCustomFieldsManager: returning object #{miqVimCfm.object_id}" (miqVimCfm) end |
#getVimAlarmManager ⇒ Object
259 260 261 262 263 |
# File 'lib/VMwareWebService/MiqVim.rb', line 259 def getVimAlarmManager miqVimAm = MiqVimAlarmManager.new(self) $vim_log.info "MiqVimMod.getVimAlarmManager: returning object #{miqVimAm.object_id}" (miqVimAm) end |
#getVimCluster(name) ⇒ Object
Cluster
182 183 184 185 186 187 188 189 190 191 |
# File 'lib/VMwareWebService/MiqVim.rb', line 182 def getVimCluster(name) $vim_log.info "MiqVimMod.getVimCluster: called" miqVimCluster = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find Cluster: #{name}" unless (ch = clusterComputeResources_locked[name]) miqVimCluster = MiqVimCluster.new(self, conditionalCopy(ch)) end $vim_log.info "MiqVimMod.getVimCluster: returning object #{miqVimCluster.object_id}" (miqVimCluster) end |
#getVimClusterByFilter(filter) ⇒ Object
def getVimClusterByMor
204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/VMwareWebService/MiqVim.rb', line 204 def getVimClusterByFilter(filter) $vim_log.info "MiqVimMod.getVimClusterByFilter: called" miqVimCluster = nil @cacheLock.synchronize(:SH) do clusters = applyFilter(clusterComputeResourcesByMor_locked.values, filter) raise MiqException::MiqVimResourceNotFound, "getVimClusterByFilter: Could not find Cluster matching filter" if clusters.empty? miqVimCluster = MiqVimCluster.new(self, conditionalCopy(clusters[0])) end $vim_log.info "MiqVimMod.getVimClusterByFilter: returning object #{miqVimCluster.object_id}" (miqVimCluster) end |
#getVimClusterByMor(cMor) ⇒ Object
def getVimCluster
193 194 195 196 197 198 199 200 201 202 |
# File 'lib/VMwareWebService/MiqVim.rb', line 193 def getVimClusterByMor(cMor) $vim_log.info "MiqVimMod.getVimClusterByMor: called" miqVimCluster = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find Cluster: #{cMor}" unless (ch = clusterComputeResourcesByMor_locked[cMor]) miqVimCluster = MiqVimCluster.new(self, conditionalCopy(ch)) end $vim_log.info "MiqVimMod.getVimClusterByMor: returning object #{miqVimCluster.object_id}" (miqVimCluster) end |
#getVimCustomizationSpecManager ⇒ Object
265 266 267 268 269 |
# File 'lib/VMwareWebService/MiqVim.rb', line 265 def getVimCustomizationSpecManager miqVimCsm = MiqVimCustomizationSpecManager.new(self) $vim_log.info "MiqVimMod.getVimCustomizationSpecManager: returning object #{miqVimCsm.object_id}" (miqVimCsm) end |
#getVimDataStore(dsName) ⇒ Object
DataStore
219 220 221 222 223 224 225 226 227 228 |
# File 'lib/VMwareWebService/MiqVim.rb', line 219 def getVimDataStore(dsName) $vim_log.info "MiqVimMod.getVimDataStore: called" miqVimDs = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find datastore: #{dsName}" unless (dsh = dataStores_locked[dsName]) miqVimDs = MiqVimDataStore.new(self, conditionalCopy(dsh)) end $vim_log.info "MiqVimMod.getVimDataStore: returning object #{miqVimDs.object_id}" (miqVimDs) end |
#getVimDataStoreByMor(dsMor) ⇒ Object
230 231 232 233 234 235 236 237 238 239 |
# File 'lib/VMwareWebService/MiqVim.rb', line 230 def getVimDataStoreByMor(dsMor) $vim_log.info "MiqVimMod.getVimDataStoreByMor: called" miqVimDs = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find datastore: #{dsMor}" unless (dsh = dataStoresByMor_locked[dsMor]) miqVimDs = MiqVimDataStore.new(self, conditionalCopy(dsh)) end $vim_log.info "MiqVimMod.getVimDataStoreByMor: returning object #{miqVimDs.object_id}" (miqVimDs) end |
#getVimEventHistory(eventFilterSpec = nil, pgSize = 20) ⇒ Object
247 248 249 250 251 |
# File 'lib/VMwareWebService/MiqVim.rb', line 247 def getVimEventHistory(eventFilterSpec = nil, pgSize = 20) miqVimEh = MiqVimEventHistoryCollector.new(self, eventFilterSpec, pgSize) $vim_log.info "MiqVimMod.getVimEventHistory: returning object #{miqVimEh.object_id}" (miqVimEh) end |
#getVimFolder(name) ⇒ Object
def getVimHostByFilter
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/VMwareWebService/MiqVim.rb', line 145 def getVimFolder(name) $vim_log.info "MiqVimMod.getVimFolder: called" miqVimFolder = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find Folder: #{name}" unless (fh = folders_locked[name]) miqVimFolder = MiqVimFolder.new(self, conditionalCopy(fh)) end $vim_log.info "MiqVimMod.getVimFolder: returning object #{miqVimFolder.object_id}" (miqVimFolder) end |
#getVimFolderByFilter(filter) ⇒ Object
def getVimFolderByMor
167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/VMwareWebService/MiqVim.rb', line 167 def getVimFolderByFilter(filter) $vim_log.info "MiqVimMod.getVimFolderByFilter: called" miqVimFolder = nil @cacheLock.synchronize(:SH) do folders = applyFilter(foldersByMor_locked.values, filter) raise MiqException::MiqVimResourceNotFound, "getVimFolderByFilter: Could not find folder matching filter" if folders.empty? miqVimFolder = MiqVimFolder.new(self, conditionalCopy(folders[0])) end $vim_log.info "MiqVimMod.getVimFolderByFilter: returning object #{miqVimFolder.object_id}" (miqVimFolder) end |
#getVimFolderByMor(fMor) ⇒ Object
def getVimFolder
156 157 158 159 160 161 162 163 164 165 |
# File 'lib/VMwareWebService/MiqVim.rb', line 156 def getVimFolderByMor(fMor) $vim_log.info "MiqVimMod.getVimFolderByMor: called" miqVimFolder = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find Folder: #{fMor}" unless (fh = foldersByMor_locked[fMor]) miqVimFolder = MiqVimFolder.new(self, conditionalCopy(fh)) end $vim_log.info "MiqVimMod.getVimFolderByMor: returning object #{miqVimFolder.object_id}" (miqVimFolder) end |
#getVimHost(name) ⇒ Object
def getVimVmByFilter
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/VMwareWebService/MiqVim.rb', line 107 def getVimHost(name) $vim_log.info "MiqVimMod.getVimHost: called" miqVimHost = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find Host: #{name}" unless (hh = hostSystems_locked[name]) miqVimHost = MiqVimHost.new(self, conditionalCopy(hh)) end $vim_log.info "MiqVimMod.getVimHost: returning object #{miqVimHost.object_id}" (miqVimHost) end |
#getVimHostByFilter(filter) ⇒ Object
Returns a MiqVimHost object for the first Host found that matches the criteria defined by the filter.
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/VMwareWebService/MiqVim.rb', line 133 def getVimHostByFilter(filter) $vim_log.info "MiqVimMod.getVimHostByFilter: called" miqVimHost = nil @cacheLock.synchronize(:SH) do ha = applyFilter(hostSystemsByMor_locked.values, filter) raise MiqException::MiqVimResourceNotFound, "getVimHostByFilter: Could not find Host matching filter" if ha.empty? miqVimHost = MiqVimHost.new(self, conditionalCopy(ha[0])) end $vim_log.info "MiqVimMod.getVimHostByFilter: returning object #{miqVimHost.object_id}" (miqVimHost) end |
#getVimHostByMor(hMor) ⇒ Object
def getVimHost
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/VMwareWebService/MiqVim.rb', line 118 def getVimHostByMor(hMor) $vim_log.info "MiqVimMod.getVimHostByMor: called" miqVimHost = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find Host: #{hMor}" unless (hh = hostSystemsByMor_locked[hMor]) miqVimHost = MiqVimHost.new(self, conditionalCopy(hh)) end $vim_log.info "MiqVimMod.getVimHostByMor: returning object #{miqVimHost.object_id}" (miqVimHost) end |
#getVimPerfHistory ⇒ Object
241 242 243 244 245 |
# File 'lib/VMwareWebService/MiqVim.rb', line 241 def getVimPerfHistory miqVimPh = MiqVimPerfHistory.new(self) $vim_log.info "MiqVimMod.getVimPerfHistory: returning object #{miqVimPh.object_id}" (miqVimPh) end |
#getVimVm(path) ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/VMwareWebService/MiqVim.rb', line 69 def getVimVm(path) $vim_log.info "MiqVimMod.getVimVm: called" miqVimVm = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find VM: #{path}" unless (vmh = virtualMachines_locked[path]) miqVimVm = MiqVimVm.new(self, conditionalCopy(vmh)) end $vim_log.info "MiqVimMod.getVimVm: returning object #{miqVimVm.object_id}" (miqVimVm) end |
#getVimVmByFilter(filter) ⇒ Object
Returns a MiqVimVm object for the first VM found that matches the criteria defined by the filter.
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/VMwareWebService/MiqVim.rb', line 95 def getVimVmByFilter(filter) $vim_log.info "MiqVimMod.getVimVmByFilter: called" miqVimVm = nil @cacheLock.synchronize(:SH) do vms = applyFilter(virtualMachinesByMor_locked.values, filter) raise MiqException::MiqVimResourceNotFound, "getVimVmByFilter: Could not find VM matching filter" if vms.empty? miqVimVm = MiqVimVm.new(self, conditionalCopy(vms[0])) end $vim_log.info "MiqVimMod.getVimVmByFilter: returning object #{miqVimVm.object_id}" (miqVimVm) end |
#getVimVmByMor(vmMor) ⇒ Object
def getVimVm
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/VMwareWebService/MiqVim.rb', line 80 def getVimVmByMor(vmMor) $vim_log.info "MiqVimMod.getVimVmByMor: called" miqVimVm = nil @cacheLock.synchronize(:SH) do raise MiqException::MiqVimResourceNotFound, "Could not find VM: #{vmMor}" unless (vmh = virtualMachinesByMor_locked[vmMor]) miqVimVm = MiqVimVm.new(self, conditionalCopy(vmh)) end $vim_log.info "MiqVimMod.getVimVmByMor: returning object #{miqVimVm.object_id}" (miqVimVm) end |