qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Thomas Huth" <thuth@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-block@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Willian Rampazzo" <wrampazz@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>
Subject: Re: [PATCH 1/6] Python: close the log file kept by QEMUMachine before reading it
Date: Mon, 15 Feb 2021 21:35:34 -0500	[thread overview]
Message-ID: <YCsvdvjXvTe9Cvk1@localhost.localdomain> (raw)
In-Reply-To: <a6356c56-8652-e810-0f04-b0658912e8f6@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]

On Mon, Feb 15, 2021 at 05:04:24PM -0500, John Snow wrote:
> On 2/11/21 5:01 PM, Cleber Rosa wrote:
> > Closing a file that is open for writing, and then reading from it
> > sounds like a better idea than the opposite, given that the content
> > will be flushed.
> > 
> > Reference: https://docs.python.org/3/library/io.html#io.IOBase.close
> > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > ---
> >   python/qemu/machine.py | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> > index 7a40f4604b..6e44bda337 100644
> > --- a/python/qemu/machine.py
> > +++ b/python/qemu/machine.py
> > @@ -337,12 +337,12 @@ class QEMUMachine:
> 
> Is there a way to improve context for python functions? What method is this
> in? etc.
> 
> >               self._qmp.close()
> >               self._qmp_connection = None
> > -        self._load_io_log()
> > -
> >           if self._qemu_log_file is not None:
> >               self._qemu_log_file.close()
> >               self._qemu_log_file = None
> > +        self._load_io_log()
> > +
> >           self._qemu_log_path = None
> >           if self._temp_dir is not None:
> > 
> 
> Yeh, seems fine, though as wainer points out the interdependencies between
> _load_io_log, _qemu_log_file and _qemu_log_path are not all strictly clear,
> so it seems fragile.
>

Yep, agreed.  This was a first, conservative change.  Expect more later.

> But, this is more correct than it was, so:
> 
> Reviewed-by: John Snow <jsnow@redhat.com>

Thanks,
- Cleber

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-02-16  2:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 22:01 [PATCH 0/6] Python / Acceptance Tests: improve logging Cleber Rosa
2021-02-11 22:01 ` [PATCH 1/6] Python: close the log file kept by QEMUMachine before reading it Cleber Rosa
2021-02-15 18:30   ` Wainer dos Santos Moschetta
2021-02-16  2:34     ` Cleber Rosa
2021-02-17 19:53       ` Wainer dos Santos Moschetta
2021-02-15 22:04   ` John Snow
2021-02-15 22:19     ` Eric Blake
2021-02-16  2:35     ` Cleber Rosa [this message]
2021-02-11 22:01 ` [PATCH 2/6] Python: expose QEMUMachine's temporary directory Cleber Rosa
2021-02-11 23:35   ` Philippe Mathieu-Daudé
2021-02-12  0:11     ` Cleber Rosa
2021-02-15 22:31     ` John Snow
2021-02-15 18:50   ` Wainer dos Santos Moschetta
2021-02-15 22:27     ` John Snow
2021-02-17 19:58       ` Wainer dos Santos Moschetta
2021-02-15 22:25   ` John Snow
2021-02-11 22:01 ` [PATCH 3/6] Acceptance Tests: use the job work directory for created VMs Cleber Rosa
2021-02-15 19:04   ` Wainer dos Santos Moschetta
2021-02-15 23:13   ` John Snow
2021-02-11 22:01 ` [PATCH 4/6] Acceptance Tests: log information when creating QEMUMachine Cleber Rosa
2021-02-15 19:15   ` Wainer dos Santos Moschetta
2021-02-11 22:01 ` [PATCH 5/6] Acceptance Tests: distinguish between temp and logs dir Cleber Rosa
2021-02-15 19:30   ` Wainer dos Santos Moschetta
2021-02-11 22:01 ` [PATCH 6/6] tests/acceptance/virtio-gpu.py: preserve virtio-user-gpu log Cleber Rosa
2021-02-11 23:37   ` Philippe Mathieu-Daudé
2021-02-15 19:31   ` Wainer dos Santos Moschetta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YCsvdvjXvTe9Cvk1@localhost.localdomain \
    --to=crosa@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=bleal@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    --cc=wrampazz@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).