summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2021-10-07 15:47:05 -0700
committergVisor bot <gvisor-bot@google.com>2021-10-07 15:49:28 -0700
commit710e51372dc822501769d700531ec6f0f81221e6 (patch)
tree57dfe22691e6d0b77f107d09b4511ada6401a86b /pkg/sentry
parent3517d070cc3128ad3439e10b8abb42b7df60c2b2 (diff)
tests: use a proper path to the kvm device
PiperOrigin-RevId: 401624134
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/platform/kvm/kvm.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/sentry/platform/kvm/kvm.go b/pkg/sentry/platform/kvm/kvm.go
index aac0fdffe..ad6863646 100644
--- a/pkg/sentry/platform/kvm/kvm.go
+++ b/pkg/sentry/platform/kvm/kvm.go
@@ -77,7 +77,11 @@ var (
// OpenDevice opens the KVM device at /dev/kvm and returns the File.
func OpenDevice() (*os.File, error) {
- f, err := os.OpenFile("/dev/kvm", unix.O_RDWR, 0)
+ dev, ok := os.LookupEnv("GVISOR_KVM_DEV")
+ if !ok {
+ dev = "/dev/kvm"
+ }
+ f, err := os.OpenFile(dev, unix.O_RDWR, 0)
if err != nil {
return nil, fmt.Errorf("error opening /dev/kvm: %v", err)
}