qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Robert Foley <robert.foley@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: fam@euphon.net, "Peter Puhov" <peter.puhov@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v1 06/14] tests/vm: Add logging of console to file.
Date: Fri, 7 Feb 2020 17:20:00 -0500	[thread overview]
Message-ID: <CAEyhzFs6+Lssj8a5QckmDaqi41E8_WemueSYuZrqtr=tVbYOjA@mail.gmail.com> (raw)
In-Reply-To: <874kw27248.fsf@linaro.org>

On Fri, 7 Feb 2020 at 12:12, Alex Bennée <alex.bennee@linaro.org> wrote:
> Robert Foley <robert.foley@linaro.org> writes:
>
> > This adds logging of the char device used by the console
> > to a file.  The basevm.py then uses this file to read
> > chars from the console.
> > One reason to add this is to aid with debugging.
>
> I can certainly see an argument for saving the install log.
>
> > But another is because there is an issue where the QEMU
> > might hang if the characters from the character device
> > are not consumed by the script.
>
> I'm a little confused by this. Outputting to a file and then parsing the
> file seems a bit more janky than injesting the output in the script and
> then logging it.
>
> Is this to work around the hang because the socket buffers fill up and
> aren't drained?

Yes, exactly.  This is to work around the hang we are seeing when we
try to use these new VMs.

> > +    console_logfile = "console.log"
>
> We should probably dump the log somewhere other than cwd. Given we cache
> stuff in ~/.cache/qemu-vm maybe something of the form:
>
>   ~/.cache/qemu-vm/ubuntu.aarch64.install.log
>
> ?

Good point, we will locate the log file there.

> > +            elapsed_sec = time.time() - start_time
> > +            if elapsed_sec > self._console_timeout_sec:
> > +                raise ConsoleTimeoutException
> > +        return data.encode('latin1')
> > +
>
> Is latin1 really the best choice here? I would expect things to be utf-8 clean.

We were trying to follow the existing code, which is using latin1.
For example, console_wait() or console_consume() are using latin1.
However on further inspection we see that console_send() is using utf-8.
We will look at changing these latin1 cases to be utf-8.
I also found a case in get_qemu_version() we will change to utf-8 also.

> > +
> > +    def join(self, timeout=None):
> > +        """Time to destroy the thread.
> > +           Clear the event to stop the thread, and wait for
> > +           it to complete."""
> > +        self.alive.clear()
> > +        threading.Thread.join(self, timeout)
> > +        self.log_file.close()
>
> I'm note sure about this - introducing threading into Python seems very
> un-pythonic. I wonder if the python experts have any view on a better
> way to achieve what we want which I think is:
>
>   - a buffer that properly drains output from QEMU
>   - which can optionally be serialised onto disk for logging
>
> What else are we trying to achieve here?

I think that covers what we are trying to achieve here.
The logging to file is a nice to have, but
the draining of the output from QEMU is the main objective here.
We will do a bit more research here to seek out a cleaner way to achieve this,
but certainly we would also be interested if any python experts have a
view on a cleaner approach.

Thanks & Regards,
-Rob
>
> --
> Alex Bennée


  reply	other threads:[~2020-02-07 22:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 21:29 [PATCH v1 00/14] tests/vm: Add support for aarch64 VMs Robert Foley
2020-02-05 21:29 ` [PATCH v1 01/14] tests/vm: use $(PYTHON) consistently Robert Foley
2020-02-07 11:42   ` Alex Bennée
2020-02-05 21:29 ` [PATCH v1 02/14] tests/vm: Debug mode shows ssh output Robert Foley
2020-02-05 21:29 ` [PATCH v1 03/14] tests/vm: increased max timeout for vm boot Robert Foley
2020-02-07 12:01   ` Alex Bennée
2020-02-05 21:29 ` [PATCH v1 04/14] tests/vm: give wait_ssh() option to wait for root Robert Foley
2020-02-07 12:01   ` Alex Bennée
2020-02-05 21:29 ` [PATCH v1 05/14] tests/vm: Added gen_cloud_init_iso() to basevm.py Robert Foley
2020-02-07 12:22   ` Alex Bennée
2020-02-05 21:29 ` [PATCH v1 06/14] tests/vm: Add logging of console to file Robert Foley
2020-02-07 17:12   ` Alex Bennée
2020-02-07 22:20     ` Robert Foley [this message]
2020-02-10 18:21       ` Robert Foley
2020-02-05 21:29 ` [PATCH v1 07/14] tests/vm: Add configuration to basevm.py Robert Foley
2020-02-05 21:29 ` [PATCH v1 08/14] tests/vm: Added configuration file support Robert Foley
2020-02-14 16:53   ` Alex Bennée
2020-02-14 18:00     ` Robert Foley
2020-02-05 21:29 ` [PATCH v1 09/14] tests/vm: add --boot-console switch Robert Foley
2020-02-05 21:29 ` [PATCH v1 10/14] tests/vm: Add ability to select QEMU from current build Robert Foley
2020-02-05 21:29 ` [PATCH v1 11/14] tests/vm: allow wait_ssh() to specify command Robert Foley
2020-02-05 21:29 ` [PATCH v1 12/14] tests/vm: Added a new script for ubuntu.aarch64 Robert Foley
2020-02-05 21:29 ` [PATCH v1 13/14] tests/vm: Added a new script for centos.aarch64 Robert Foley
2020-02-05 21:29 ` [PATCH v1 14/14] tests/vm: change scripts to use self._config Robert Foley
2020-02-07 16:50 ` [PATCH v1 00/14] tests/vm: Add support for aarch64 VMs Alex Bennée

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='CAEyhzFs6+Lssj8a5QckmDaqi41E8_WemueSYuZrqtr=tVbYOjA@mail.gmail.com' \
    --to=robert.foley@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=peter.puhov@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).