Class ReconfigureStep
java.lang.Object
hudson.model.AbstractDescribableImpl<ReconfigureStep>
org.jenkinsci.plugins.vsphere.builders.ReconfigureStep
- All Implemented Interfaces:
ExtensionPoint,Describable<ReconfigureStep>
- Direct Known Subclasses:
ReconfigureAnnotation,ReconfigureCpu,ReconfigureDisk,ReconfigureMemory,ReconfigureNetworkAdapters
public abstract class ReconfigureStep
extends AbstractDescribableImpl<ReconfigureStep>
implements ExtensionPoint
Define a base class for all Reconfigure Acion steps. All Reconfigure Action steps should extend
this class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classstatic interfaceSends a reconfiguration to vCenter.static interfaceWhat to do with one step when building the reconfiguration.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionall()protected EnvVarsextractEnvironment(Run<?, ?> run, TaskListener listener) A stricter-than-necessary step may offer a more lenient variant of itself, to be used for one retry when vCenter refuses the reconfiguration (e.g.protected com.vmware.vim25.VirtualDevicefindDeviceByLabel(com.vmware.vim25.VirtualDevice[] devices, String label) com.vmware.vim25.VirtualMachineConfigSpeccom.vmware.vim25.mo.VirtualMachinegetVM()abstract voidperform(EnvVars env, TaskListener listener) booleanperform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) Flavour for freestyle builds, kept for callers that still use it: it does exactly what theRunflavour does, so that a failure is reported by exception rather than swallowed (JENKINS-38472).abstract voidperform(Run<?, ?> run, FilePath filePath, Launcher launcher, TaskListener listener) static voidreconfigureVm(VSphere vsphere, com.vmware.vim25.mo.VirtualMachine vm, List<? extends ReconfigureStep> steps, ReconfigureStep.StepAction action, ReconfigureStep.SpecSubmitter submit, PrintStream log) Builds one reconfiguration out of all the steps and submits it.voidsetVirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec spec) voidsetVM(com.vmware.vim25.mo.VirtualMachine vm) voidsetVsphere(VSphere vsphere) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Describable
getDescriptor
-
Field Details
-
spec
protected com.vmware.vim25.VirtualMachineConfigSpec spec -
vm
protected com.vmware.vim25.mo.VirtualMachine vm -
vsphere
-
-
Constructor Details
-
ReconfigureStep
public ReconfigureStep()
-
-
Method Details
-
getVsphere
-
setVsphere
-
getVM
public com.vmware.vim25.mo.VirtualMachine getVM() -
setVM
public void setVM(com.vmware.vim25.mo.VirtualMachine vm) -
getVirtualMachineConfigSpec
public com.vmware.vim25.VirtualMachineConfigSpec getVirtualMachineConfigSpec() -
setVirtualMachineConfigSpec
public void setVirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec spec) -
fallbackVariant
A stricter-than-necessary step may offer a more lenient variant of itself, to be used for one retry when vCenter refuses the reconfiguration (e.g. a MAC address that cannot be set as a manual one, JENKINS-34001). The variant is a new instance, so the step as configured is never modified.- Returns:
- the variant to retry with, or null if this step has none
-
reconfigureVm
public static void reconfigureVm(VSphere vsphere, com.vmware.vim25.mo.VirtualMachine vm, List<? extends ReconfigureStep> steps, ReconfigureStep.StepAction action, ReconfigureStep.SpecSubmitter submit, PrintStream log) throws VSphereException, IOException, InterruptedException Builds one reconfiguration out of all the steps and submits it. If vCenter refuses it and some of the steps have a more lenientfallbackVariant(), builds it again with those and submits it once more.- Parameters:
action- performs a step, after it has been told which VM, vSphere and spec to work withsubmit- sends the built reconfiguration to vCenter- Throws:
VSphereExceptionIOExceptionInterruptedException
-
all
-
perform
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOExceptionFlavour for freestyle builds, kept for callers that still use it: it does exactly what theRunflavour does, so that a failure is reported by exception rather than swallowed (JENKINS-38472).- Throws:
InterruptedExceptionIOException
-
perform
public abstract void perform(@NonNull Run<?, ?> run, FilePath filePath, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException- Throws:
InterruptedExceptionIOException
-
perform
public abstract void perform(@NonNull EnvVars env, @NonNull TaskListener listener) throws VSphereException - Throws:
VSphereException
-
findDeviceByLabel
protected com.vmware.vim25.VirtualDevice findDeviceByLabel(com.vmware.vim25.VirtualDevice[] devices, String label) -
extractEnvironment
- Throws:
VSphereException
-