Package org.jenkinsci.plugins
Class vSphereCloud
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.slaves.Cloud
org.jenkinsci.plugins.vSphereCloud
- All Implemented Interfaces:
ExtensionPoint,Describable<Cloud>,ModelObject,SearchableModelObject,SearchItem,AccessControlled,ModelObjectWithContextMenu
- Author:
- Admin
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class hudson.slaves.Cloud
Cloud.CloudStateNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName used by every cloud of this type before names were made unique, and the fallback when no usable description exists. -
Constructor Summary
ConstructorsConstructorDescriptionvSphereCloud(String vsHost, String vsDescription, String username, String password, int maxOnlineSlaves) Deprecated.vSphereCloud(VSphereConnectionConfig vsConnectionConfig, String vsDescription, int maxOnlineSlaves, int instanceCap, boolean useNoDelayProvisioner, List<? extends vSphereCloudSlaveTemplate> templates) -
Method Summary
Modifier and TypeMethodDescriptioncanMarkVMOnline(String slaveName, String vmName) booleancanProvision(Label label) static StringderiveCloudName(String description, Set<String> taken) Derives a URL/ID-safeCloud.namefrom a cloud's description, unique amongtaken(the result is not added to it): unsafe characters become '-', and "-2", "-3", ...static List<vSphereCloud> findAllVsphereClouds(String jobName) booleanShown in the list of clouds: the type, then the user-chosen name of this cloud.final intgetHash()DefaulthostSelectionCandidatesfor templates/build-steps that leave their own unset.For the classic config UI textbox, and pipeline/JCasC callers that prefer a plain string.DefaulthostSelectionModefor templates/build-steps that leave their own blank.intintintintintintintintintintList<? extends vSphereCloudSlaveTemplate> booleanstatic HostSelectionOptionshostSelectionOptions(vSphereCloud cloud, Boolean requireCores, Boolean requireMemory) Resolves the host selection refinements for one call site: the cloud's own defaults (or none, if there is nocloud), overridden by whatever the call site set explicitly.static HostSelectionOptionshostSelectionOptions(vSphereCloud cloud, Boolean requireCores, Boolean requireMemory, Boolean requireAvailableMemory) As above, also for the "enough memory free right now" requirement.static HostSelectionOptionshostSelectionOptions(vSphereCloud cloud, Boolean requireCores, Boolean requireMemory, Boolean requireAvailableMemory, HostWeights weightsOverride) As above, also with the host weights a call site set for itself: ifweightsOverrideis not null it replaces the cloud's weights as a whole, else the cloud's apply.The four weights as one value;HostWeights.DEFAULTif none is set.booleanOpt-in: only consider hosts that currently have at least as much memory free as the VM is configured with, so the new VM does not get swapped by the hypervisor.booleanOpt-in: only consider hosts with at least as many physical CPU cores as the VM has vCPUs.booleanOpt-in: only consider hosts with at least as much physical RAM as the VM is configured with.booleanbooleanstatic voidLog(Slave slave, TaskListener listener, String format, Object... args) Logs aLevel.INFOmessage (created withString.format(String, Object...)), prefixed by theSlavename.static voidLogs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace), prefixed by theSlavename.static voidLogs aLevel.INFOmessage (created withString.format(String, Object...)), prefixed by theSlavename.static voidLogs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace), prefixed by theSlavename.static voidLog(TaskListener listener, String format, Object... args) Logs aLevel.INFOmessage (created withString.format(String, Object...)).static voidLog(TaskListener listener, Throwable ex, String format, Object... args) Logs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace).static voidLog(SlaveComputer slave, TaskListener listener, String format, Object... args) Logs aLevel.INFOmessage (created withString.format(String, Object...)), prefixed by theSlaveComputername.static voidLog(SlaveComputer slave, TaskListener listener, Throwable ex, String format, Object... args) Logs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace), prefixed by theSlaveComputername.static voidLogs anLevel.INFOmessage (created withString.format(String, Object...)).static voidLogs anLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowablewith stacktrace.voidmarkVMOffline(String slaveName, String vmName) markVMOnline(String slaveName, String vmName) voidpreProvisionNodes(vSphereCloudSlaveTemplate template) Pre-provisions nodes per template to save time on a VM boot.voidsetHostSelectionCandidates(Collection<String> hostSelectionCandidates) voidsetHostSelectionCandidatesAsString(String hostSelectionCandidatesCsv) voidsetHostSelectionMode(String hostSelectionMode) voidsetHostSelectionRequireAvailableMemory(boolean hostSelectionRequireAvailableMemory) voidsetHostSelectionRequireCores(boolean hostSelectionRequireCores) voidsetHostSelectionRequireMemory(boolean hostSelectionRequireMemory) voidsetHostWeightFreeCpuMhz(int hostWeightFreeCpuMhz) Weight of a host's free CPU, in MHz (absolute), when ranking hosts; 0 = ignore.voidsetHostWeightFreeCpuPercent(int hostWeightFreeCpuPercent) Weight of a host's free CPU as a share of its capacity (relative), when ranking hosts; 0 = ignore.voidsetHostWeightFreeMemoryMB(int hostWeightFreeMemoryMB) Weight of a host's free memory, in MB (absolute), when ranking hosts; 0 = ignore.voidsetHostWeightFreeMemoryPercent(int hostWeightFreeMemoryPercent) Weight of a host's free memory as a share of its capacity (relative), when ranking hosts; 0 = ignore.voidsetMaintenanceMessage(String maintenanceMessage) voidsetMaintenanceMode(boolean maintenanceMode) voidSets the Jenkins-level cloud ID (thenameinconfig.xmland in/manage/cloud/<name>/).voidsetPoolHealthCheckIntervalSecs(int poolHealthCheckIntervalSecs) voidsetPoolIdleTimeoutSecs(int poolIdleTimeoutSecs) voidsetSessionMaxAgeSecs(int sessionMaxAgeSecs) voidsetSessionMaxUses(int sessionMaxUses) voidsetUseConnectionPool(boolean useConnectionPool) toString()voidwaitWhileInMaintenanceMode(TaskListener listener) If this cloud (or whichevervSphereCloudinstance now holds its configuration - Jenkins constructs a brand-newCloudinstance on every reconfiguration rather than mutating the existing one, seeresolveCurrentInstance()) is in maintenance mode, logs the configured message tolistenerand blocks the calling thread, polling everyMAINTENANCE_POLL_INTERVAL_MS, until maintenance mode is turned off.Methods inherited from class hudson.slaves.Cloud
all, canProvision, doConfigSubmit, doDoDelete, getACL, getIcon, getIconAltText, getIconClassName, getSearchUrl, getUrl, provision, reconfigure, reconfigure, registerPermissionsMethods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.search.SearchItem
getSearchGroup, getSearchIcon
-
Field Details
-
DEFAULT_CLOUD_NAME
Name used by every cloud of this type before names were made unique, and the fallback when no usable description exists.- See Also:
-
-
Constructor Details
-
vSphereCloud
@Deprecated public vSphereCloud(String vsHost, String vsDescription, String username, String password, int maxOnlineSlaves) Deprecated. -
vSphereCloud
@DataBoundConstructor public vSphereCloud(VSphereConnectionConfig vsConnectionConfig, String vsDescription, int maxOnlineSlaves, int instanceCap, boolean useNoDelayProvisioner, List<? extends vSphereCloudSlaveTemplate> templates)
-
-
Method Details
-
Log
Logs anLevel.INFOmessage (created withString.format(String, Object...)). -
Log
Logs anLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowablewith stacktrace. -
Log
Logs aLevel.INFOmessage (created withString.format(String, Object...)). -
Log
Logs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace). -
Log
Logs aLevel.INFOmessage (created withString.format(String, Object...)), prefixed by theSlavename. -
Log
Logs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace), prefixed by theSlavename. -
Log
Logs aLevel.INFOmessage (created withString.format(String, Object...)), prefixed by theSlavename. -
Log
public static void Log(Slave slave, TaskListener listener, Throwable ex, String format, Object... args) Logs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace), prefixed by theSlavename. -
Log
Logs aLevel.INFOmessage (created withString.format(String, Object...)), prefixed by theSlaveComputername. -
Log
public static void Log(SlaveComputer slave, TaskListener listener, Throwable ex, String format, Object... args) Logs aLevel.SEVEREmessage (created withString.format(String, Object...)) and aThrowable(with stacktrace), prefixed by theSlaveComputername. -
deriveCloudName
Derives a URL/ID-safeCloud.namefrom a cloud's description, unique amongtaken(the result is not added to it): unsafe characters become '-', and "-2", "-3", ... is appended on collision. Falls back toDEFAULT_CLOUD_NAMEfor an empty description. -
setName
Sets the Jenkins-level cloud ID (thenameinconfig.xmland in/manage/cloud/<name>/). This is an implementation detail: the config form shows it read-only and only submits it back so that reconfiguring a cloud keeps its identity. Blank values are ignored, leaving the name derived from the description. -
getDisplayName
Shown in the list of clouds: the type, then the user-chosen name of this cloud.- Specified by:
getDisplayNamein interfaceModelObject- Overrides:
getDisplayNamein classCloud
-
readResolve
- Throws:
IOException
-
getMaxOnlineSlaves
public int getMaxOnlineSlaves() -
getInstanceCap
public int getInstanceCap() -
getUseNoDelayProvisioner
public boolean getUseNoDelayProvisioner() -
getTemplates
-
isUseConnectionPool
public boolean isUseConnectionPool() -
setUseConnectionPool
@DataBoundSetter public void setUseConnectionPool(boolean useConnectionPool) -
getPoolHealthCheckIntervalSecs
public int getPoolHealthCheckIntervalSecs() -
setPoolHealthCheckIntervalSecs
@DataBoundSetter public void setPoolHealthCheckIntervalSecs(int poolHealthCheckIntervalSecs) -
getSessionMaxAgeSecs
public int getSessionMaxAgeSecs() -
setSessionMaxAgeSecs
@DataBoundSetter public void setSessionMaxAgeSecs(int sessionMaxAgeSecs) -
getSessionMaxUses
public int getSessionMaxUses() -
setSessionMaxUses
@DataBoundSetter public void setSessionMaxUses(int sessionMaxUses) -
getPoolIdleTimeoutSecs
public int getPoolIdleTimeoutSecs() -
setPoolIdleTimeoutSecs
@DataBoundSetter public void setPoolIdleTimeoutSecs(int poolIdleTimeoutSecs) -
isMaintenanceMode
public boolean isMaintenanceMode() -
setMaintenanceMode
@DataBoundSetter public void setMaintenanceMode(boolean maintenanceMode) -
getMaintenanceMessage
-
setMaintenanceMessage
-
getHostSelectionMode
DefaulthostSelectionModefor templates/build-steps that leave their own blank. -
setHostSelectionMode
-
getHostSelectionCandidates
DefaulthostSelectionCandidatesfor templates/build-steps that leave their own unset. -
setHostSelectionCandidates
-
hostSelectionOptions
public static HostSelectionOptions hostSelectionOptions(@CheckForNull vSphereCloud cloud, @CheckForNull Boolean requireCores, @CheckForNull Boolean requireMemory) Resolves the host selection refinements for one call site: the cloud's own defaults (or none, if there is nocloud), overridden by whatever the call site set explicitly. -
hostSelectionOptions
public static HostSelectionOptions hostSelectionOptions(@CheckForNull vSphereCloud cloud, @CheckForNull Boolean requireCores, @CheckForNull Boolean requireMemory, @CheckForNull Boolean requireAvailableMemory) As above, also for the "enough memory free right now" requirement. -
hostSelectionOptions
public static HostSelectionOptions hostSelectionOptions(@CheckForNull vSphereCloud cloud, @CheckForNull Boolean requireCores, @CheckForNull Boolean requireMemory, @CheckForNull Boolean requireAvailableMemory, @CheckForNull HostWeights weightsOverride) As above, also with the host weights a call site set for itself: ifweightsOverrideis not null it replaces the cloud's weights as a whole, else the cloud's apply. -
getHostSelectionCandidatesAsString
For the classic config UI textbox, and pipeline/JCasC callers that prefer a plain string. -
setHostSelectionCandidatesAsString
-
getHostWeightFreeCpuMhz
public int getHostWeightFreeCpuMhz() -
setHostWeightFreeCpuMhz
@DataBoundSetter public void setHostWeightFreeCpuMhz(int hostWeightFreeCpuMhz) Weight of a host's free CPU, in MHz (absolute), when ranking hosts; 0 = ignore. -
getHostWeightFreeCpuPercent
public int getHostWeightFreeCpuPercent() -
setHostWeightFreeCpuPercent
@DataBoundSetter public void setHostWeightFreeCpuPercent(int hostWeightFreeCpuPercent) Weight of a host's free CPU as a share of its capacity (relative), when ranking hosts; 0 = ignore. -
getHostWeightFreeMemoryMB
public int getHostWeightFreeMemoryMB() -
setHostWeightFreeMemoryMB
@DataBoundSetter public void setHostWeightFreeMemoryMB(int hostWeightFreeMemoryMB) Weight of a host's free memory, in MB (absolute), when ranking hosts; 0 = ignore. -
getHostWeightFreeMemoryPercent
public int getHostWeightFreeMemoryPercent() -
setHostWeightFreeMemoryPercent
@DataBoundSetter public void setHostWeightFreeMemoryPercent(int hostWeightFreeMemoryPercent) Weight of a host's free memory as a share of its capacity (relative), when ranking hosts; 0 = ignore. -
hostWeights
The four weights as one value;HostWeights.DEFAULTif none is set. -
isHostSelectionRequireCores
public boolean isHostSelectionRequireCores()Opt-in: only consider hosts with at least as many physical CPU cores as the VM has vCPUs. Off by default (oversubscribed sites). Default for every template/build-step using this cloud; each can override it either way. -
setHostSelectionRequireCores
@DataBoundSetter public void setHostSelectionRequireCores(boolean hostSelectionRequireCores) -
isHostSelectionRequireMemory
public boolean isHostSelectionRequireMemory()Opt-in: only consider hosts with at least as much physical RAM as the VM is configured with. Off by default (oversubscribed sites). Default for every template/build-step using this cloud; each can override it either way. -
setHostSelectionRequireMemory
@DataBoundSetter public void setHostSelectionRequireMemory(boolean hostSelectionRequireMemory) -
isHostSelectionRequireAvailableMemory
public boolean isHostSelectionRequireAvailableMemory()Opt-in: only consider hosts that currently have at least as much memory free as the VM is configured with, so the new VM does not get swapped by the hypervisor. Default for every template/build-step using this cloud; each can override it either way. -
setHostSelectionRequireAvailableMemory
@DataBoundSetter public void setHostSelectionRequireAvailableMemory(boolean hostSelectionRequireAvailableMemory) -
getPassword
-
getUsername
-
getVsDescription
-
getVsHost
-
getAllowUntrustedCertificate
public boolean getAllowUntrustedCertificate() -
getVsConnectionConfig
-
getHash
public final int getHash() -
vSphereInstance
- Throws:
VSphereException
-
waitWhileInMaintenanceMode
If this cloud (or whichevervSphereCloudinstance now holds its configuration - Jenkins constructs a brand-newCloudinstance on every reconfiguration rather than mutating the existing one, seeresolveCurrentInstance()) is in maintenance mode, logs the configured message tolistenerand blocks the calling thread, polling everyMAINTENANCE_POLL_INTERVAL_MS, until maintenance mode is turned off. Returns immediately if the cloud is not currently in maintenance mode.- Throws:
InterruptedException
-
canProvision
- Overrides:
canProvisionin classCloud
-
provision
-
preProvisionNodes
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void preProvisionNodes(vSphereCloudSlaveTemplate template) Pre-provisions nodes per template to save time on a VM boot.- Parameters:
template-
-
toString
-
canMarkVMOnline
-
markVMOnline
-
markVMOffline
-
findAllVsphereClouds
-
findAllVsphereCloudNames
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Cloud>- Overrides:
getDescriptorin classCloud
-