From c3c11453b98e1c048c118d2c982c8bc13224cb49 Mon Sep 17 00:00:00 2001 From: Anwitha U N Date: Mon, 7 Sep 2026 10:26:17 +0530 Subject: [PATCH 1/3] fix guest-customization sshpass failure --- test/e2e/fixtures/yaml/podvm/podvm.yaml.in | 17 +++++++++++++++-- test/e2e/vmservice/vmservice/util.go | 11 ++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/test/e2e/fixtures/yaml/podvm/podvm.yaml.in b/test/e2e/fixtures/yaml/podvm/podvm.yaml.in index d5d88195a8..48e7f76f0e 100644 --- a/test/e2e/fixtures/yaml/podvm/podvm.yaml.in +++ b/test/e2e/fixtures/yaml/podvm/podvm.yaml.in @@ -42,8 +42,21 @@ spec: args: - | rm -f /etc/yum.repos.d/photon-updates.repo /etc/yum.repos.d/photon-extras.repo - yum install -y iputils openssh-server sshpass - mkdir /root/.ssh + mkdir -p /root/.ssh + + attempt=0 + max_attempts=10 + until yum install -y iputils openssh-server sshpass >>/root/.install.log 2>&1; do + attempt=$((attempt + 1)) + if [ "$attempt" -ge "$max_attempts" ]; then + echo "yum install failed after ${attempt} attempts" >>/root/.install.log + echo "failed" > /root/.failed + while true; do sleep 30; done + fi + echo "yum install attempt ${attempt} failed, retrying in 15s..." >>/root/.install.log + sleep 15 + done + echo > /root/.completed while true; do sleep 30; done {{- if or .PrivateKeySecretName .CustomUserPrivateKeySecretName }} diff --git a/test/e2e/vmservice/vmservice/util.go b/test/e2e/vmservice/vmservice/util.go index c1b4bc46c3..23129a8c10 100644 --- a/test/e2e/vmservice/vmservice/util.go +++ b/test/e2e/vmservice/vmservice/util.go @@ -678,11 +678,20 @@ func VerifyLoginAndRunCmdsInNSXSetup(ctx context.Context, config *config.E2EConf namespace string, podVMName string, vmIP string, cmds []string, expectedOutput []string) { framework.Logf("will attempt to ssh into %s using jumpbox podvm", vmIP) - Eventually(func() bool { + Eventually(func(g Gomega) bool { stdout, err := clusterProxy.Exec(ctx, "-it", "jumpbox", "-n", namespace, "--", "sshpass", "-V") if err == nil && stdout != nil { return true } + + // The install script on the jumpbox PodVM marks /root/.failed once it gives + // up retrying yum install; fail fast with the real error instead of burning + // the full timeout on a install that will never succeed. + if failMarker, ferr := clusterProxy.Exec(ctx, "jumpbox", "-n", namespace, "--", "cat", "/root/.failed"); ferr == nil && len(failMarker) > 0 { + installLog, _ := clusterProxy.Exec(ctx, "jumpbox", "-n", namespace, "--", "cat", "/root/.install.log") + g.Expect(false).To(BeTrue(), "jumpbox PodVM failed to install sshpass permanently:\n%s", string(installLog)) + } + // The Exec function will output an error message on each failure. // Add a log here to clarify that retries are expected behavior. framework.Logf("sshpass not yet installed on jumpbox PodVM, retrying...") From dffe7cdc5283d8d409845df51f6883f25241f74b Mon Sep 17 00:00:00 2001 From: Anwitha U N Date: Mon, 7 Sep 2026 16:07:55 +0530 Subject: [PATCH 2/3] fix guest-customization test failure --- test/e2e/vmservice/config/wcp.yaml | 6 ++++ .../virtualmachine/vm_guestcustomization.go | 29 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/test/e2e/vmservice/config/wcp.yaml b/test/e2e/vmservice/config/wcp.yaml index d6fb03c1d6..3603c42c54 100644 --- a/test/e2e/vmservice/config/wcp.yaml +++ b/test/e2e/vmservice/config/wcp.yaml @@ -111,3 +111,9 @@ intervals: # Empirically, Sysprep GOSC on this image reliably reports an IP in # 5.5-6 minutes so this spec needs a little more room. windows-sysprep/wait-virtual-machine-vmip: ["10m", "3s"] + + # linux-guest-customization overrides apply only to specs that boot VMs + # with LinuxPrep guest customization (VMGOSCSpec's LinuxPrep and vAppConfig + # contexts). LinuxPrep customization triggers a guest network restart/reboot + # that can push the guest's IP report past the default 5m budget. + linux-guest-customization/wait-virtual-machine-vmip: ["8m", "3s"] diff --git a/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go b/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go index 78c13e8307..4fd834c68f 100644 --- a/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go +++ b/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go @@ -845,7 +845,34 @@ func VMGOSCSpec(ctx context.Context, inputGetter func() VMGOSCSpecInput) { }) It("should successfully apply vAppConfig properties to VM", Label("experimental"), func() { - createAndVerifyVM(ctx, v1a2vmParameters, true) + // The IP wait is rolled inline rather than createAndVerifyVM / + // vmoperator.WaitForVirtualMachineIP so this spec can use the + // longer "linux-guest-customization" interval (see wcp.yaml) + // without changing that shared helper's timeout for every + // other caller -- the LinuxPrep customization used here + // triggers a guest network restart/reboot that can push the + // guest's IP report past the default budget, the same + // reasoning as the "windows-sysprep" override used for + // Sysprep VMs. + vmYaml = manifestbuilders.GetVirtualMachineYamlA2(v1a2vmParameters) + Expect(clusterProxy.CreateWithArgs(ctx, vmYaml)).To(Succeed(), "failed to create virtualmachine", string(vmYaml)) + + By(fmt.Sprintf("Verify that a single VirtualMachine '%s/%s' is created", input.WCPNamespaceName, vmName)) + vmoperator.WaitForVirtualMachineToExist(ctx, config, svClusterClient, input.WCPNamespaceName, vmName) + vmoperator.WaitForVirtualMachineConditionCreated(ctx, config, svClusterClient, input.WCPNamespaceName, vmName) + vmoperator.WaitForVirtualMachinePowerState(ctx, config, svClusterClient, input.WCPNamespaceName, vmName, string(vmopv1.VirtualMachinePowerStateOn)) + + By(fmt.Sprintf("Verify that an IP (ipv4) is allocated to the VirtualMachine '%s/%s'", input.WCPNamespaceName, vmName)) + Eventually(func() bool { + vm, err := utils.GetVirtualMachine(ctx, svClusterClient, input.WCPNamespaceName, vmName) + if err != nil { + return false + } + + return vm.Status.Network != nil && + vm.Status.Network.PrimaryIP4 != "" && + net.ParseIP(vm.Status.Network.PrimaryIP4).To4() != nil + }, config.GetIntervals("linux-guest-customization", "wait-virtual-machine-vmip")...).Should(BeTrue()) // Verify that the vAppConfig properties are actually applied to the VM vmmoid := vmoperator.GetVirtualMachineMOID(ctx, svClusterClient, input.WCPNamespaceName, vmName) From 0b4979f1d548b740665e97261a851d9118feabed Mon Sep 17 00:00:00 2001 From: Anwitha U N Date: Tue, 8 Sep 2026 12:50:32 +0530 Subject: [PATCH 3/3] Revert "fix guest-customization test failure" This reverts commit dffe7cdc5283d8d409845df51f6883f25241f74b. --- test/e2e/vmservice/config/wcp.yaml | 6 ---- .../virtualmachine/vm_guestcustomization.go | 29 +------------------ 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/test/e2e/vmservice/config/wcp.yaml b/test/e2e/vmservice/config/wcp.yaml index 3603c42c54..d6fb03c1d6 100644 --- a/test/e2e/vmservice/config/wcp.yaml +++ b/test/e2e/vmservice/config/wcp.yaml @@ -111,9 +111,3 @@ intervals: # Empirically, Sysprep GOSC on this image reliably reports an IP in # 5.5-6 minutes so this spec needs a little more room. windows-sysprep/wait-virtual-machine-vmip: ["10m", "3s"] - - # linux-guest-customization overrides apply only to specs that boot VMs - # with LinuxPrep guest customization (VMGOSCSpec's LinuxPrep and vAppConfig - # contexts). LinuxPrep customization triggers a guest network restart/reboot - # that can push the guest's IP report past the default 5m budget. - linux-guest-customization/wait-virtual-machine-vmip: ["8m", "3s"] diff --git a/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go b/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go index 4fd834c68f..78c13e8307 100644 --- a/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go +++ b/test/e2e/vmservice/vmservice/virtualmachine/vm_guestcustomization.go @@ -845,34 +845,7 @@ func VMGOSCSpec(ctx context.Context, inputGetter func() VMGOSCSpecInput) { }) It("should successfully apply vAppConfig properties to VM", Label("experimental"), func() { - // The IP wait is rolled inline rather than createAndVerifyVM / - // vmoperator.WaitForVirtualMachineIP so this spec can use the - // longer "linux-guest-customization" interval (see wcp.yaml) - // without changing that shared helper's timeout for every - // other caller -- the LinuxPrep customization used here - // triggers a guest network restart/reboot that can push the - // guest's IP report past the default budget, the same - // reasoning as the "windows-sysprep" override used for - // Sysprep VMs. - vmYaml = manifestbuilders.GetVirtualMachineYamlA2(v1a2vmParameters) - Expect(clusterProxy.CreateWithArgs(ctx, vmYaml)).To(Succeed(), "failed to create virtualmachine", string(vmYaml)) - - By(fmt.Sprintf("Verify that a single VirtualMachine '%s/%s' is created", input.WCPNamespaceName, vmName)) - vmoperator.WaitForVirtualMachineToExist(ctx, config, svClusterClient, input.WCPNamespaceName, vmName) - vmoperator.WaitForVirtualMachineConditionCreated(ctx, config, svClusterClient, input.WCPNamespaceName, vmName) - vmoperator.WaitForVirtualMachinePowerState(ctx, config, svClusterClient, input.WCPNamespaceName, vmName, string(vmopv1.VirtualMachinePowerStateOn)) - - By(fmt.Sprintf("Verify that an IP (ipv4) is allocated to the VirtualMachine '%s/%s'", input.WCPNamespaceName, vmName)) - Eventually(func() bool { - vm, err := utils.GetVirtualMachine(ctx, svClusterClient, input.WCPNamespaceName, vmName) - if err != nil { - return false - } - - return vm.Status.Network != nil && - vm.Status.Network.PrimaryIP4 != "" && - net.ParseIP(vm.Status.Network.PrimaryIP4).To4() != nil - }, config.GetIntervals("linux-guest-customization", "wait-virtual-machine-vmip")...).Should(BeTrue()) + createAndVerifyVM(ctx, v1a2vmParameters, true) // Verify that the vAppConfig properties are actually applied to the VM vmmoid := vmoperator.GetVirtualMachineMOID(ctx, svClusterClient, input.WCPNamespaceName, vmName)