podman/test/compose/cdi_device
Giuseppe Scrivano 18e29076f7
pkg/api: honor cdi devices from the hostconfig
pass down the devices specifies in the resources block so that CDI
devices in the compose file are honored.

Tested manually with the following compose file:

services:
  testgpupodman_count:
    image: ubuntu:latest
    command: ["nvidia-smi"]
    profiles: [gpu]
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1
            capabilities: [gpu]
  testgpupodman_deviceid:
      image: docker.io/ubuntu:latest
      command: ["nvidia-smi"]
      deploy:
        resources:
          reservations:
            devices:
            - driver: cdi
              device_ids: ['nvidia.com/gpu=all']
              capabilities: [gpu]

Closes: https://github.com/containers/podman/issues/19338

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-01-31 15:26:09 +01:00
..
README.md pkg/api: honor cdi devices from the hostconfig 2025-01-31 15:26:09 +01:00
device.json pkg/api: honor cdi devices from the hostconfig 2025-01-31 15:26:09 +01:00
docker-compose.yml pkg/api: honor cdi devices from the hostconfig 2025-01-31 15:26:09 +01:00
setup.sh pkg/api: honor cdi devices from the hostconfig 2025-01-31 15:26:09 +01:00
teardown.sh pkg/api: honor cdi devices from the hostconfig 2025-01-31 15:26:09 +01:00
tests.sh pkg/api: honor cdi devices from the hostconfig 2025-01-31 15:26:09 +01:00

README.md

cdi devices

This test copies a CDI device file on a tmpfs mounted on /etc/cdi, then checks that the CDI device in the compose file is present in a container. The test is skipped when running as rootless.

Validation

  • The CDI device is present in the container.