From nobody Sun Feb 8 06:54:24 2026 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155076686005166.83162712951605; Thu, 21 Feb 2019 08:34:20 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46FF9307D960; Thu, 21 Feb 2019 16:34:18 +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 1D02B282C1; Thu, 21 Feb 2019 16:34:18 +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 BB873181A00A; Thu, 21 Feb 2019 16:34:17 +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 x1LGYAZs015361 for ; Thu, 21 Feb 2019 11:34:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D59860BFC; Thu, 21 Feb 2019 16:34:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-65.ams2.redhat.com [10.36.112.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FAAA60BF3; Thu, 21 Feb 2019 16:34:09 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 21 Feb 2019 16:33:53 +0000 Message-Id: <20190221163354.23482-5-berrange@redhat.com> In-Reply-To: <20190221163354.23482-1-berrange@redhat.com> References: <20190221163354.23482-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v4 4/5] mappings: extend mapping to allow per-arch entries 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 21 Feb 2019 16:34:18 +0000 (UTC) For example to prevent Xen being installed on any s390x xen: default-s390x: deb: libxen-dev Fedora: xen-devel Or the inverse to only install Xen on x86_64 on Debian, but allow it on all archs on Fedora xen: deb-x86_64: libxen-dev Fedora: xen-devel Note that the architecture specific matches are considered after all the non-architcture matches. The mappings are updated to blacklist libnuma on arm6/7 for Debian since it is not built for those archs. xen is whitelisted to only be used on x86_64, arm7 and aarch64 for Debian, since the majority of other architectures don't support it. The dockerfile generator is updated to apply arch filtering based on the host arch. The ansible playbook is not actually implementing support for non-x86_64 architectures in this commit. It is just hardcoding x86_64, which is enough to ensure the changes in the mappings.yml file are a no-op initially. Signed-off-by: Daniel P. Berrang=C3=A9 --- guests/lcitool | 17 ++++++++- guests/playbooks/update/tasks/packages.yml | 32 +++++++++++++++++ guests/vars/mappings.yml | 42 +++++++++++++++++++--- 3 files changed, 86 insertions(+), 5 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 2af6878..ae7e4ee 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -21,6 +21,7 @@ import crypt import fnmatch import json import os +import platform import random import string import subprocess @@ -303,6 +304,8 @@ class Application: self._inventory =3D Inventory() self._projects =3D Projects() =20 + self._native_arch =3D self._libvirt_host_arch() + self._parser =3D argparse.ArgumentParser( conflict_handler=3D"resolve", formatter_class=3Dargparse.RawDescriptionHelpFormatter, @@ -433,6 +436,15 @@ class Application: raise Error( "Failed to run {} on '{}': {}".format(playbook, hosts, ex)) =20 + def _libvirt_host_arch(self): + # Same canonicalization as libvirt virArchFromHost + arch =3D platform.machine() + if arch in ["i386", "i486", "i586"]: + arch =3D "i686" + if arch =3D=3D "amd64": + arch =3D "x86_64" + return arch + def _action_hosts(self, args): for host in self._inventory.expand_pattern("all"): print(host) @@ -549,7 +561,8 @@ class Application: ) =20 pkgs =3D {} - keys =3D ["default", package_format, os_name, os_full] + base_keys =3D ["default", package_format, os_name, os_full] + keys =3D base_keys + [k + "-" + self._native_arch for k in base_ke= ys] # We need to add the base project manually here: the standard # machinery hides it because it's an implementation detail for project in projects + ["base"]: @@ -558,6 +571,8 @@ class Application: if key in mappings[package]: pkgs[package] =3D mappings[package][key] =20 + if package not in pkgs: + continue if pkgs[package] is None: del pkgs[package] =20 diff --git a/guests/playbooks/update/tasks/packages.yml b/guests/playbooks/= update/tasks/packages.yml index 7fdfc45..b3b8a27 100644 --- a/guests/playbooks/update/tasks/packages.yml +++ b/guests/playbooks/update/tasks/packages.yml @@ -52,6 +52,38 @@ when: - mappings[item][os_name + os_version] is defined =20 +- name: '{{ project }}: Look up mappings (default with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item]["default" + "-" + "x86_6= 4"] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item]["default" + "-" + "x86_64"] is defined + +- name: '{{ project }}: Look up mappings (package format with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item][package_format + "-" + "= x86_64"] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item][package_format + "-" + "x86_64"] is defined + +- name: '{{ project }}: Look up mappings (OS name with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item][os_name + "-" + "x86_64"= ] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item][os_name + "-" + "x86_64"] is defined + +- name: '{{ project }}: Look up mappings (OS version with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item][os_name + os_version + "= -" + "x86_64"] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item][os_name + os_version + "-" + "x86_64"] is defined + - set_fact: flattened: [] =20 diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml index f31b460..4ca8fae 100644 --- a/guests/vars/mappings.yml +++ b/guests/vars/mappings.yml @@ -7,9 +7,25 @@ # priority: # # - default -# - package format (deb, pkg, rpm) -# - OS name (CentOS, Debian, Fedora, FreeBSD, Ubuntu) -# - OS version (CentOS7, Debian9, FedoraRawhide, Ubuntu18 and so on) +# - package format +# - OS name +# - OS version +# - default with arch +# - package format with arch +# - OS name with arch +# - OS version with arch +# +# Valid package formats are +# - deb, pkg, rpm +# +# Valid OS names are: +# - CentOS, Debian, Fedora, FreeBSD, Ubuntu +# +# Valid OS versions are: +# - CentOS7, Debian9, FedoraRawhide, Ubuntu18 and so on +# +# The 'with arch' levels take a suffix "-$ARCH" where $ARCH +# is a libvirt arch name. # # So something like # @@ -27,6 +43,20 @@ # # will result in the 'ccache' package being installed everywhere except # for CentOS, where nothing will be installed. +# +# For example to prevent Xen being installed on any s390x +# +# xen: +# default-s390x: +# deb: libxen-dev +# Fedora: xen-devel +# +# Or the inverse to only install Xen on x86_64 +# +# xen: +# deb-x86_64: libxen-dev +# Fedora-x86_64: xen-devel +# =20 mappings: =20 @@ -278,6 +308,8 @@ mappings: =20 libnuma: deb: libnuma-dev + deb-armv6l: + deb-armv7l: rpm: numactl-devel =20 libparted: @@ -817,7 +849,9 @@ mappings: Debian8: =20 xen: - deb: libxen-dev + deb-x86_64: libxen-dev + deb-armv7l: libxen-dev + deb-aarch64: libxen-dev Fedora: xen-devel =20 xfsprogs: --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list