[libvirt] [PATCH V3 jenkins-ci 0/2] Add support for openSUSE

Jim Fehlig (2): guests: Add support for openSUSE guests: Add lci build support for openSUSE guests/configs/autoinst.xml | 77 +++++++++++++++++++ .../host_vars/libvirt-opensuse-151/docker.yml | 2 + .../libvirt-opensuse-151/install.yml | 2 + .../host_vars/libvirt-opensuse-151/main.yml | 10 +++ guests/inventory | 1 + guests/lcitool | 2 + guests/playbooks/build/jobs/defaults.yml | 1 + guests/playbooks/build/projects/libvirt.yml | 1 + guests/playbooks/update/tasks/base.yml | 15 ++++ guests/vars/mappings.yml | 38 ++++++++- 10 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 guests/configs/autoinst.xml create mode 100644 guests/host_vars/libvirt-opensuse-151/docker.yml create mode 100644 guests/host_vars/libvirt-opensuse-151/install.yml create mode 100644 guests/host_vars/libvirt-opensuse-151/main.yml -- 2.24.0

Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- guests/playbooks/build/jobs/defaults.yml | 1 + guests/playbooks/build/projects/libvirt.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/guests/playbooks/build/jobs/defaults.yml b/guests/playbooks/build/jobs/defaults.yml index 48cf643..43ab882 100644 --- a/guests/playbooks/build/jobs/defaults.yml +++ b/guests/playbooks/build/jobs/defaults.yml @@ -10,6 +10,7 @@ all_machines: - libvirt-freebsd-11 - libvirt-freebsd-12 - libvirt-freebsd-current + - libvirt-opensuse-151 - libvirt-ubuntu-16 - libvirt-ubuntu-18 rpm_machines: diff --git a/guests/playbooks/build/projects/libvirt.yml b/guests/playbooks/build/projects/libvirt.yml index 4b3dfdf..66ea851 100644 --- a/guests/playbooks/build/projects/libvirt.yml +++ b/guests/playbooks/build/projects/libvirt.yml @@ -19,6 +19,7 @@ - libvirt-fedora-30 - libvirt-fedora-31 - libvirt-fedora-rawhide + - libvirt-opensuse-151 - libvirt-ubuntu-16 - libvirt-ubuntu-18 - include: '{{ playbook_base }}/jobs/autotools-check-job.yml' -- 2.24.0

On Fri, 2019-12-06 at 23:44 +0000, Jim Fehlig wrote:
guests: Add lci build support for openSUSE
s/lci build/'lcitool build'/ With that changed Reviewed-by: Andrea Bolognani <abologna@redhat.com> I'll push the series in a few minutes. -- Andrea Bolognani / Red Hat / Virtualization

On Mon, 2019-12-09 at 12:59 +0100, Andrea Bolognani wrote:
On Fri, 2019-12-06 at 23:44 +0000, Jim Fehlig wrote:
guests: Add lci build support for openSUSE
s/lci build/'lcitool build'/
With that changed
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
I'll push the series in a few minutes.
Done. Unfortunately I've forgotten to give Fabiano credit for his work by including his R-bs, but I'm sure he'll forgive me - eventually ;) And it was of course implied, but no harm in spelling it out: thank you so much for working on this! I've wanted to add openSUSE support for a long time but never managed to actually get around to it. Looking forward to further patches introducing support for more projects, adding Docker support and generally bringing the support for openSUSE on par with that of the existing CI targets. -- Andrea Bolognani / Red Hat / Virtualization

On 12/9/19 8:44 AM, Andrea Bolognani wrote:
On Mon, 2019-12-09 at 12:59 +0100, Andrea Bolognani wrote:
On Fri, 2019-12-06 at 23:44 +0000, Jim Fehlig wrote:
guests: Add lci build support for openSUSE
s/lci build/'lcitool build'/
With that changed
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
I'll push the series in a few minutes.
Done.
Unfortunately I've forgotten to give Fabiano credit for his work by including his R-bs, but I'm sure he'll forgive me - eventually ;)
And it was of course implied, but no harm in spelling it out: thank you so much for working on this! I've wanted to add openSUSE support for a long time but never managed to actually get around to it.
I've wanted to add openSUSE for quite some time as well. Your mention of it and the subsequent hints on how to do it provided a good nudge.
Looking forward to further patches introducing support for more projects, adding Docker support and generally bringing the support for openSUSE on par with that of the existing CI targets.
Sounds good. Thanks again for the help! Regards, Jim

This change adds support for installing and updating openSUSE Leap 15.1 using lcilool. Signed-off-by: Jim Fehlig <jfehlig@suse.com> --- guests/configs/autoinst.xml | 77 +++++++++++++++++++ .../host_vars/libvirt-opensuse-151/docker.yml | 2 + .../libvirt-opensuse-151/install.yml | 2 + .../host_vars/libvirt-opensuse-151/main.yml | 10 +++ guests/inventory | 1 + guests/lcitool | 2 + guests/playbooks/update/tasks/base.yml | 15 ++++ guests/vars/mappings.yml | 38 ++++++++- 8 files changed, 143 insertions(+), 4 deletions(-) diff --git a/guests/configs/autoinst.xml b/guests/configs/autoinst.xml new file mode 100644 index 0000000..f8ec3df --- /dev/null +++ b/guests/configs/autoinst.xml @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<!DOCTYPE profile> +<profile + xmlns="http://www.suse.com/1.0/yast2ns" + xmlns:config="http://www.suse.com/1.0/configns"> + <general> + <mode> + <confirm config:type="boolean">false</confirm> + <second_stage config:type="boolean">false</second_stage> + </mode> + </general> + <partitioning config:type="list"> + <drive> + <device>/dev/vda</device> + <use>all</use> + <partitions config:type="list"> + <partition> + <filesystem config:type="symbol">swap</filesystem> + <size>256M</size> + <mount>swap</mount> + </partition> + <partition> + <filesystem config:type="symbol">ext4</filesystem> + <mount>/</mount> + <size>max</size> + </partition> + </partitions> + </drive> + </partitioning> + <bootloader> + <global> + <terminal>console serial</terminal> + </global> + </bootloader> + <timezone> + <hwclock>UTC</hwclock> + <timezone>UTC</timezone> + </timezone> + <software> + <install_recommended config:type="boolean">false</install_recommended> + <products config:type="list"> + <product>openSUSE</product> + </products> + <patterns config:type="list"> + <pattern>base</pattern> + <pattern>minimal_base</pattern> + <pattern>yast2_basis</pattern> + </patterns> + <packages config:type="list"> + <package>openssh</package> + <package>hostname</package> + </packages> + </software> + <networking> + <keep_install_network config:type="boolean">true</keep_install_network> + </networking> + <users config:type="list"> + <user> + <username>root</username> + <user_password>root</user_password> + <encrypted config:type="boolean">false</encrypted> + <uid>0</uid> + <gid>0</gid> + <home>/root</home> + <shell>/bin/bash</shell> + </user> + </users> + <services-manager> + <default_target>multi-user</default_target> + <services config:type="list"> + <service> + <service_name>sshd</service_name> + <service_status>enable</service_status> + </service> + </services> + </services-manager> +</profile> diff --git a/guests/host_vars/libvirt-opensuse-151/docker.yml b/guests/host_vars/libvirt-opensuse-151/docker.yml new file mode 100644 index 0000000..6ba7adb --- /dev/null +++ b/guests/host_vars/libvirt-opensuse-151/docker.yml @@ -0,0 +1,2 @@ +--- +docker_base: opensuse/leap:15.1 diff --git a/guests/host_vars/libvirt-opensuse-151/install.yml b/guests/host_vars/libvirt-opensuse-151/install.yml new file mode 100644 index 0000000..d0fdbe5 --- /dev/null +++ b/guests/host_vars/libvirt-opensuse-151/install.yml @@ -0,0 +1,2 @@ +--- +install_url: http://download.opensuse.org/distribution/leap/15.1/repo/oss/ diff --git a/guests/host_vars/libvirt-opensuse-151/main.yml b/guests/host_vars/libvirt-opensuse-151/main.yml new file mode 100644 index 0000000..f422a9e --- /dev/null +++ b/guests/host_vars/libvirt-opensuse-151/main.yml @@ -0,0 +1,10 @@ +--- +projects: + - libvirt + +package_format: 'rpm' +package_manager: 'zypper' +os_name: 'OpenSUSE' +os_version: '151' + +ansible_python_interpreter: /usr/bin/python3 diff --git a/guests/inventory b/guests/inventory index 3b15513..f1f7708 100644 --- a/guests/inventory +++ b/guests/inventory @@ -8,5 +8,6 @@ libvirt-fedora-rawhide libvirt-freebsd-11 libvirt-freebsd-12 libvirt-freebsd-current +libvirt-opensuse-151 libvirt-ubuntu-16 libvirt-ubuntu-18 diff --git a/guests/lcitool b/guests/lcitool index d617beb..8436ce7 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -531,6 +531,8 @@ class Application: install_config = "preseed.cfg" elif facts["os_name"] in ["CentOS", "Fedora"]: install_config = "kickstart.cfg" + elif facts["os_name"] == "OpenSUSE": + install_config = "autoinst.xml" else: raise Exception( "Host {} doesn't support installation".format(host) diff --git a/guests/playbooks/update/tasks/base.yml b/guests/playbooks/update/tasks/base.yml index 3d83e78..be4ae21 100644 --- a/guests/playbooks/update/tasks/base.yml +++ b/guests/playbooks/update/tasks/base.yml @@ -65,12 +65,27 @@ when: - package_format == 'pkg' +- name: Update installed packages + command: '{{ package_manager }} update -y -l --force-resolution --no-recommends' + args: + warn: no + when: + - os_name == 'OpenSUSE' + - name: Clean up packages after update shell: '{{ package_manager }} clean packages -y && {{ package_manager }} autoremove -y' args: warn: no when: - package_format == 'rpm' + - os_name != "OpenSUSE" + +- name: Clean up packages after update + shell: '{{ package_manager }} clean' + args: + warn: no + when: + - os_name == "OpenSUSE" - name: Clean up packages after update apt: diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml index f5dab6a..fce2028 100644 --- a/guests/vars/mappings.yml +++ b/guests/vars/mappings.yml @@ -19,10 +19,10 @@ # - deb, pkg, rpm # # Valid OS names are: -# - CentOS, Debian, Fedora, FreeBSD, Ubuntu +# - CentOS, Debian, Fedora, FreeBSD, OpenSUSE, Ubuntu # # Valid OS versions are: -# - CentOS7, Debian9, FedoraRawhide, Ubuntu18 and so on +# - CentOS7, Debian9, FedoraRawhide, OpenSUSE151, Ubuntu18 and so on # # The arch specific rules use a prefix "$ARCH-" where $ARCH # is a libvirt arch name. @@ -70,6 +70,7 @@ mappings: apparmor: deb: libapparmor-dev + OpenSUSE: libapparmor-devel cross-policy-deb: foreign augeas: @@ -117,6 +118,7 @@ mappings: cppi: Fedora: cppi FreeBSD: cppi + OpenSUSE: cppi cyrus-sasl: deb: libsasl2-dev @@ -127,6 +129,7 @@ mappings: dbus-daemon: default: dbus Fedora: dbus-daemon + OpenSUSE: dbus-1 device-mapper: deb: libdevmapper-dev @@ -196,6 +199,7 @@ mappings: deb: libglusterfs-dev rpm: glusterfs-api-devel Debian9: glusterfs-common + OpenSUSE: glusterfs-devel Ubuntu16: glusterfs-common Ubuntu18: glusterfs-common cross-policy-deb: foreign @@ -204,6 +208,7 @@ mappings: deb: libgnutls28-dev pkg: gnutls rpm: gnutls-devel + OpenSUSE: libgnutls-devel cross-policy-deb: foreign go: @@ -228,6 +233,7 @@ mappings: gtk-update-icon-cache: default: gtk-update-icon-cache + OpenSUSE: gtk3-tools Ubuntu16: libgtk2.0-bin gtk-vnc2: @@ -248,14 +254,17 @@ mappings: ip: deb: iproute2 rpm: iproute + OpenSUSE: iproute2 iscsiadm: deb: open-iscsi rpm: iscsi-initiator-utils + OpenSUSE: open-iscsi isoinfo: default: genisoimage FreeBSD: cdrkit + OpenSUSE: mkisofs java: deb: openjdk-11-jre-headless @@ -289,6 +298,7 @@ mappings: libaudit: deb: libaudit-dev rpm: audit-libs-devel + OpenSUSE: audit-devel cross-policy-deb: foreign libblkid: @@ -320,6 +330,7 @@ mappings: deb: libdbus-1-dev pkg: dbus rpm: dbus-devel + OpenSUSE: dbus-1-devel cross-policy-deb: foreign libgovirt: @@ -347,6 +358,7 @@ mappings: rpm: numactl-devel armv6l-deb: armv7l-deb: + OpenSUSE: libnuma-devel cross-policy-deb: foreign libparted: @@ -370,6 +382,7 @@ mappings: deb: librbd-dev Fedora: librbd-devel CentOS7: librbd1-devel + OpenSUSE: librbd-devel cross-policy-deb: foreign libselinux: @@ -436,6 +449,7 @@ mappings: deb: locales Fedora: glibc-langpack-en FreeBSD: + OpenSUSE: glibc-locale lsof: default: lsof @@ -458,6 +472,7 @@ mappings: ninja: default: ninja-build FreeBSD: ninja + OpenSUSE: ninja mingw32-curl: Fedora: mingw32-curl @@ -639,6 +654,7 @@ mappings: netcf: deb: libnetcf-dev rpm: netcf-devel + OpenSUSE: cross-policy-deb: skip net-tools: @@ -709,6 +725,7 @@ mappings: deb: libio-compress-perl pkg: p5-IO-Compress rpm: perl-IO-Compress-Bzip2 + OpenSUSE: perl-Compress-Bzip2 perl-IO-String: deb: libio-string-perl @@ -747,6 +764,7 @@ mappings: deb: libtest-lwp-useragent-perl pkg: p5-Test-LWP-UserAgent Fedora: perl-Test-LWP-UserAgent + OpenSUSE: perl-Test-LWP-UserAgent perl-Test-Pod: deb: libtest-pod-perl @@ -807,6 +825,7 @@ mappings: default: python3-dbus FreeBSD: py36-dbus CentOS7: python36-dbus + OpenSUSE: python3-dbus-python python3-devel: deb: python3-dev @@ -814,17 +833,20 @@ mappings: Fedora: python3-devel CentOS7: python36-devel cross-policy-deb: foreign + OpenSUSE: python3-devel python3-gi: deb: python3-gi pkg: py36-gobject3 rpm: python3-gobject CentOS7: python36-gobject + OpenSUSE: python3-gobject python3-libxml2: default: python3-libxml2 FreeBSD: py36-libxml2 CentOS7: + OpenSUSE: python3-libxml2-python Ubuntu16: python3-lxml: @@ -860,6 +882,7 @@ mappings: qemu-img: default: qemu-utils rpm: qemu-img + OpenSUSE: qemu-tools radvd: default: radvd @@ -905,6 +928,7 @@ mappings: deb: libspice-client-gtk-3.0-dev pkg: spice-gtk rpm: spice-gtk3-devel + OpenSUSE: spice-gtk-devel cross-policy-deb: foreign strace: @@ -918,6 +942,7 @@ mappings: deb: iproute2 rpm: iproute-tc CentOS7: iproute + OpenSUSE: iproute2 unzip: default: unzip @@ -939,11 +964,12 @@ mappings: wireshark: deb: wireshark-dev - Fedora: wireshark-devel + rpm: wireshark-devel + CentOS: cross-policy-deb: skip xen: - Fedora: xen-devel + rpm: xen-devel x86_64-deb: libxen-dev armv7l-deb: libxen-dev aarch64-deb: libxen-dev @@ -970,18 +996,21 @@ mappings: xz-static: deb: liblzma-dev Fedora: xz-static + OpenSUSE: xz-static-devel cross-policy-deb: foreign yajl: deb: libyajl-dev pkg: yajl rpm: yajl-devel + OpenSUSE: libyajl-devel cross-policy-deb: foreign zfs: default: zfs-fuse CentOS: FreeBSD: + OpenSUSE: zlib: deb: zlib1g-dev @@ -991,6 +1020,7 @@ mappings: zlib-static: deb: zlib1g-dev rpm: zlib-static + OpenSUSE: zlib-devel-static cross-policy-deb: foreign -- 2.24.0

On Fri, 2019-12-06 at 23:44 +0000, Jim Fehlig wrote:
This change adds support for installing and updating openSUSE Leap 15.1 using lcilool.
s/lool/tool/
+++ b/guests/host_vars/libvirt-opensuse-151/docker.yml +--- +docker_base: opensuse/leap:15.1
Docker support is still busted: if you generate the Dockerfile and try to build the corresponding container, it will eventually fail during the post-install cleanup steps. Really easy to reproduce: $ docker run --rm \ opensuse/leap:15.1 \ /bin/sh -c 'zypper autoremove -y && zypper clean all -y && echo ok' Unknown command 'autoremove' Type 'zypper help' to get a list of global options and commands. In case 'autoremove' is not a typo it's probably not a built-in command, but provided as a subcommand or plug-in (see 'zypper help subcommand'). In this case a specific package providing the subcommand needs to be installed first. Those packages are often named 'zypper-autoremove' or 'zypper-autoremove-plugin'. You need to tweak the _action_dockerfile() function to make this work correctly on openSUSE; for the time being, it's okay to just drop this hunk from the commit with the expectation that you'll have it as part of a follow-up patch that introduces working Docker support. [...]
+++ b/guests/playbooks/update/tasks/base.yml - name: Clean up packages after update shell: '{{ package_manager }} clean packages -y && {{ package_manager }} autoremove -y' args: warn: no when: - package_format == 'rpm' + - os_name != "OpenSUSE" + +- name: Clean up packages after update + shell: '{{ package_manager }} clean' + args: + warn: no + when: + - os_name == "OpenSUSE"
We use single quotes in this file. [...]
+++ b/guests/playbooks/vars/mappings.yml dbus-daemon: default: dbus Fedora: dbus-daemon + OpenSUSE: dbus-1
dbus-daemon is not a build dependency of libvirt but rather of libvirt-dbus, so this mapping should not be introduced now but rather later on when libvirt-dbus support is added. These are all the mappings that have been introduced prematurely: dbus-daemon gtk-update-icon-cache isoinfo perl-IO-Compress-Bzip2 perl-Test-LWP-UserAgent python3-dbus python3-devel python3-gi python3-libxml2 spice-gtk3 xz-static zlib-static [...]
wireshark: deb: wireshark-dev - Fedora: wireshark-devel + rpm: wireshark-devel + CentOS: cross-policy-deb: skip
xen: - Fedora: xen-devel + rpm: xen-devel
This will not do, as it will result in attempting to install xen-devel on CentOS (which doesn't have that package): the correct way to handle the situation is the same as the wireshark mapping right above it. Everything else looks good, and I've verified that after applying the patch it's possible to successfully install and update a guest, so Reviewed-by: Andrea Bolognani <abologna@redhat.com> I'll take care of addressing the issues mentioned above before pushing. -- Andrea Bolognani / Red Hat / Virtualization

On 12/6/19 4:44 PM, Jim Fehlig wrote:
Jim Fehlig (2): guests: Add support for openSUSE guests: Add lci build support for openSUSE
I forgot to mention, 'lcitool update libvirt-opensuse-151 libvirt' still fails in the Configure hostname task TASK [Configure hostname] ********************************************************************** fatal: [libvirt-opensuse-151]: FAILED! => {"changed": false, "msg": "hostname module cannot be used on platform Linux (Opensuse-leap)"}
guests/configs/autoinst.xml | 77 +++++++++++++++++++ .../host_vars/libvirt-opensuse-151/docker.yml | 2 + .../libvirt-opensuse-151/install.yml | 2 + .../host_vars/libvirt-opensuse-151/main.yml | 10 +++ guests/inventory | 1 + guests/lcitool | 2 + guests/playbooks/build/jobs/defaults.yml | 1 + guests/playbooks/build/projects/libvirt.yml | 1 + guests/playbooks/update/tasks/base.yml | 15 ++++ guests/vars/mappings.yml | 38 ++++++++- 10 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 guests/configs/autoinst.xml create mode 100644 guests/host_vars/libvirt-opensuse-151/docker.yml create mode 100644 guests/host_vars/libvirt-opensuse-151/install.yml create mode 100644 guests/host_vars/libvirt-opensuse-151/main.yml

On Sat, Dec 7, 2019 at 1:13 AM Jim Fehlig <jfehlig@suse.com> wrote:
On 12/6/19 4:44 PM, Jim Fehlig wrote:
Jim Fehlig (2): guests: Add support for openSUSE guests: Add lci build support for openSUSE
I forgot to mention, 'lcitool update libvirt-opensuse-151 libvirt' still fails in the Configure hostname task
TASK [Configure hostname] ********************************************************************** fatal: [libvirt-opensuse-151]: FAILED! => {"changed": false, "msg": "hostname module cannot be used on platform Linux (Opensuse-leap)"}
This is related to the ansible version you have in your machine. I'm using ansible 2.9.1 and I can see, as part of /usr/lib/python3.7/site-packages/ansible/modules/system/hostname.py: ``` class OpenSUSELeapHostname(Hostname): platform = 'Linux' distribution = 'Opensuse-leap' strategy_class = SystemdStrategy ``` Maybe it's worth a bug report in order to have it backported to the ansible package you have in your distro. The same goes with the patch I've submitted adding Opensuse-tumbleweed. Best Regards, -- Fabiano Fidêncio

On Sat, 2019-12-07 at 16:51 +0100, Fabiano Fidêncio wrote:
On Sat, Dec 7, 2019 at 1:13 AM Jim Fehlig <jfehlig@suse.com> wrote:
I forgot to mention, 'lcitool update libvirt-opensuse-151 libvirt' still fails in the Configure hostname task
TASK [Configure hostname] ********************************************************************** fatal: [libvirt-opensuse-151]: FAILED! => {"changed": false, "msg": "hostname module cannot be used on platform Linux (Opensuse-leap)"}
This is related to the ansible version you have in your machine. I'm using ansible 2.9.1 and I can see, as part of /usr/lib/python3.7/site-packages/ansible/modules/system/hostname.py: ``` class OpenSUSELeapHostname(Hostname): platform = 'Linux' distribution = 'Opensuse-leap' strategy_class = SystemdStrategy ```
Maybe it's worth a bug report in order to have it backported to the ansible package you have in your distro.
The production environment has Ansible 2.8.4, which knows about Leap. So we're good on that front, and Jim's issue is not a blocker for inclusion as far as I'm concerned. He'll probably want to get it fixed somehow, though :) -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Fabiano Fidêncio
-
Jim Fehlig