Use shorter virtiofsd and swtpm socket paths
Fixes #12539. These changes generally include getting the file descriptor of the directory of a socket's file to use an alternative shorter path to the same socket. This same fix is applied during VM start (with disk virtiofsd sockets, qemu config virtiofsd sockets and the swtpm sockets), and when hotplugging a disk on a VM (with disk virtiofsd sockets)
Has the idea of passing an FD been proved to work? Before we get too bogged down in code style etc?
Has the idea of passing an FD been proved to work? Before we get too bogged down in code style etc?
No, it hasn't. For now I ask we focus our discussions in either understanding the problem with this approach or suggesting alternatives.
Another thing you could try is experimenting with the server setting for the chardev as this is set to true by default and I am not sure if qemu isn't the client in this case?
See https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html#qapidoc-1240.
@hamistao once this is ready for review please can you mark it as ready for review and let me know. Thanks
@tomponline I found that the same problem was ocurring in other situations(when attaching a device to a running instance and when adding a tpm device) so I changed back to draft to include those additional fixes, will be pushing the next version in a few minutes.
@tomponline this is ready for review
@roosterfish @tomponline this is ready when you are ready :)
@hamistao ready for another review?
@tomponline yes, it is
How did you get on with this @hamistao ?
@tomponline The approach of passing the file descriptor to QEMU works but is considerably more complicated than the current apporach so that part will remain the same. All the rest remains as discussed and I will be pushing the changes in a few minutes.
The approach of passing the file descriptor to QEMU works but is considerably more complicated than the current apporach so that withh remain the same. All the rest remais as discussed and I will be pushing the changes in a few minutes.
Please can I have some more details on this, also specifically what are you referring to?
@tomponline Sure! I tried passing a file descriptor to the socket file instead of the path when calling swtpm socket to make the code simpler and remove util.ShortenedSocketPath from TPM creation.
But since the file descriptor that swtpm receives must be to a socket file, it is needed to open the socket before calling swtpm socket and thus util.ShortenedSocketPath is still needed. This is why I stuck to the current approach.
If this wasn't clear enough please let me know.
@hamistao i was just about to merge this and but you've pushed a change?
@tomponline yes, the pushed changes just include the O_PATH approach and the switch from ShortenedSocketPath to ShornetedFilePath, as discussed.
OK so ill re review again
@tomponline Sorry if there was some confusion. If those changes aren't needed please let me know so I can remove them.
@tomponline done!
Thanks!