When dev path is changed, Instance
is updated with new path but the pod using the device still sees the old path
#734
Labels
bug
Something isn't working
Describe the bug
When I plug an iPhone, I see the
Instance
resource created for it and the first thing my controller watchingInstance
resource is to send a magic byte to enable CDC NCM network interface which is a USB config change that results in unplug/plug of the device and the dev path changes.After that process, I see that the same
Instance
resource now has a different dev path, eg/dev/bus/usb/001/007
becomes/dev/bus/usb/001/009
. However, thePod
that has theInstance
name under itsrequests
, still sees the old path as the only USB device, hence reading that old file results inno such file
errors.When I restart all the Akri pods, the
Pod
sees the new path and works. What I'm guessing is that, somehow, kubelet is not updated with the new path of theInstance
and since restart results in re-registration of the plugin, it goes through all the devices and ends up registering the new path.Output of
kubectl get pods,akrii,akric -o wide
Kubernetes Version: [e.g. Native Kubernetes 1.19, MicroK8s 1.19, Minikube 1.19, K3s]
1.32.0 via Talos 1.9
To Reproduce
I will try to get a script going to be able to cleanly reproduce this but it'll have to require iOS hardware.
Expected behavior
When dev path changes in
Instance
as a result of USB config change, the change should be reflected in the pod(s) that uses theInstance
as well and the processes trying to access the USB path should see the new path and be able to read/write.Logs (please share snips of applicable logs)
Here is the initial
Instance
resource:After sending the USB config bytes, here is how it's changed by Akri:
My controller puts the
attributes.platform.qawolf.com/usb-network-enabled: "true"
only after it confirms that the device is in the correct config, e.g. after it changes to the new dev path. Then aPod
is created only if that label is present.Here is how the Pod events look like:
Here is the excerpt of the agent logs:
Note that deleting the pod and re-creating it does not make a difference. However, if I delete the agent pod and let the new one come up, it all starts to work. Here is the agent logs after a new one comes up:
Here is the events of the new pod that's created for the
Instance
:Additional context
I'm experienced in Go but have practically zero experience in Rust. Here is a draft change that I was able to write with help from Cursor editor running with Claude 3.5 Sonnet. It's hacky but that was the only simple solution it was able to come up with. I'll update here and the PR once my testing is completed.
The text was updated successfully, but these errors were encountered: