From 4a57230fd83d73c9e38b460f4ff174f487157df1 Mon Sep 17 00:00:00 2001 From: Miguel Duarte Barroso Date: Thu, 19 Dec 2024 12:38:29 +0100 Subject: [PATCH 1/2] Revert "virt: assert network is ready in each node before starting workloads" This reverts commit f6379e5479701c156c781f9ec9940fe0c9635aad. Signed-off-by: Miguel Duarte Barroso --- test/extended/networking/livemigration.go | 39 +---------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/test/extended/networking/livemigration.go b/test/extended/networking/livemigration.go index cbb05adef74d..21e683c9f669 100644 --- a/test/extended/networking/livemigration.go +++ b/test/extended/networking/livemigration.go @@ -77,16 +77,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F isDualStack := getIPFamilyForCluster(f) == DualStack - provisionedNetConfig := createNetworkFn(netConfig) - - for _, node := range workerNodes { - Eventually(func() bool { - isNetProvisioned, err := isNetworkProvisioned(oc, node.Name, provisionedNetConfig.networkName) - return err == nil && isNetProvisioned - }).WithPolling(time.Second).WithTimeout(udnCrReadyTimeout).Should( - BeTrueBecause("the network must be ready before creating workloads"), - ) - } + _ = createNetworkFn(netConfig) httpServerPods := prepareHTTPServerPods(f, netConfig, workerNodes) vmCreationParams := kubevirt.CreationTemplateParams{ @@ -537,34 +528,6 @@ func checkEastWestTraffic(virtClient *kubevirt.Client, vmiName string, podIPsByN } } } - -func isNetworkProvisioned(oc *exutil.CLI, nodeName string, networkName string) (bool, error) { - ovnkubePodInfo, err := ovnkubePod(oc, nodeName) - if err != nil { - return false, err - } - - lsName := logicalSwitchName(networkName) - out, err := adminExecInPod( - oc, - "openshift-ovn-kubernetes", - ovnkubePodInfo.podName, - ovnkubePodInfo.containerName, - fmt.Sprintf("ovn-nbctl list logical-switch %s", lsName), - ) - if err != nil { - return false, fmt.Errorf("failed to find a logical switch for network %q: %w", networkName, err) - } - - return strings.Contains(out, lsName), nil -} - -func logicalSwitchName(networkName string) string { - netName := strings.ReplaceAll(networkName, "-", ".") - netName = strings.ReplaceAll(netName, "/", ".") - return fmt.Sprintf("%s_ovn_layer2_switch", netName) -} - func networkName(netSpecConfig string) string { GinkgoHelper() type netConfig struct { From a33f9d180333dc885c4fccd8010f9101dc976709 Mon Sep 17 00:00:00 2001 From: Miguel Duarte Barroso Date: Thu, 19 Dec 2024 12:40:17 +0100 Subject: [PATCH 2/2] Revert "virt, persistent ips: figure out provisioned network name" This reverts commit bd2c912474ce74957d21827fca96230d908a9881. Signed-off-by: Miguel Duarte Barroso --- test/extended/networking/livemigration.go | 24 ++++------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/test/extended/networking/livemigration.go b/test/extended/networking/livemigration.go index 21e683c9f669..d5fdc91e8553 100644 --- a/test/extended/networking/livemigration.go +++ b/test/extended/networking/livemigration.go @@ -64,7 +64,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F ) DescribeTableSubtree("created using", - func(createNetworkFn func(netConfig networkAttachmentConfigParams) networkAttachmentConfig) { + func(createNetworkFn func(netConfig networkAttachmentConfigParams)) { DescribeTable("[Suite:openshift/network/virtualization] should keep ip", func(netConfig networkAttachmentConfigParams, vmResource string, opCmd func(cli *kubevirt.Client, vmNamespace, vmName string)) { var err error @@ -77,7 +77,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F isDualStack := getIPFamilyForCluster(f) == DualStack - _ = createNetworkFn(netConfig) + createNetworkFn(netConfig) httpServerPods := prepareHTTPServerPods(f, netConfig, workerNodes) vmCreationParams := kubevirt.CreationTemplateParams{ @@ -183,25 +183,18 @@ var _ = Describe("[sig-network][OCPFeatureGate:PersistentIPsForVirtualization][F restartVM, )) }, - Entry("NetworkAttachmentDefinitions", func(c networkAttachmentConfigParams) networkAttachmentConfig { + Entry("NetworkAttachmentDefinitions", func(c networkAttachmentConfigParams) { netConfig := newNetworkAttachmentConfig(c) nad := generateNAD(netConfig) By(fmt.Sprintf("Creating NetworkAttachmentDefinitions %s/%s", nad.Namespace, nad.Name)) _, err := nadClient.NetworkAttachmentDefinitions(c.namespace).Create(context.Background(), nad, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) - return netConfig }), - Entry("UserDefinedNetwork", func(c networkAttachmentConfigParams) networkAttachmentConfig { + Entry("UserDefinedNetwork", func(c networkAttachmentConfigParams) { udnManifest := generateUserDefinedNetworkManifest(&c) By(fmt.Sprintf("Creating UserDefinedNetwork %s/%s", c.namespace, c.name)) Expect(applyManifest(c.namespace, udnManifest)).To(Succeed()) Expect(waitForUserDefinedNetworkReady(c.namespace, c.name, udnCrReadyTimeout)).To(Succeed()) - - nad, err := nadClient.NetworkAttachmentDefinitions(c.namespace).Get( - context.Background(), c.name, metav1.GetOptions{}, - ) - Expect(err).NotTo(HaveOccurred()) - return networkAttachmentConfig{networkAttachmentConfigParams{networkName: networkName(nad.Spec.Config)}} })) }) }) @@ -528,12 +521,3 @@ func checkEastWestTraffic(virtClient *kubevirt.Client, vmiName string, podIPsByN } } } -func networkName(netSpecConfig string) string { - GinkgoHelper() - type netConfig struct { - Name string `json:"name,omitempty"` - } - var nc netConfig - Expect(json.Unmarshal([]byte(netSpecConfig), &nc)).To(Succeed()) - return nc.Name -}