improve CDI logging
Added logging of found CDI devices. Fixed test failures caused by the change. Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
This commit is contained in:
		| @@ -743,6 +743,8 @@ func WithCDI(annotations map[string]string) oci.SpecOpts { | ||||
| 			return nil | ||||
| 		} | ||||
|  | ||||
| 		log.G(ctx).Infof("container %v: CDI devices: %v", c.ID, cdiDevices) | ||||
|  | ||||
| 		registry := cdi.GetRegistry() | ||||
| 		if err = registry.Refresh(); err != nil { | ||||
| 			// We don't consider registry refresh failure a fatal error. | ||||
|   | ||||
| @@ -1548,6 +1548,8 @@ func TestCDIInjections(t *testing.T) { | ||||
| 	containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData() | ||||
| 	ociRuntime := config.Runtime{} | ||||
| 	c := newTestCRIService() | ||||
| 	testContainer := &containers.Container{ID: "64ddfe361f0099f8d59075398feeb3dcb3863b6851df7b946744755066c03e9d"} | ||||
| 	ctx := context.Background() | ||||
|  | ||||
| 	for _, test := range []struct { | ||||
| 		description   string | ||||
| @@ -1653,7 +1655,7 @@ containerEdits: | ||||
| 			require.NoError(t, err) | ||||
|  | ||||
| 			injectFun := customopts.WithCDI(test.annotations) | ||||
| 			err = injectFun(nil, nil, nil, spec) | ||||
| 			err = injectFun(ctx, nil, testContainer, spec) | ||||
| 			assert.Equal(t, test.expectError, err != nil) | ||||
|  | ||||
| 			if err != nil { | ||||
|   | ||||
| @@ -1548,6 +1548,8 @@ func TestCDIInjections(t *testing.T) { | ||||
| 	containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData() | ||||
| 	ociRuntime := config.Runtime{} | ||||
| 	c := newTestCRIService() | ||||
| 	testContainer := &containers.Container{ID: "64ddfe361f0099f8d59075398feeb3dcb3863b6851df7b946744755066c03e9d"} | ||||
| 	ctx := context.Background() | ||||
|  | ||||
| 	for _, test := range []struct { | ||||
| 		description   string | ||||
| @@ -1653,7 +1655,7 @@ containerEdits: | ||||
| 			require.NoError(t, err) | ||||
|  | ||||
| 			injectFun := customopts.WithCDI(test.annotations) | ||||
| 			err = injectFun(nil, nil, nil, spec) | ||||
| 			err = injectFun(ctx, nil, testContainer, spec) | ||||
| 			assert.Equal(t, test.expectError, err != nil) | ||||
|  | ||||
| 			if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ed Bartosh
					Ed Bartosh