diff --git a/doc/testing-virtual-machine.md b/doc/testing-virtual-machine.md new file mode 100644 index 000000000..84cf9f323 --- /dev/null +++ b/doc/testing-virtual-machine.md @@ -0,0 +1,33 @@ +## E2E conformance test + +It's possible to use QEMU to test the SR-IOV operator on a virtual kubernetes/openshift cluster. +Using the IGB model network driver allow to create virtual functions on the virtual system + +## How to test + +First you will need to enable the `DEV_MOD` via the operator environment variable. +Second step is to add the intel virtual nic to the supported nics configmap. + +``` +Intel_ixgbe_82576: 8086 10c9 10ca +``` + +Another requirement is to load the vfio kernel module with no_iommu configuration. Example systemd: + +``` +[Unit] +Description=vfio no-iommu +Before=kubelet.service crio.service node-valid-hostname.service + +[Service] +# Need oneshot to delay kubelet +Type=oneshot +ExecStart=/usr/bin/bash -c "modprobe vfio enable_unsafe_noiommu_mode=1" +StandardOutput=journal+console +StandardError=journal+console + +[Install] +WantedBy=network-online.target +``` + +# TBD \ No newline at end of file diff --git a/test/conformance/tests/test_sriov_operator.go b/test/conformance/tests/test_sriov_operator.go index d093ba326..0f43a6f9d 100644 --- a/test/conformance/tests/test_sriov_operator.go +++ b/test/conformance/tests/test_sriov_operator.go @@ -511,6 +511,11 @@ var _ = Describe("[sriov] operator", func() { // 25961 It("Should configure the the link state variable", func() { + if cluster.VirtualCluster() { + // https://bugzilla.redhat.com/show_bug.cgi?id=2214976 + Skip("Bug in IGB driver") + } + sriovNetwork := &sriovv1.SriovNetwork{ ObjectMeta: metav1.ObjectMeta{Name: "test-statenetwork", Namespace: operatorNamespace}, Spec: sriovv1.SriovNetworkSpec{ @@ -1161,6 +1166,11 @@ var _ = Describe("[sriov] operator", func() { Context("PF shutdown", func() { // 29398 It("Should be able to create pods successfully if PF is down.Pods are able to communicate with each other on the same node", func() { + if cluster.VirtualCluster() { + // https://bugzilla.redhat.com/show_bug.cgi?id=2214976 + Skip("Bug in IGB driver") + } + resourceName := testResourceName var testNode string var unusedSriovDevice *sriovv1.InterfaceExt @@ -1210,6 +1220,11 @@ var _ = Describe("[sriov] operator", func() { Context("MTU", func() { BeforeEach(func() { + if cluster.VirtualCluster() { + // https://bugzilla.redhat.com/show_bug.cgi?id=2214977 + Skip("Bug in IGB driver") + } + var node string resourceName := "mturesource" var numVfs int @@ -1305,7 +1320,6 @@ var _ = Describe("[sriov] operator", func() { ResourceName: resourceName, IPAM: `{"type":"host-local","subnet":"10.10.10.0/24","rangeStart":"10.10.10.171","rangeEnd":"10.10.10.181","routes":[{"dst":"0.0.0.0/0"}],"gateway":"10.10.10.1"}`, NetworkNamespace: namespaces.Test, - LinkState: "enable", }} // We need this to be able to run the connectivity checks on Mellanox cards @@ -1626,7 +1640,6 @@ var _ = Describe("[sriov] operator", func() { ResourceName: resourceName, IPAM: `{"type":"host-local","subnet":"10.10.10.0/24","rangeStart":"10.10.10.171","rangeEnd":"10.10.10.181","routes":[{"dst":"0.0.0.0/0"}],"gateway":"10.10.10.1"}`, NetworkNamespace: namespaces.Test, - LinkState: "enable", }} // We need this to be able to run the connectivity checks on Mellanox cards @@ -1981,9 +1994,9 @@ func createCustomTestPod(node string, networks []string, hostNetwork bool, podCa Expect(err).ToNot(HaveOccurred()) return runningPod.Status.Phase }, 5*time.Minute, 1*time.Second).Should(Equal(corev1.PodRunning)) - pod, err := clients.Pods(namespaces.Test).Get(context.Background(), createdPod.Name, metav1.GetOptions{}) + podObj, err := clients.Pods(namespaces.Test).Get(context.Background(), createdPod.Name, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - return pod + return podObj } func pingPod(ip string, nodeSelector string, sriovNetworkAttachment string) { diff --git a/test/util/cluster/cluster.go b/test/util/cluster/cluster.go index 430a96077..fc6a1eab5 100644 --- a/test/util/cluster/cluster.go +++ b/test/util/cluster/cluster.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "os" "strings" "time" @@ -28,8 +29,8 @@ type EnabledNodes struct { } var ( - supportedPFDrivers = []string{"mlx5_core", "i40e", "ixgbe", "ice"} - supportedVFDrivers = []string{"iavf", "vfio-pci", "mlx5_core"} + supportedPFDrivers = []string{"mlx5_core", "i40e", "ixgbe", "ice", "igb"} + supportedVFDrivers = []string{"iavf", "vfio-pci", "mlx5_core", "igbvf"} mlxVendorID = "15b3" intelVendorID = "8086" ) @@ -331,3 +332,10 @@ func GetNodeSecureBootState(clients *testclient.ClientSet, nodeName, namespace s return strings.Contains(stdout, "[integrity]") || strings.Contains(stdout, "[confidentiality]"), nil } + +func VirtualCluster() bool { + if v, exist := os.LookupEnv("VIRTUAL_ENV"); exist && v != "" { + return true + } + return false +} diff --git a/test/util/network/network.go b/test/util/network/network.go index 623f873c0..7b67777d7 100644 --- a/test/util/network/network.go +++ b/test/util/network/network.go @@ -12,6 +12,7 @@ import ( sriovv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1" testclient "github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/client" + "github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/cluster" ) // Needed for parsing of podinfo @@ -37,6 +38,10 @@ func CreateSriovNetwork(clientSet *testclient.ClientSet, intf *sriovv1.Interface LinkState: "enable", }} + if cluster.VirtualCluster() { + sriovNetwork.Spec.LinkState = "" + } + for _, o := range options { o(sriovNetwork) }