Suport vpci-class-guid in the non-containerd backend

IDType `vpci-class-guid` is a synonym of `class`.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This commit is contained in:
Paul "TBBle" Hampson 2022-03-13 20:00:22 +11:00
parent cb07afa3cc
commit 31e1fec950
2 changed files with 6 additions and 8 deletions

View file

@ -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",

View file

@ -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})