From 31e1fec950eb702f433f2893bb8096adb6e7538d Mon Sep 17 00:00:00 2001 From: "Paul \"TBBle\" Hampson" Date: Sun, 13 Mar 2022 20:00:22 +1100 Subject: [PATCH] Suport vpci-class-guid in the non-containerd backend IDType `vpci-class-guid` is a synonym of `class`. Signed-off-by: Paul "TBBle" Hampson --- integration/container/devices_windows_test.go | 10 ++++------ libcontainerd/local/local_windows.go | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/integration/container/devices_windows_test.go b/integration/container/devices_windows_test.go index 759bfc940c..1ab5c6e690 100644 --- a/integration/container/devices_windows_test.go +++ b/integration/container/devices_windows_test.go @@ -50,12 +50,10 @@ func TestWindowsDevices(t *testing.T) { expectedStdout: "/Windows/System32/HostDriverStore/FileRepository", }, { - doc: "process/vpci-class-guid://5B45201D-F2F2-4F3B-85BB-30FF1F953599 mounted", - devices: []string{"vpci-class-guid://5B45201D-F2F2-4F3B-85BB-30FF1F953599"}, - isolation: containertypes.IsolationProcess, - expectedStartFailure: !testEnv.RuntimeIsWindowsContainerd(), - expectedStartFailureMessage: "device assignment of type 'vpci-class-guid' is not supported", - expectedStdout: "/Windows/System32/HostDriverStore/FileRepository", + doc: "process/vpci-class-guid://5B45201D-F2F2-4F3B-85BB-30FF1F953599 mounted", + devices: []string{"vpci-class-guid://5B45201D-F2F2-4F3B-85BB-30FF1F953599"}, + isolation: containertypes.IsolationProcess, + expectedStdout: "/Windows/System32/HostDriverStore/FileRepository", }, { doc: "hyperv/no device mounted", diff --git a/libcontainerd/local/local_windows.go b/libcontainerd/local/local_windows.go index d9c7b7a6c7..08c882b431 100644 --- a/libcontainerd/local/local_windows.go +++ b/libcontainerd/local/local_windows.go @@ -313,8 +313,8 @@ func (c *client) createWindows(id string, spec *specs.Spec, runtimeOptions inter } for _, d := range spec.Windows.Devices { // Per https://github.com/microsoft/hcsshim/blob/v0.9.2/internal/uvm/virtual_device.go#L17-L18, - // this represents an Interface Class GUID. - if d.IDType != "class" { + // these represent an Interface Class GUID. + if d.IDType != "class" && d.IDType != "vpci-class-guid" { return errors.Errorf("device assignment of type '%s' is not supported", d.IDType) } configuration.AssignedDevices = append(configuration.AssignedDevices, hcsshim.AssignedDevice{InterfaceClassGUID: d.ID})