Explorar el Código

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>
Paul "TBBle" Hampson hace 3 años
padre
commit
31e1fec950

+ 4 - 6
integration/container/devices_windows_test.go

@@ -50,12 +50,10 @@ func TestWindowsDevices(t *testing.T) {
 			expectedStdout: "/Windows/System32/HostDriverStore/FileRepository",
 			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",
 			doc:              "hyperv/no device mounted",

+ 2 - 2
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 {
 		for _, d := range spec.Windows.Devices {
 			// Per https://github.com/microsoft/hcsshim/blob/v0.9.2/internal/uvm/virtual_device.go#L17-L18,
 			// 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)
 				return errors.Errorf("device assignment of type '%s' is not supported", d.IDType)
 			}
 			}
 			configuration.AssignedDevices = append(configuration.AssignedDevices, hcsshim.AssignedDevice{InterfaceClassGUID: d.ID})
 			configuration.AssignedDevices = append(configuration.AssignedDevices, hcsshim.AssignedDevice{InterfaceClassGUID: d.ID})