From: John Snow <jsnow@redhat.com>
To: Cleber Rosa <crosa@redhat.com>, qemu-devel@nongnu.org
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>,
"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 3/6] Acceptance Tests: use the job work directory for created VMs
Date: Mon, 15 Feb 2021 18:13:53 -0500 [thread overview]
Message-ID: <fdddac6f-3da2-d9e3-ac8f-7b0ab6d52b47@redhat.com> (raw)
In-Reply-To: <20210211220146.2525771-4-crosa@redhat.com>
On 2/11/21 5:01 PM, Cleber Rosa wrote:
> The QEMUMachine uses a base temporary directory for all temporary
> needs. By setting it to the Avocado's workdir, it's possible to
> keep the temporary files during debugging sessions much more
> easily by setting the "--keep-tmp" command line option.
>
Makes sense, kinda-sorta.
Is this a band-aid?
QEMUMachine has this gem in _post_shutdown():
if self._temp_dir is not None:
shutil.rmtree(self._temp_dir)
self._temp_dir = None
we probably do want a way to adjust the deletion policy that QEMUMachine
has. Kevin and I discussed this (extremely briefly) in January. One note
is that the QEMU logs are read into memory when the process closes, so
iotests et al have a chance to show you those logs on failure cases. Not
relevant here for your purposes.
Meanwhile, we could also change the behavior of QEMUMachine, and create
a temp dir deletion policy tunable:
(1) Always delete
(2) Never delete
(3) Delete on success (keep on failure)
(4) Delete on success and anticipated failures.
(About #4: QEMUMachine has a condition where it will not report
AbornalShutdown if .kill() is called and the retcode is observed to be
-SIGKILL. We treat this as a kind of success.)
These avocado tests could then just use a "never delete" policy, use the
avocado runner's working dir, and then never worry about the cleanup.
iotests could do something similar with a temporary directory
established by the top-level runner that we could modify the behavior of
with --keep-files[ <on-failure|always>] or similar.
It might be time to just make this less stupidly annoying for all users
of the library once and for all.
> Reference: https://avocado-framework.readthedocs.io/en/85.0/api/test/avocado.html#avocado.Test.workdir
> Reference: https://avocado-framework.readthedocs.io/en/85.0/config/index.html#run-keep-tmp
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
> tests/acceptance/avocado_qemu/__init__.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index bf54e419da..b7ab836455 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -172,7 +172,8 @@ class Test(avocado.Test):
>
> def _new_vm(self, *args):
> self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
> - vm = QEMUMachine(self.qemu_bin, sock_dir=self._sd.name)
> + vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
> + sock_dir=self._sd.name)
> if args:
> vm.add_args(*args)
> return vm
>
But, you know, absent all that extra work, sure:
Reviewed-by: John Snow <jsnow@redhat.com>
next prev parent reply other threads:[~2021-02-15 23:15 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
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 [this message]
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=fdddac6f-3da2-d9e3-ac8f-7b0ab6d52b47@redhat.com \
--to=jsnow@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@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).