diff --git a/pom.xml b/pom.xml index 733bc8c8..05a0e984 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 2.22 + 2.29 vsphere-cloud @@ -32,14 +32,14 @@ A business-friendly OSS license - + scm:git:https://github.com/jenkinsci/vsphere-cloud-plugin.git scm:git:https://git@github.com/jenkinsci/vsphere-cloud-plugin.git https://github.com/jenkinsci/vsphere-cloud-plugin HEAD - - + + UTF-8 @@ -58,7 +58,7 @@ http://repo.jenkins-ci.org/public/ - + org.kohsuke.stapler @@ -106,7 +106,7 @@ org.jenkins-ci.tools maven-hpi-plugin - true + false diff --git a/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java b/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java index 5bc448e9..746107ee 100644 --- a/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java +++ b/src/main/java/org/jenkinsci/plugins/vSphereCloudLauncher.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package org.jenkinsci.plugins; import hudson.Util; @@ -66,20 +62,30 @@ public vSphereCloudLauncher(ComputerLauncher launcher, this.waitForVMTools = waitForVMTools; this.snapName = snapName; this.launchDelay = Util.tryParseNumber(launchDelay, 60).intValue(); - if ("Shutdown".equals(idleOption)) { - idleAction = MACHINE_ACTION.SHUTDOWN; - } else if ("Shutdown and Revert".equals(idleOption)) { - idleAction = MACHINE_ACTION.REVERT; - } else if ("Revert and Restart".equals(idleOption)) { - idleAction = MACHINE_ACTION.REVERT_AND_RESTART; - } else if ("Revert and Reset".equals(idleOption)) { - idleAction = MACHINE_ACTION.REVERT_AND_RESET; - } else if ("Reset".equals(idleOption)) { - idleAction = MACHINE_ACTION.RESET; - } else if ("Suspend".equals(idleOption)) { - idleAction = MACHINE_ACTION.SUSPEND; - } else { + if (null == idleOption) { idleAction = MACHINE_ACTION.NOTHING; + } else switch (idleOption) { + case "Shutdown": + idleAction = MACHINE_ACTION.SHUTDOWN; + break; + case "Shutdown and Revert": + idleAction = MACHINE_ACTION.REVERT; + break; + case "Revert and Restart": + idleAction = MACHINE_ACTION.REVERT_AND_RESTART; + break; + case "Revert and Reset": + idleAction = MACHINE_ACTION.REVERT_AND_RESET; + break; + case "Reset": + idleAction = MACHINE_ACTION.RESET; + break; + case "Suspend": + idleAction = MACHINE_ACTION.SUSPEND; + break; + default: + idleAction = MACHINE_ACTION.NOTHING; + break; } this.LimitedTestRunCount = Util.tryParseNumber(LimitedTestRunCount, 0).intValue(); } @@ -336,19 +342,25 @@ public synchronized void afterDisconnect(SlaveComputer slaveComputer, TaskListen case NOTHING: break; } - if (localIdle == MACHINE_ACTION.REVERT) { - revertVM(vm, vsC, slaveComputer, taskListener); - } else if (localIdle == MACHINE_ACTION.REVERT_AND_RESTART) { - revertVM(vm, vsC, slaveComputer, taskListener); - if (power == VirtualMachinePowerState.poweredOn) { - // Some time is needed for the VMWare Tools to reactivate - Thread.sleep(60000); - shutdownVM(vm, slaveComputer, taskListener); - } - powerOnVM(vm, slaveComputer, taskListener); - } else if (localIdle == MACHINE_ACTION.REVERT_AND_RESET) { - revertVM(vm, vsC, slaveComputer, taskListener); - resetVM(vm, slaveComputer, taskListener); + switch (localIdle) { + case REVERT: + revertVM(vm, vsC, slaveComputer, taskListener); + break; + case REVERT_AND_RESTART: + revertVM(vm, vsC, slaveComputer, taskListener); + if (power == VirtualMachinePowerState.poweredOn) { + // Some time is needed for the VMWare Tools to reactivate + Thread.sleep(60000); + shutdownVM(vm, slaveComputer, taskListener); + } + powerOnVM(vm, slaveComputer, taskListener); + break; + case REVERT_AND_RESET: + revertVM(vm, vsC, slaveComputer, taskListener); + resetVM(vm, slaveComputer, taskListener); + break; + default: + break; } } else { // VM is already powered down. diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java b/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java index dd3acd1e..ca7993a7 100644 --- a/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java +++ b/src/main/java/org/jenkinsci/plugins/vsphere/builders/ReconfigureCpu.java @@ -15,7 +15,6 @@ package org.jenkinsci.plugins.vsphere.builders; import hudson.*; -import hudson.Extension; import hudson.model.AbstractBuild; import hudson.model.BuildListener; import hudson.model.Run; diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java b/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java index 8ea98493..1337cf87 100644 --- a/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java +++ b/src/main/java/org/jenkinsci/plugins/vsphere/tools/CloudProvisioningRecord.java @@ -123,7 +123,7 @@ private boolean hasFiniteCapacity() { private double calcFullness() { final int maxToProvision = calcMaxToProvision(); - return ((double) calcCurrentCommitment()) / (double) maxToProvision; + return calcCurrentCommitment() / (double) maxToProvision; } boolean hasCapacityForMore() { diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index d147e4cb..cc069743 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly index e8d5b4c6..7ce3d623 100644 --- a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config-inner.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly index eed912e5..a5110ed6 100644 --- a/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloud/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly index 660d38ad..59fd6709 100644 --- a/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloudLauncher/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly b/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly index 60afad70..036bbb48 100644 --- a/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vSphereCloudSlave/configure-entries.jelly @@ -1,6 +1,7 @@ + - +
diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/RunOnceCloudRetentionStrategy/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/RunOnceCloudRetentionStrategy/config.jelly index 6a1f1307..60b082a4 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/RunOnceCloudRetentionStrategy/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/RunOnceCloudRetentionStrategy/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereBuildStepContainer/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereBuildStepContainer/config.jelly index 49b4d065..1af00819 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereBuildStepContainer/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereBuildStepContainer/config.jelly @@ -17,7 +17,7 @@ limitations under the License. - + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereCloudRetentionStrategy/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereCloudRetentionStrategy/config.jelly index 22ee42f9..8107be0c 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereCloudRetentionStrategy/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereCloudRetentionStrategy/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereGuestInfoProperty/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereGuestInfoProperty/config.jelly index 16eabe89..2c288c63 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereGuestInfoProperty/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/VSphereGuestInfoProperty/config.jelly @@ -1,3 +1,4 @@ +
diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Clone/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Clone/config.jelly index 7bb6fbf1..2b35af8b 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Clone/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Clone/config.jelly @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToTemplate/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToTemplate/config.jelly index 9a6b3f1f..d9336615 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToTemplate/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToTemplate/config.jelly @@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + - - - - - - - - - + + + + + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToVm/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToVm/config.jelly index 8e1f3394..f7ed6dd0 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToVm/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ConvertToVm/config.jelly @@ -13,19 +13,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + - - - - - - - + + + - - - + + + - + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Delete/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Delete/config.jelly index 624abc4c..960f7b1a 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Delete/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Delete/config.jelly @@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - - - + + + + + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/DeleteSnapshot/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/DeleteSnapshot/config.jelly index 2fe62a5c..0c3cde5f 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/DeleteSnapshot/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/DeleteSnapshot/config.jelly @@ -13,23 +13,24 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Deploy/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Deploy/config.jelly index 1b7063da..5441f3c3 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Deploy/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Deploy/config.jelly @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ExposeGuestInfo/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ExposeGuestInfo/config.jelly index fe3460a0..feb2007b 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ExposeGuestInfo/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/ExposeGuestInfo/config.jelly @@ -13,19 +13,20 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - + + + + + + + + + + + - - - - - + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOff/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOff/config.jelly index 86799e4a..ccb3e739 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOff/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOff/config.jelly @@ -13,21 +13,22 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOn/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOn/config.jelly index 54af62f5..50a1715f 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOn/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/PowerOn/config.jelly @@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - - - + + + + + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Reconfigure/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Reconfigure/config.jelly index a495bbbc..3070f743 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Reconfigure/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Reconfigure/config.jelly @@ -13,9 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - + @@ -53,5 +54,5 @@ limitations under the License. - + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Rename/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Rename/config.jelly index ce47959d..05d256ee 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Rename/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/Rename/config.jelly @@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - + + + + + + + - - - - - + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RenameSnapshot/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RenameSnapshot/config.jelly index 09878578..a2712164 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RenameSnapshot/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RenameSnapshot/config.jelly @@ -13,14 +13,15 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - + + @@ -30,6 +31,6 @@ limitations under the License. - - + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RevertToSnapshot/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RevertToSnapshot/config.jelly index e638eaa7..074fc0ce 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RevertToSnapshot/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/RevertToSnapshot/config.jelly @@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - - - + + + + + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/SuspendVm/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/SuspendVm/config.jelly index ea59c029..9286e853 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/SuspendVm/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/SuspendVm/config.jelly @@ -13,11 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/TakeSnapshot/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/TakeSnapshot/config.jelly index 3a1b8f1b..8d04a10d 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/builders/TakeSnapshot/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/builders/TakeSnapshot/config.jelly @@ -13,23 +13,24 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/config.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/config.jelly index 5076470d..a777496a 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/config.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/config.jelly @@ -13,5 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + \ No newline at end of file diff --git a/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/index.jelly b/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/index.jelly index 6e68b179..5115b641 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/index.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphere/parameters/CloudSelectorParameter/index.jelly @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + @@ -26,4 +27,3 @@ limitations under the License. - diff --git a/src/main/resources/org/jenkinsci/plugins/vsphereCloudProvisionedSlave/configure-entries.jelly b/src/main/resources/org/jenkinsci/plugins/vsphereCloudProvisionedSlave/configure-entries.jelly index 60afad70..036bbb48 100644 --- a/src/main/resources/org/jenkinsci/plugins/vsphereCloudProvisionedSlave/configure-entries.jelly +++ b/src/main/resources/org/jenkinsci/plugins/vsphereCloudProvisionedSlave/configure-entries.jelly @@ -1,6 +1,7 @@ + - +