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

Re: [libvirt] [PATCH 2/4] qemu: monitor: Add infrastructure to access VM logs for better err msgs

On 09/24/2013 03:46 PM, Peter Krempa wrote:
> On 09/24/13 14:19, Ján Tomko wrote:
>> On 09/19/2013 11:23 AM, Peter Krempa wrote:
>>> Early VM startup errors usually produce a better error message in the
>>> machine log file. Currently we were accessing it only when the process
>>> exited during certain phases of startup. This will help adding a more
>>> comprehensive error extraction for early qemu startup phases.
>>> This patch adds infrastructure to keep a file descriptor for the machine
>>> log file that will be used in case an error happens.
>>> ---
>> Is there any reason why we need to duplicate the file descriptor instead of
>> opening the log again in qemuMonitorIO when it hangs up?
> I wanted to avoid having to open it again as it's open only during
> startup of the VM. Also, I didn't like the idea of opening a file in the
> event loop.

I thought we could open it without adding any data to qemuMonitor struct, but
we don't have access to the qemu driver config there.

>> You wouldn't have to worry about the position in 4/4 and add this variable to
>> the monitor that's only valid at the start.
> Actually I had a brain lapse while writing the code and the seek
> actually isn't necessary as reading from a FD doesn't influence reads
> from the duplicated one.

My dup(2) man page disagrees:

       After  a  successful return from one of these system calls, the old
       and new file descriptors may be used interchangeably.   They  refer
       to the same open file description (see open(2)) and thus share file
       offset and file status flags; for example, if the  file  offset  is
       modified by using lseek(2) on one of the descriptors, the offset is
       also changed for the other.


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