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:
parent
8ed910c46a
commit
643dc16565
@ -743,6 +743,8 @@ func WithCDI(annotations map[string]string) oci.SpecOpts {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.G(ctx).Infof("container %v: CDI devices: %v", c.ID, cdiDevices)
|
||||||
|
|
||||||
registry := cdi.GetRegistry()
|
registry := cdi.GetRegistry()
|
||||||
if err = registry.Refresh(); err != nil {
|
if err = registry.Refresh(); err != nil {
|
||||||
// We don't consider registry refresh failure a fatal error.
|
// We don't consider registry refresh failure a fatal error.
|
||||||
|
@ -1548,6 +1548,8 @@ func TestCDIInjections(t *testing.T) {
|
|||||||
containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData()
|
containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData()
|
||||||
ociRuntime := config.Runtime{}
|
ociRuntime := config.Runtime{}
|
||||||
c := newTestCRIService()
|
c := newTestCRIService()
|
||||||
|
testContainer := &containers.Container{ID: "64ddfe361f0099f8d59075398feeb3dcb3863b6851df7b946744755066c03e9d"}
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
description string
|
description string
|
||||||
@ -1653,7 +1655,7 @@ containerEdits:
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
injectFun := customopts.WithCDI(test.annotations)
|
injectFun := customopts.WithCDI(test.annotations)
|
||||||
err = injectFun(nil, nil, nil, spec)
|
err = injectFun(ctx, nil, testContainer, spec)
|
||||||
assert.Equal(t, test.expectError, err != nil)
|
assert.Equal(t, test.expectError, err != nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1548,6 +1548,8 @@ func TestCDIInjections(t *testing.T) {
|
|||||||
containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData()
|
containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData()
|
||||||
ociRuntime := config.Runtime{}
|
ociRuntime := config.Runtime{}
|
||||||
c := newTestCRIService()
|
c := newTestCRIService()
|
||||||
|
testContainer := &containers.Container{ID: "64ddfe361f0099f8d59075398feeb3dcb3863b6851df7b946744755066c03e9d"}
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
description string
|
description string
|
||||||
@ -1653,7 +1655,7 @@ containerEdits:
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
injectFun := customopts.WithCDI(test.annotations)
|
injectFun := customopts.WithCDI(test.annotations)
|
||||||
err = injectFun(nil, nil, nil, spec)
|
err = injectFun(ctx, nil, testContainer, spec)
|
||||||
assert.Equal(t, test.expectError, err != nil)
|
assert.Equal(t, test.expectError, err != nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user