qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, debarshi@redhat.com
Cc: "Fam Zheng" <fam@euphon.net>,
	"P. Berrange, Daniel" <berrange@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Debarshi Ray" <rishi@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/5] tests/docker: add podman support
Date: Wed, 10 Jul 2019 11:44:28 +0200	[thread overview]
Message-ID: <d8e76f7d-a96f-3ed4-4c6e-d9ad48b5490e@redhat.com> (raw)
In-Reply-To: <CAMxuvay5jPM6AnsZtLYvVB+nb4nopGnRP=BWxUctA1aZNaMdog@mail.gmail.com>

On 10/07/19 10:39, Marc-André Lureau wrote:
>> Why not do this in docker.py (either as part of patch 1 or separately)?
>>  Also, can you document in a comment why this is not needed with docker?
>
> Doing it in docker.py would probably mean parsing and tweaking
> arguments given to Docker.run(). Since it's a "temporary" work around,
> I would rather have it at the top-level caller, in the Makefile.

On the other hand that splits the choice of docker vs. podman in two 
places, and Python is a better place to implement workarounds.

It's not hard to move the workaround there.  The "-u $(shell id -u)" 
option could be replaced by a "--run-as-current-user" option parsed by 
RunCommand, not unlike --add-current-user that BuildCommand already 
supports.

Something like this (untested of course :)):

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index aaf5396b85..019191f1a1 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -212,7 +212,7 @@ docker-run: docker-qemu-src
 			"  COPYING $(EXECUTABLE) to $(IMAGE)"))
 	$(call quiet-command,						\
 		$(DOCKER_SCRIPT) run 					\
-			$(if $(NOUSER),,-u $(shell id -u)) 		\
+			$(if $(NOUSER),,--run-as-current-user) 		\
 			--security-opt seccomp=unconfined		\
 			$(if $V,,--rm) 					\
 			$(if $(DEBUG),-ti,)				\
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 53a8c9c801..92c02aeed8 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -333,8 +333,12 @@ class RunCommand(SubCommand):
     def args(self, parser):
         parser.add_argument("--keep", action="store_true",
                             help="Don't remove image when command completes")
+        parser.add_argument("--run-as-current-user", action="store_true",
+                            help="Run container using the current user's uid")
 
     def run(self, args, argv):
+        if args.use_current_user:
+            argv = [ "-u", str(os.getuid()) ] + argv
         return Docker().run(argv, args.keep, quiet=args.quiet)
 
 

Paolo

> I am not very familiar with podman or docker, so I am not able to tell
> you why docker does work by default.  @Debarshi Ray might know, as he
> helped me finding a workaround.



  reply	other threads:[~2019-07-10  9:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 19:43 [Qemu-devel] [PATCH v2 0/5] tests/docker: add podman support Marc-André Lureau
2019-07-09 19:43 ` [Qemu-devel] [PATCH v2 1/5] docker.py: " Marc-André Lureau
2019-07-11 15:52   ` Alex Bennée
2019-07-09 19:43 ` [Qemu-devel] [PATCH v2 2/5] tests/docker: " Marc-André Lureau
2019-07-10  8:27   ` Paolo Bonzini
2019-07-10  8:39     ` Marc-André Lureau
2019-07-10  9:44       ` Paolo Bonzini [this message]
2019-07-11 15:55         ` Alex Bennée
2019-07-17 15:44       ` Debarshi Ray
2019-07-17 15:17   ` Debarshi Ray
2019-07-09 19:43 ` [Qemu-devel] [PATCH v2 3/5] tests: specify the address family when checking bind Marc-André Lureau
2019-07-10 10:12   ` Philippe Mathieu-Daudé
2019-07-09 19:43 ` [Qemu-devel] [PATCH v2 4/5] test-char: skip tcp tests if ipv4 check failed Marc-André Lureau
2019-07-09 19:43 ` [Qemu-devel] [PATCH v2 5/5] test: skip tests if socket_check_protocol_support() failed Marc-André Lureau
2019-07-09 23:39 ` [Qemu-devel] [PATCH v2 0/5] tests/docker: add podman support no-reply

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=d8e76f7d-a96f-3ed4-4c6e-d9ad48b5490e@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=debarshi@redhat.com \
    --cc=fam@euphon.net \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rishi@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).