@@ -21,6 +21,7 @@ import (
2121 "fmt"
2222
2323 . "github.com/onsi/ginkgo/v2"
24+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
2425 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526
2627 "github.com/deckhouse/virtualization/test/e2e/internal/framework"
@@ -49,7 +50,7 @@ func checkDummyHCDConfigured(ctx context.Context, f *framework.Framework) bool {
4950
5051 nodeUSBList , err := virtClient .NodeUSBDevices ().List (ctx , metav1.ListOptions {})
5152 if err != nil {
52- _ , _ = fmt . Fprintf ( GinkgoWriter , "failed to list NodeUSBDevices: %v\n " , err )
53+ GinkgoWriter . Printf ( "failed to list NodeUSBDevices: %v\n " , err )
5354 return false
5455 }
5556
@@ -62,12 +63,29 @@ func checkDummyHCDConfigured(ctx context.Context, f *framework.Framework) bool {
6263 return false
6364}
6465
66+ func (u * usbPrecheck ) checkVirtualizationDra (ctx context.Context , f * framework.Framework ) bool {
67+ _ , err := f .KubeClient ().AppsV1 ().DaemonSets (metav1 .NamespaceSystem ).Get (ctx , "virtualization-dra" , metav1.GetOptions {})
68+ if err != nil {
69+ if k8serrors .IsNotFound (err ) {
70+ return false
71+ }
72+ GinkgoWriter .Printf ("failed to get virtualization-dra DaemonSet: %v\n " , err )
73+ return false
74+ }
75+ return true
76+ }
77+
6578func (u * usbPrecheck ) Run (ctx context.Context , f * framework.Framework ) error {
6679 if ! isCheckEnabled (usbPrecheckEnvName ) {
6780 _ , _ = GinkgoWriter .Write ([]byte ("USB precheck is disabled.\n " ))
6881 return nil
6982 }
7083
84+ if ! u .checkVirtualizationDra (ctx , f ) {
85+ return fmt .Errorf ("%s=no to disable this precheck: virtualization-dra DaemonSet is not running. " +
86+ "Configure virtualization with DRA support" , usbPrecheckEnvName )
87+ }
88+
7189 if ! checkDummyHCDConfigured (ctx , f ) {
7290 return fmt .Errorf ("%s=no to disable this precheck: dummy_hcd USB device is not configured. " +
7391 "Run generate_dummy_hcd_ngc.sh to configure dummy_hcd USB device" , usbPrecheckEnvName )
0 commit comments