Re: [PATCH 1/1] qemu_tpm: Get swtpm pid without binary validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/12/22 08:51, Vasily Ulyanov wrote:
> Hi Michal,


>>
> 
> So I can drop --pid and --daemon args from swtpm cmd and add
> 
>     virCommandSetPidFile(cmd, pidfile);
>     virCommandDaemonize(cmd);
> 
> Then in virPidFileReadPathIfAlive() I can add a lock check. Hm... Nice, that
> seems like a good way to go.
> 
> 

Correct. That's common pattern. However, be aware that using
virCommandDaemonize() makes the subsequent virCommandRun() return almost
instantly, even before the actual binary that was intended to run is
executed (if scheduler aligns things "well"). Therefore, checking for
the child process is a bit trickier. But the pidfile is written before
virCommandRun() returns, which is good.
Moreover, it's not possible to use virCommandSetErrorBuffer() nor
virCommandSetOutputBuffer() with virCommandDaemonize().

However, we have examples of how to use the pattern you suggested in our
code. For instance qemuProcessStartManagedPRDaemon() or
qemuSlirpStart(). You can find more by grepping for virCommandDaemonize().

Let me know if you need any help.

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux