Skip to content

udev: unshare device from container.

Rémi Duraffort requested to merge docker_unshare_device into master

Close https://git.lavasoftware.org/lava/lava/-/issues/437

As mentioned before, without unshare device from container may result in some adb device be wrong exist in other container, especially when we do parallel device test on same worker.

For years, we used next to workaround this issue in local:

f"mkdir -p {nodedir} && rm -f {nodedir}/* && mknod {node} {nodetype} {major} {minor} && chown {uid}:{gid} {node} && chmod {mode} {node}",

But gruffly delete all old usb bus when udev share breaks now, as recently we have a test scenario which need to operate a usb recorder in docker-test-shell container.

So, we propose this patch to fix this issue completely.

The idea is: We can't get --serial-number when get udev "remove", but we could get devpath. So when share device to container, we could also record a map between devpath and container name, then when unshare device, we could use devpath to know from which container we should delete that usb device.

Merge request reports