From nobody Mon Apr 29 15:13:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496815464052838.8530244985564; Tue, 6 Jun 2017 23:04:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F66A368E5; Wed, 7 Jun 2017 06:04:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A184189B1; Wed, 7 Jun 2017 06:04:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CF0414BB7F; Wed, 7 Jun 2017 06:04:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5763s2m016753 for ; Wed, 7 Jun 2017 02:03:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id A72F317DBD; Wed, 7 Jun 2017 06:03:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1F54757CD for ; Wed, 7 Jun 2017 06:03:52 +0000 (UTC) Received: from photon.sigxcpu.org (photon.sigxcpu.org [95.142.169.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3525EC0587D3 for ; Wed, 7 Jun 2017 06:03:50 +0000 (UTC) Received: from honk.sigxcpu.org (localhost [127.0.0.1]) by photon.sigxcpu.org (Postfix) with ESMTPS id 9FAE26E6 for ; Wed, 7 Jun 2017 08:03:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 4B115FB05 for ; Wed, 7 Jun 2017 08:03:48 +0200 (CEST) Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SF8qkA69_eQu for ; Wed, 7 Jun 2017 08:03:47 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id DB47C4159B; Wed, 7 Jun 2017 08:02:05 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7F66A368E5 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=sigxcpu.org Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7F66A368E5 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3525EC0587D3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=sigxcpu.org Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=agx@sigxcpu.org DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3525EC0587D3 X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: libvir-list@redhat.com Date: Wed, 7 Jun 2017 08:02:04 +0200 Message-Id: <0fd322d1039a2c5eca22a8dc2808ea342932647d.1496814922.git.agx@sigxcpu.org> In-Reply-To: References: In-Reply-To: References: X-Greylist: Delayed for 107:16:50 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 07 Jun 2017 06:03:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 07 Jun 2017 06:03:51 +0000 (UTC) for IP:'95.142.169.183' DOMAIN:'photon.sigxcpu.org' HELO:'photon.sigxcpu.org' FROM:'agx@sigxcpu.org' RCPT:'' X-RedHat-Spam-Score: 0.79 (BAYES_50, T_RP_MATCHES_RCVD) 95.142.169.183 photon.sigxcpu.org 95.142.169.183 photon.sigxcpu.org X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-sandbox PATCH 1/2] Drop library/ from image path X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 07 Jun 2017 06:04:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If one pastes from the output of virt-sansbox-image $ virt-sandbox-image list docker:/library/ubuntu?tag=3D17.04 docker:/library/debian?tag=3Dlatest verbatim $ virt-sandbox-image run -c qemu:///session docker:/library/debian?tag=3D= latest This fails like /home//.local/share/libvirt/images/library/debian:qbeilwxard.qcow2: = Could not create file: No such file or directory so strip off any leading components. Reviewed-by: Daniel P. Berrange --- libvirt-sandbox/image/sources/docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt-sandbox/image/sources/docker.py b/libvirt-sandbox/imag= e/sources/docker.py index aa5675e..6ca086c 100755 --- a/libvirt-sandbox/image/sources/docker.py +++ b/libvirt-sandbox/image/sources/docker.py @@ -655,7 +655,7 @@ class DockerSource(base.Source): def get_disk(self, template, templatedir, imagedir, sandboxname): image =3D DockerImage.from_template(template) configfile, diskfile =3D self._get_template_data(image, templatedi= r) - tempfile =3D imagedir + "/" + sandboxname + ".qcow2" + tempfile =3D imagedir + "/" + sandboxname.split('/')[-1] + ".qcow2" if not os.path.exists(imagedir): os.makedirs(imagedir) cmd =3D ["qemu-img","create","-q","-f","qcow2"] --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 15:13:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496815444832142.0463579252886; Tue, 6 Jun 2017 23:04:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DEC98046B; Wed, 7 Jun 2017 06:04:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9050517DBD; Wed, 7 Jun 2017 06:04:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9F517180BAFA; Wed, 7 Jun 2017 06:03:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5763sYl016726 for ; Wed, 7 Jun 2017 02:03:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 54C1581B7A; Wed, 7 Jun 2017 06:03:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A61781B77 for ; Wed, 7 Jun 2017 06:03:52 +0000 (UTC) Received: from photon.sigxcpu.org (photon.sigxcpu.org [95.142.169.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBCADC0467D7 for ; Wed, 7 Jun 2017 06:03:50 +0000 (UTC) Received: from honk.sigxcpu.org (localhost [127.0.0.1]) by photon.sigxcpu.org (Postfix) with ESMTPS id C5E71CD9 for ; Wed, 7 Jun 2017 08:03:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 821E6FB02 for ; Wed, 7 Jun 2017 08:03:49 +0200 (CEST) Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YzSPPY2lEDei for ; Wed, 7 Jun 2017 08:03:48 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id E1A55415A1; Wed, 7 Jun 2017 08:02:05 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3DEC98046B Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=sigxcpu.org Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3DEC98046B DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EBCADC0467D7 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=sigxcpu.org Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=agx@sigxcpu.org DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EBCADC0467D7 X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: libvir-list@redhat.com Date: Wed, 7 Jun 2017 08:02:05 +0200 Message-Id: <8e117652f7acc345442165024c0c7aabb01cffe1.1496814922.git.agx@sigxcpu.org> In-Reply-To: References: In-Reply-To: References: X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 07 Jun 2017 06:03:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 07 Jun 2017 06:03:51 +0000 (UTC) for IP:'95.142.169.183' DOMAIN:'photon.sigxcpu.org' HELO:'photon.sigxcpu.org' FROM:'agx@sigxcpu.org' RCPT:'' X-RedHat-Spam-Score: 0.79 (BAYES_50, T_RP_MATCHES_RCVD) 95.142.169.183 photon.sigxcpu.org 95.142.169.183 photon.sigxcpu.org X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-sandbox PATCH 2/2] Sanitize domain name X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 07 Jun 2017 06:04:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If one pastes from the output of virt-sansbox-image $ virt-sandbox-image list docker:/library/ubuntu?tag=3D17.04 docker:/library/debian?tag=3Dlatest verbatim $ virt-sandbox-image run -c qemu:///session docker:/library/debian?tag=3D= latest This fails like Unable to start sandbox: Failed to create domain: XML error: name library= /debian:qbeilwxard cannot contain '/' so don't allow invalid chars like '/' in domain names Reviewed-by: Daniel P. Berrange --- libvirt-sandbox/image/cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py index 3a5ccfa..d5e624c 100644 --- a/libvirt-sandbox/image/cli.py +++ b/libvirt-sandbox/image/cli.py @@ -27,6 +27,7 @@ import hashlib import json import os import os.path +import re import shutil import sys import urllib2 @@ -81,6 +82,10 @@ def prepare(args): templatedir=3Dget_template_dir(args), connect=3Dargs.connect) =20 +def random_domain_name(tmpl): + randomid =3D ''.join(random.choice(string.lowercase) for i in range(10= )) + return re.sub('[^a-z0-9-]', '_', tmpl.path[1:], re.I) + ":" + randomid + def run(args): if args.connect is not None: check_connect(args.connect) @@ -95,8 +100,7 @@ def run(args): =20 name =3D args.name if name is None: - randomid =3D ''.join(random.choice(string.lowercase) for i in rang= e(10)) - name =3D tmpl.path[1:] + ":" + randomid + name =3D random_domain_name(tmpl) =20 diskfile =3D source.get_disk(template=3Dtmpl, templatedir=3Dtemplate_dir, --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list