Actually realpath can resolve non existing file, as long as it is on existing paths
$ ll /var/run/symlinkdisk /var/run/foobar/symlinkdisk
ls: cannot access '/var/run/symlinkdisk': No such file or directory
ls: cannot access '/var/run/foobar/symlinkdisk': No such file or directory
$ realpath /var/run/symlinkdisk /var/run/foobar/symlinkdisk
/run/symlinkdisk
realpath: /var/run/foobar/symlinkdisk: No such file or directory
So the virFileExists guard in the code can be weakened just a bit to make it work in general.
That also matches what qemu will do, it will create a socket or file, but would not mkdir.
Actually realpath can resolve non existing file, as long as it is on existing paths
$ ll /var/run/ symlinkdisk /var/run/ foobar/ symlinkdisk symlinkdisk' : No such file or directory foobar/ symlinkdisk' : No such file or directory
ls: cannot access '/var/run/
ls: cannot access '/var/run/
$ realpath /var/run/ symlinkdisk /var/run/ foobar/ symlinkdisk foobar/ symlinkdisk: No such file or directory
/run/symlinkdisk
realpath: /var/run/
So the virFileExists guard in the code can be weakened just a bit to make it work in general.
That also matches what qemu will do, it will create a socket or file, but would not mkdir.