Drop old distros, bump glib and switch to glib URI parsing code
Subsystems (3)
v3 cover Drop old distros, bump glib and switch to glib URI parsing code
In the QEMU 9.1 development cycle, we can drop the support for Ubuntu 20.04 and CentOS 8 since the following major versions of these distributions are available since 2 years already.
This allows us to bump the minimum version of glib to 2.66 which comes with a nice set of URI parsing functions. By switching to these parsing functions, we can finally drop our own URI parsing code in util/uri.c.
NB: We also need to update some of the custom runners in our CI environment first (since they still use Ubuntu 20.04).
v3:
- Added Reviewed-bys
- Updated many patch descriptions according to the review feedback in v2
- Change "Illegal" in warning message to "Invalid"
- Removed "." at the end of a warn_report string
v2:
- Added Paolo's patch to bump the external CI runners
- Added patch to drop more glib compatibility hunks
- Use g_autoptr() in the URI patches for simplification
- Don't allow port 0 in the URIs
Paolo Bonzini (1):
ci: move external build environment setups to CentOS Stream 9
Thomas Huth (12):
tests: Remove Ubuntu 20.04 container tests/lcitool/libvirt-ci: Update to the latest master branch tests/docker/dockerfiles: Run lcitool-refresh after the lcitool update
tests: Update our CI to use CentOS Stream 9 instead of 8 .travis.yml: Update the jobs to Ubuntu 22.04
Bump minimum glib version to v2.66
Remove glib compatibility code that is not required anymore block/gluster: Use URI parsing code from glib
block/nbd: Use URI parsing code from glib
block/nfs: Use URI parsing code from glib
block/ssh: Use URI parsing code from glib
util/uri: Remove the old URI parsing code
meson.build | 16 +-
include/glib-compat.h | 27 +-
include/qemu/uri.h | 99 --
block/gluster.c | 71 +-
block/nbd.c | 76 +-
block/nfs.c | 110 +-
block/ssh.c | 75 +-
qga/commands-posix-ssh.c | 12 +-
util/error-report.c | 10 -
util/uri.c | 1466 -----------------
.gitlab-ci.d/buildtest.yml | 16 +-
.gitlab-ci.d/container-core.yml | 4 +-
.travis.yml | 13 +-
.../stream/{8 => 9}/build-environment.yml | 31 +-
.../stream/{8 => 9}/x86_64/configure | 4 +-
.../stream/{8 => 9}/x86_64/test-avocado | 0
scripts/ci/setup/build-environment.yml | 44 +-
tests/docker/dockerfiles/alpine.docker | 3 +-
.../{centos8.docker => centos9.docker} | 35 +-
.../dockerfiles/debian-amd64-cross.docker | 3 +-
.../dockerfiles/debian-arm64-cross.docker | 3 +-
.../dockerfiles/debian-armel-cross.docker | 3 +-
.../dockerfiles/debian-armhf-cross.docker | 3 +-
.../dockerfiles/debian-i686-cross.docker | 3 +-
.../dockerfiles/debian-mips64el-cross.docker | 3 +-
.../dockerfiles/debian-mipsel-cross.docker | 3 +-
.../dockerfiles/debian-ppc64el-cross.docker | 3 +-
.../dockerfiles/debian-riscv64-cross.docker | 3 +-
.../dockerfiles/debian-s390x-cross.docker | 3 +-
tests/docker/dockerfiles/debian.docker | 1 +
.../dockerfiles/fedora-win64-cross.docker | 3 +-
tests/docker/dockerfiles/fedora.docker | 1 +
tests/docker/dockerfiles/opensuse-leap.docker | 1 +
tests/docker/dockerfiles/ubuntu2004.docker | 157 --
tests/docker/dockerfiles/ubuntu2204.docker | 1 +
tests/lcitool/libvirt-ci | 2 +-
tests/lcitool/mappings.yml | 20 -
tests/lcitool/refresh | 3 +-
tests/vm/centos | 4 +-
util/meson.build | 2 +-
40 files changed, 265 insertions(+), 2072 deletions(-)
delete mode 100644 include/qemu/uri.h
delete mode 100644 util/uri.c
rename scripts/ci/org.centos/stream/{8 => 9}/build-environment.yml (75%)
rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/configure (98%)
rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/test-avocado (100%)
rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%)
delete mode 100644 tests/docker/dockerfiles/ubuntu2004.dockerSignature · 1 line
2.44.0
PATCH v3 1/13 tests: Remove Ubuntu 20.04 container
Since Ubuntu 22.04 is now available since two years, we can stop actively supporting the previous LTS version of Ubuntu now.
--- tests/docker/dockerfiles/ubuntu2004.docker | 157 --------------------- tests/lcitool/refresh | 1 - 2 files changed, 158 deletions(-) delete mode 100644 tests/docker/dockerfiles/ubuntu2004.docker
tests/docker/dockerfiles/ubuntu2004.docker deleted +0 -157
@@ -1,157 +0,0 @@ -# THIS FILE WAS AUTO-GENERATED -# -# $ lcitool dockerfile --layers all ubuntu-2004 qemu -# -# https://gitlab.com/libvirt/libvirt-ci - -FROM docker.io/library/ubuntu:20.04 - -RUN export DEBIAN_FRONTEND=noninteractive && \ - apt-get update && \ - apt-get install -y eatmydata && \ - eatmydata apt-get dist-upgrade -y && \ - eatmydata apt-get install --no-install-recommends -y \ - bash \ - bc \ - bison \ - bsdmainutils \ - bzip2 \ - ca-certificates \ - ccache \ - clang \ - dbus \ - debianutils \ - diffutils \ - exuberant-ctags \ - findutils \ - flex \ - g++ \ - gcc \ - gcovr \ - gettext \ - git \ - hostname \ - libaio-dev \ - libasan6 \ - libasound2-dev \ - libattr1-dev \ - libbrlapi-dev \ - libbz2-dev \ - libc6-dev \ - libcacard-dev \ - libcap-ng-dev \ - libcapstone-dev \ - libcmocka-dev \ - libcurl4-gnutls-dev \ - libdaxctl-dev \ - libdrm-dev \ - libepoxy-dev \ - libfdt-dev \ - libffi-dev \ - libfuse3-dev \ - libgbm-dev \ - libgcrypt20-dev \ - libglib2.0-dev \ - libglusterfs-dev \ - libgnutls28-dev \ - libgtk-3-dev \ - libibumad-dev \ - libibverbs-dev \ - libiscsi-dev \ - libjemalloc-dev \ - libjpeg-turbo8-dev \ - libjson-c-dev \ - liblttng-ust-dev \ - liblzo2-dev \ - libncursesw5-dev \ - libnfs-dev \ - libnuma-dev \ - libpam0g-dev \ - libpcre2-dev \ - libpixman-1-dev \ - libpmem-dev \ - libpng-dev \ - libpulse-dev \ - librbd-dev \ - librdmacm-dev \ - libsasl2-dev \ - libsdl2-dev \ - libsdl2-image-dev \ - libseccomp-dev \ - libselinux1-dev \ - libslirp-dev \ - libsnappy-dev \ - libsndio-dev \ - libspice-protocol-dev \ - libspice-server-dev \ - libssh-dev \ - libsystemd-dev \ - libtasn1-6-dev \ - libubsan1 \ - libudev-dev \ - libusb-1.0-0-dev \ - libusbredirhost-dev \ - libvdeplug-dev \ - libvirglrenderer-dev \ - libvte-2.91-dev \ - libxen-dev \ - libzstd-dev \ - llvm \ - locales \ - make \ - mtools \ - multipath-tools \ - ncat \ - nettle-dev \ - ninja-build \ - openssh-client \ - pkgconf \ - python3 \ - python3-numpy \ - python3-opencv \ - python3-pillow \ - python3-pip \ - python3-setuptools \ - python3-sphinx \ - python3-sphinx-rtd-theme \ - python3-venv \ - python3-wheel \ - python3-yaml \ - rpm2cpio \ - sed \ - socat \ - sparse \ - systemtap-sdt-dev \ - tar \ - tesseract-ocr \ - tesseract-ocr-eng \ - xfslibs-dev \ - xorriso \ - zlib1g-dev \ - zstd && \ - eatmydata apt-get autoremove -y && \ - eatmydata apt-get autoclean -y && \ - sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales && \ - dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ - mkdir -p /usr/libexec/ccache-wrappers && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc - -RUN /usr/bin/pip3 install \ - meson==0.63.2 \ - tomli - -ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" -ENV LANG "en_US.UTF-8" -ENV MAKE "/usr/bin/make" -ENV NINJA "/usr/bin/ninja" -ENV PYTHON "/usr/bin/python3" -# As a final step configure the user (if env is defined) -ARG USER -ARG UID -RUN if [ "${USER}" ]; then \ - id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
tests/lcitool/refresh +0 -1
@@ -130,7 +130,6 @@ try: trailer="".join(debian12_extras)) generate_dockerfile("fedora", "fedora-38") generate_dockerfile("opensuse-leap", "opensuse-leap-15") - generate_dockerfile("ubuntu2004", "ubuntu-2004") generate_dockerfile("ubuntu2204", "ubuntu-2204") #
Signature · 1 line
2.44.0
PATCH v3 3/13 tests/docker/dockerfiles: Run lcitool-refresh after the lcitool update
In reply to Thomas HuthThis update adds the removing of the EXTERNALLY-MANAGED marker files that has been added to the lcitool recently.
Quoting Daniel:
"For those who don't know, python now commonly blocks the ability to run 'pip install' outside of a venv. This generally makes sense for a precious installation environment. Our containers are disposable though, so a venv has no benefit. Removing the 'EXTERNALLY-MANAGED' allows the historical arbitrary use of 'pip' outside a venv. lcitool just does this unconditionally given the containers are not precious."
--- tests/docker/dockerfiles/alpine.docker | 3 ++- tests/docker/dockerfiles/centos8.docker | 1 + tests/docker/dockerfiles/debian-amd64-cross.docker | 3 ++- tests/docker/dockerfiles/debian-arm64-cross.docker | 3 ++- tests/docker/dockerfiles/debian-armel-cross.docker | 3 ++- tests/docker/dockerfiles/debian-armhf-cross.docker | 3 ++- tests/docker/dockerfiles/debian-i686-cross.docker | 3 ++- tests/docker/dockerfiles/debian-mips64el-cross.docker | 3 ++- tests/docker/dockerfiles/debian-mipsel-cross.docker | 3 ++- tests/docker/dockerfiles/debian-ppc64el-cross.docker | 3 ++- tests/docker/dockerfiles/debian-riscv64-cross.docker | 3 ++- tests/docker/dockerfiles/debian-s390x-cross.docker | 3 ++- tests/docker/dockerfiles/debian.docker | 1 + tests/docker/dockerfiles/fedora-win64-cross.docker | 3 ++- tests/docker/dockerfiles/fedora.docker | 1 + tests/docker/dockerfiles/opensuse-leap.docker | 1 + tests/docker/dockerfiles/ubuntu2204.docker | 1 + 17 files changed, 29 insertions(+), 12 deletions(-)
tests/docker/dockerfiles/alpine.docker +2 -1
@@ -116,7 +116,8 @@ RUN apk update && \ zlib-static \ zstd \ zstd-dev && \ - apk list | sort > /packages.txt && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ + apk list --installed | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
tests/docker/dockerfiles/centos8.docker +1 -0
@@ -123,6 +123,7 @@ RUN dnf distro-sync -y && \ zstd && \ dnf autoremove -y && \ dnf clean all -y && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ rpm -qa | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
tests/docker/dockerfiles/debian-amd64-cross.docker +2 -1
@@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/debian-arm64-cross.docker +2 -1
@@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/debian-armel-cross.docker +2 -1
@@ -65,7 +65,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED RUN /usr/bin/pip3 install tomli
tests/docker/dockerfiles/debian-armhf-cross.docker +2 -1
@@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/debian-i686-cross.docker +2 -1
@@ -65,7 +65,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED RUN /usr/bin/pip3 install tomli
tests/docker/dockerfiles/debian-mips64el-cross.docker +2 -1
@@ -65,7 +65,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED RUN /usr/bin/pip3 install tomli
tests/docker/dockerfiles/debian-mipsel-cross.docker +2 -1
@@ -65,7 +65,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED RUN /usr/bin/pip3 install tomli
tests/docker/dockerfiles/debian-ppc64el-cross.docker +2 -1
@@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/debian-riscv64-cross.docker +2 -1
@@ -33,7 +33,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/debian-s390x-cross.docker +2 -1
@@ -64,7 +64,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoremove -y && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales + dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/debian.docker +1 -0
@@ -137,6 +137,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
tests/docker/dockerfiles/fedora-win64-cross.docker +2 -1
@@ -64,7 +64,8 @@ exec "$@"\n' > /usr/bin/nosync && \ xorriso \ zstd && \ nosync dnf autoremove -y && \ - nosync dnf clean all -y + nosync dnf clean all -y && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8"
tests/docker/dockerfiles/fedora.docker +1 -0
@@ -137,6 +137,7 @@ exec "$@"\n' > /usr/bin/nosync && \ zstd && \ nosync dnf autoremove -y && \ nosync dnf clean all -y && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ rpm -qa | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
tests/docker/dockerfiles/opensuse-leap.docker +1 -0
@@ -119,6 +119,7 @@ RUN zypper update -y && \ zlib-devel-static \ zstd && \ zypper clean --all && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ rpm -qa | sort > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
tests/docker/dockerfiles/ubuntu2204.docker +1 -0
@@ -137,6 +137,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ eatmydata apt-get autoclean -y && \ sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ dpkg-reconfigure locales && \ + rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \ dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \ mkdir -p /usr/libexec/ccache-wrappers && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
Signature · 1 line
2.44.0
PATCH v3 5/13 .travis.yml: Update the jobs to Ubuntu 22.04
In reply to Thomas HuthAccording to our support policy, we'll soon drop our official support for Ubuntu 20.04 ("Focal Fossa") in QEMU. Thus we should update the Travis jobs now to a newer release (Ubuntu 22.04 - "Jammy Jellyfish") for future testing. Since all jobs are using this release now, we can drop the entries from the individual jobs and use the global setting again.
--- .travis.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
.travis.yml +3 -10
@@ -1,5 +1,5 @@ os: linux -dist: focal +dist: jammy language: c compiler: - gcc
@@ -7,7 +7,7 @@ cache: # There is one cache per branch and compiler version. # characteristics of each job are used to identify the cache: # - OS name (currently only linux) - # - OS distribution (for Linux, bionic or focal) + # - OS distribution (e.g. "jammy" for Linux) # - Names and values of visible environment variables set in .travis.yml or Settings panel timeout: 1200 ccache: true
@@ -83,7 +83,6 @@ jobs: - name: "[aarch64] GCC check-tcg" arch: arm64 - dist: focal addons: apt_packages: - libaio-dev
@@ -119,7 +118,6 @@ jobs: - name: "[ppc64] GCC check-tcg" arch: ppc64le - dist: focal addons: apt_packages: - libaio-dev
@@ -154,7 +152,6 @@ jobs: - name: "[s390x] GCC check-tcg" arch: s390x - dist: focal addons: apt_packages: - libaio-dev
@@ -199,7 +196,6 @@ jobs: - name: "[s390x] GCC (other-system)" arch: s390x - dist: focal addons: apt_packages: - libaio-dev
@@ -229,7 +225,6 @@ jobs: - name: "[s390x] GCC (user)" arch: s390x - dist: focal addons: apt_packages: - libgcrypt20-dev
@@ -244,8 +239,7 @@ jobs: - name: "[s390x] Clang (disable-tcg)" arch: s390x - dist: focal - compiler: clang-10 + compiler: clang addons: apt_packages: - libaio-dev
@@ -271,7 +265,6 @@ jobs: - libvdeplug-dev - libvte-2.91-dev - ninja-build - - clang-10 env: - TEST_CMD="make check-unit" - CONFIG="--disable-containers --disable-tcg --enable-kvm --disable-tools
Signature · 1 line
2.44.0
PATCH v3 10/13 block/nbd: Use URI parsing code from glib
In reply to Thomas HuthSince version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter. The g_uri_get_host() also takes care of removing the square brackets from IPv6 addresses, so we can drop that part of the QEMU code now, too.
--- block/nbd.c | 76 ++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 39 deletions(-)
block/nbd.c +37 -39
@@ -31,7 +31,6 @@#include "qemu/osdep.h" #include "trace.h" -#include "qemu/uri.h" #include "qemu/option.h" #include "qemu/cutils.h" #include "qemu/main-loop.h"
@@ -1514,30 +1513,31 @@ static void nbd_client_close(BlockDriverState *bs)static int nbd_parse_uri (const char *filename,QDict *options) { -URI *uri; +g_autoptr (GUri) uri =g_uri_parse (filename,G_URI_FLAGS_NONE ,NULL ); +g_autoptr (GHashTable) qp =NULL ;const char *p; -QueryParams *qp =NULL ; -int ret =0 ; +int qp_n;bool is_unix; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port; - uri =uri_parse (filename);if (!uri) {return -EINVAL ; }/* transport */ -if (!g_strcmp0 (uri->scheme,"nbd" )) { + uri_scheme =g_uri_get_scheme (uri); +if (!g_strcmp0 (uri_scheme,"nbd" )) { is_unix = false; - }else if (!g_strcmp0 (uri->scheme,"nbd+tcp" )) { + }else if (!g_strcmp0 (uri_scheme,"nbd+tcp" )) { is_unix = false; - }else if (!g_strcmp0 (uri->scheme,"nbd+unix" )) { + }else if (!g_strcmp0 (uri_scheme,"nbd+unix" )) { is_unix = true; }else { - ret = -EINVAL ; - goto out; +return -EINVAL ; } - p = uri->path ? uri->path :"" ; + p =g_uri_get_path (uri) ?:"" ;if (p[0 ] =='/' ) { p++; }
@@ -1545,52 +1545,50 @@ static int nbd_parse_uri(const char *filename, QDict *options)qdict_put_str (options,"export" , p); } - qp =query_params_parse (uri->query); -if (qp->n >1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { - ret = -EINVAL ; - goto out; + uri_query =g_uri_get_query (uri); +if (uri_query) { + qp =g_uri_parse_params (uri_query,-1 ,"&" ,G_URI_PARAMS_NONE ,NULL ); +if (!qp) { +return -EINVAL ; + } + qp_n =g_hash_table_size (qp); +if (qp_n >1 || (is_unix && !qp_n) || (!is_unix && qp_n)) { +return -EINVAL ; + } + } + + uri_server =g_uri_get_host (uri); +if (uri_server && !uri_server[0 ]) { + uri_server =NULL ; } + uri_port =g_uri_get_port (uri);if (is_unix) {/* nbd+unix:///export?socket=path */ -if (uri->server || uri->port ||strcmp (qp->p[0 ].name,"socket" )) { - ret = -EINVAL ; - goto out; +const char *uri_socket =g_hash_table_lookup (qp,"socket" ); +if (uri_server || uri_port !=-1 || !uri_socket) { +return -EINVAL ; }qdict_put_str (options,"server.type" ,"unix" ); -qdict_put_str (options,"server.path" , qp->p[0 ].value); +qdict_put_str (options,"server.path" , uri_socket); }else { -QString *host;char *port_str;/* nbd[+tcp]://host[:port]/export */ -if (!uri->server) { - ret = -EINVAL ; - goto out; - } - -/* strip braces from literal IPv6 address */ -if (uri->server[0 ] =='[' ) { - host =qstring_from_substr (uri->server,1 , -strlen (uri->server) -1 ); - }else { - host =qstring_from_str (uri->server); +if (!uri_server) { +return -EINVAL ; }qdict_put_str (options,"server.type" ,"inet" ); -qdict_put (options,"server.host" , host); +qdict_put_str (options,"server.host" , uri_server); - port_str =g_strdup_printf ("%d" , uri->port ?:NBD_DEFAULT_PORT ); + port_str =g_strdup_printf ("%d" , uri_port >0 ? uri_port + :NBD_DEFAULT_PORT );qdict_put_str (options,"server.port" , port_str);g_free (port_str); } -out: -if (qp) { -query_params_free (qp); - } -uri_free (uri); -return ret; +return 0 ; }static bool nbd_has_filename_options_conflict (QDict *options,Error **errp)
Signature · 1 line
2.44.0
PATCH v3 11/13 block/nfs: Use URI parsing code from glib
In reply to Thomas HuthSince version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter.
While we're at it, slightly rephrase one of the error messages:
Use "Invalid value..." instead of "Illegal value..." since the latter rather sounds like the users were breaking a law here.
--- block/nfs.c | 110 ++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 56 deletions(-)
block/nfs.c +54 -56
@@ -38,7 +38,6 @@#include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qemu/uri.h" #include "qemu/cutils.h" #include "sysemu/replay.h" #include "qapi/qapi-visit-block-core.h"
@@ -79,77 +78,76 @@ typedef struct NFSRPC {static int nfs_parse_uri (const char *filename,QDict *options,Error **errp) { -URI *uri =NULL ; -QueryParams *qp =NULL ; -int ret = -EINVAL , i; +g_autoptr (GUri) uri =g_uri_parse (filename,G_URI_FLAGS_NONE ,NULL ); +GUriParamsIter qp; +const char *uri_server, *uri_path, *uri_query; +char *qp_name, *qp_value; +GError *gerror =NULL ; - uri =uri_parse (filename);if (!uri) {error_setg (errp,"Invalid URI specified" ); - goto out; +return -EINVAL ; } -if (g_strcmp0 (uri->scheme,"nfs" ) !=0 ) { +if (!g_str_equal (g_uri_get_scheme (uri),"nfs" )) {error_setg (errp,"URI scheme must be 'nfs'" ); - goto out; +return -EINVAL ; } -if (!uri->server) { + uri_server =g_uri_get_host (uri); +if (!uri_server || !uri_server[0 ]) {error_setg (errp,"missing hostname in URI" ); - goto out; +return -EINVAL ; } -if (!uri->path) { + uri_path =g_uri_get_path (uri); +if (!uri_path || !uri_path[0 ]) {error_setg (errp,"missing file path in URI" ); - goto out; - } - - qp =query_params_parse (uri->query); -if (!qp) { -error_setg (errp,"could not parse query parameters" ); - goto out; +return -EINVAL ; } -qdict_put_str (options,"server.host" , uri->server); +qdict_put_str (options,"server.host" , uri_server);qdict_put_str (options,"server.type" ,"inet" ); -qdict_put_str (options,"path" , uri->path); - -for (i =0 ; i < qp->n; i++) { -uint64_t val; -if (!qp->p[i].value) { -error_setg (errp,"Value for NFS parameter expected: %s" , - qp->p[i].name); - goto out; - } -if (parse_uint_full (qp->p[i].value,0 , &val)) { -error_setg (errp,"Illegal value for NFS parameter: %s" , - qp->p[i].name); - goto out; - } -if (!strcmp (qp->p[i].name,"uid" )) { -qdict_put_str (options,"user" , qp->p[i].value); - }else if (!strcmp (qp->p[i].name,"gid" )) { -qdict_put_str (options,"group" , qp->p[i].value); - }else if (!strcmp (qp->p[i].name,"tcp-syncnt" )) { -qdict_put_str (options,"tcp-syn-count" , qp->p[i].value); - }else if (!strcmp (qp->p[i].name,"readahead" )) { -qdict_put_str (options,"readahead-size" , qp->p[i].value); - }else if (!strcmp (qp->p[i].name,"pagecache" )) { -qdict_put_str (options,"page-cache-size" , qp->p[i].value); - }else if (!strcmp (qp->p[i].name,"debug" )) { -qdict_put_str (options,"debug" , qp->p[i].value); - }else { -error_setg (errp,"Unknown NFS parameter name: %s" , - qp->p[i].name); - goto out; +qdict_put_str (options,"path" , uri_path); + + uri_query =g_uri_get_query (uri); +if (uri_query) { +g_uri_params_iter_init (&qp, uri_query,-1 ,"&" ,G_URI_PARAMS_NONE ); +while (g_uri_params_iter_next (&qp, &qp_name, &qp_value, &gerror)) { +uint64_t val; +if (!qp_name || gerror) { +error_setg (errp,"Failed to parse NFS parameter" ); +return -EINVAL ; + } +if (!qp_value) { +error_setg (errp,"Value for NFS parameter expected: %s" , + qp_name); +return -EINVAL ; + } +if (parse_uint_full (qp_value,0 , &val)) { +error_setg (errp,"Invalid value for NFS parameter: %s" , + qp_name); +return -EINVAL ; + } +if (g_str_equal (qp_name,"uid" )) { +qdict_put_str (options,"user" , qp_value); + }else if (g_str_equal (qp_name,"gid" )) { +qdict_put_str (options,"group" , qp_value); + }else if (g_str_equal (qp_name,"tcp-syncnt" )) { +qdict_put_str (options,"tcp-syn-count" , qp_value); + }else if (g_str_equal (qp_name,"readahead" )) { +qdict_put_str (options,"readahead-size" , qp_value); + }else if (g_str_equal (qp_name,"pagecache" )) { +qdict_put_str (options,"page-cache-size" , qp_value); + }else if (g_str_equal (qp_name,"debug" )) { +qdict_put_str (options,"debug" , qp_value); + }else { +error_setg (errp,"Unknown NFS parameter name: %s" , qp_name); +return -EINVAL ; + } } } - ret =0 ; -out: -if (qp) { -query_params_free (qp); - } -uri_free (uri); -return ret; + +return 0 ; }static bool nfs_has_filename_options_conflict (QDict *options,Error **errp)
Signature · 1 line
2.44.0
PATCH v3 4/13 tests: Update our CI to use CentOS Stream 9 instead of 8
In reply to Thomas HuthRHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now.
Another reason for doing this is that Centos Stream 8 will go EOL soon:
https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/
"After May 31, 2024, CentOS Stream 8 will be archived
and no further updates will be provided."
Thus upgrade our CentOS Stream container to major version 9 now.
---
.gitlab-ci.d/buildtest.yml | 16 ++++-----
.gitlab-ci.d/container-core.yml | 4 +--
.../{centos8.docker => centos9.docker} | 34 +++++++------------
tests/lcitool/mappings.yml | 20 -----------
tests/lcitool/refresh | 2 +-
tests/vm/centos | 4 +--
6 files changed, 26 insertions(+), 54 deletions(-)
rename tests/docker/dockerfiles/{centos8.docker => centos9.docker} (82%).gitlab-ci.d/buildtest.yml +8 -8
@@ -158,9 +158,9 @@ build-system-centos: - .native_build_job_template - .native_build_artifact_template needs: - job: amd64-centos8-container + job: amd64-centos9-container variables: - IMAGE: centos8 + IMAGE: centos9 CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server --enable-modules --enable-trace-backends=dtrace --enable-docs TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
@@ -242,7 +242,7 @@ check-system-centos: - job: build-system-centos artifacts: true variables: - IMAGE: centos8 + IMAGE: centos9 MAKE_CHECK_ARGS: check avocado-system-centos:
@@ -251,7 +251,7 @@ avocado-system-centos: - job: build-system-centos artifacts: true variables: - IMAGE: centos8 + IMAGE: centos9 MAKE_CHECK_ARGS: check-avocado AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx arch:sh4 arch:nios2
@@ -327,9 +327,9 @@ avocado-system-flaky: build-tcg-disabled: extends: .native_build_job_template needs: - job: amd64-centos8-container + job: amd64-centos9-container variables: - IMAGE: centos8 + IMAGE: centos9 script: - mkdir build - cd build
@@ -651,9 +651,9 @@ build-tci: build-without-defaults: extends: .native_build_job_template needs: - job: amd64-centos8-container + job: amd64-centos9-container variables: - IMAGE: centos8 + IMAGE: centos9 CONFIGURE_ARGS: --without-default-devices --without-default-features
.gitlab-ci.d/container-core.yml +2 -2
@@ -1,10 +1,10 @@ include: - local: '/.gitlab-ci.d/container-template.yml' -amd64-centos8-container: +amd64-centos9-container: extends: .container_job_template variables: - NAME: centos8 + NAME: centos9 amd64-fedora-container: extends: .container_job_template
tests/docker/dockerfiles/centos9.docker renamed from tests/docker/dockerfiles/centos8.docker +13 -21
@@ -1,15 +1,14 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all centos-stream-8 qemu +# $ lcitool dockerfile --layers all centos-stream-9 qemu # # https://gitlab.com/libvirt/libvirt-ci -FROM quay.io/centos/centos:stream8 +FROM quay.io/centos/centos:stream9 RUN dnf distro-sync -y && \ dnf install 'dnf-command(config-manager)' -y && \ - dnf config-manager --set-enabled -y powertools && \ - dnf install -y centos-release-advanced-virtualization && \ + dnf config-manager --set-enabled -y crb && \ dnf install -y epel-release && \ dnf install -y epel-next-release && \ dnf install -y \
@@ -42,7 +41,6 @@ RUN dnf distro-sync -y && \ glib2-static \ glibc-langpack-en \ glibc-static \ - glusterfs-api-devel \ gnutls-devel \ gtk3-devel \ hostname \
@@ -82,6 +80,7 @@ RUN dnf distro-sync -y && \ lzo-devel \ make \ mesa-libgbm-devel \ + meson \ mtools \ ncurses-devel \ nettle-devel \
@@ -95,25 +94,25 @@ RUN dnf distro-sync -y && \ pixman-devel \ pkgconfig \ pulseaudio-libs-devel \ - python38 \ - python38-PyYAML \ - python38-numpy \ - python38-pip \ - python38-setuptools \ - python38-wheel \ + python3 \ + python3-PyYAML \ + python3-numpy \ + python3-pillow \ + python3-pip \ + python3-sphinx \ + python3-sphinx_rtd_theme \ + python3-tomli \ rdma-core-devel \ sed \ snappy-devel \ socat \ spice-protocol \ - spice-server-devel \ swtpm \ systemd-devel \ systemtap-sdt-devel \ tar \ usbredir-devel \ util-linux \ - virglrenderer-devel \ vte291-devel \ which \ xfsprogs-devel \
@@ -132,18 +131,11 @@ RUN dnf distro-sync -y && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc -RUN /usr/bin/pip3.8 install \ - meson==0.63.2 \ - pillow \ - sphinx \ - sphinx-rtd-theme \ - tomli - ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" ENV MAKE "/usr/bin/make" ENV NINJA "/usr/bin/ninja" -ENV PYTHON "/usr/bin/python3.8" +ENV PYTHON "/usr/bin/python3" # As a final step configure the user (if env is defined) ARG USER ARG UID
tests/lcitool/mappings.yml +0 -20
@@ -1,66 +1,50 @@ mappings: flake8: - CentOSStream8: OpenSUSELeap15: meson: - CentOSStream8: OpenSUSELeap15: python3: - CentOSStream8: python38 OpenSUSELeap15: python311-base python3-PyYAML: - CentOSStream8: python38-PyYAML OpenSUSELeap15: python3-devel: - CentOSStream8: python38-devel OpenSUSELeap15: python311-devel python3-docutils: - CentOSStream8: OpenSUSELeap15: python3-numpy: - CentOSStream8: python38-numpy OpenSUSELeap15: python3-opencv: - CentOSStream8: OpenSUSELeap15: python3-pillow: - CentOSStream8: OpenSUSELeap15: python3-pip: - CentOSStream8: python38-pip OpenSUSELeap15: python311-pip python3-pillow: - CentOSStream8: OpenSUSELeap15: python3-selinux: - CentOSStream8: OpenSUSELeap15: python3-setuptools: - CentOSStream8: python38-setuptools OpenSUSELeap15: python311-setuptools python3-sphinx: - CentOSStream8: OpenSUSELeap15: python3-sphinx-rtd-theme: - CentOSStream8: OpenSUSELeap15: python3-sqlite3: - CentOSStream8: python38 OpenSUSELeap15: python311 python3-tomli:
@@ -69,15 +53,11 @@ mappings: Fedora: Debian12: OpenSUSELeap15: - # Not available for Python 3.8 - CentOSStream8: python3-venv: - CentOSStream8: python38 OpenSUSELeap15: python311-base python3-wheel: - CentOSStream8: python38-wheel OpenSUSELeap15: python311-pip pypi_mappings:
tests/lcitool/refresh +1 -1
@@ -125,7 +125,7 @@ try: # Standard native builds # generate_dockerfile("alpine", "alpine-318") - generate_dockerfile("centos8", "centos-stream-8") + generate_dockerfile("centos9", "centos-stream-9") generate_dockerfile("debian", "debian-12", trailer="".join(debian12_extras)) generate_dockerfile("fedora", "fedora-38")
tests/vm/centos +2 -2
@@ -26,8 +26,8 @@ class CentosVM(basevm.BaseVM): export SRC_ARCHIVE=/dev/vdb; sudo chmod a+r $SRC_ARCHIVE; tar -xf $SRC_ARCHIVE; - make docker-test-block@centos8 {verbose} J={jobs} NETWORK=1; - make docker-test-quick@centos8 {verbose} J={jobs} NETWORK=1; + make docker-test-block@centos9 {verbose} J={jobs} NETWORK=1; + make docker-test-quick@centos9 {verbose} J={jobs} NETWORK=1; """ def build_image(self, img):
Signature · 1 line
2.44.0
PATCH v3 8/13 Remove glib compatibility code that is not required anymore
In reply to Thomas HuthNow that we bumped the minumum glib version to 2.66, we can drop the old code.
--- qga/commands-posix-ssh.c | 8 -------- util/error-report.c | 10 ---------- 2 files changed, 18 deletions(-)
qga/commands-posix-ssh.c +0 -8
@@ -288,7 +288,6 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp) }#ifdef QGA_BUILD_UNIT_TEST -#if GLIB_CHECK_VERSION (2 ,60 ,0 )static const strList test_key2 = { .value = (char *)"algo key2 comments" };
@@ -484,11 +483,4 @@ int main(int argc, char *argv[]) return g_test_run(); } -#else -int main (int argc,char *argv[]) -{ -g_test_message ("test skipped, needs glib >= 2.60" ); -return 0 ; -} -#endif /* GLIB_2_60 */ #endif /* BUILD_UNIT_TEST */
util/error-report.c +0 -10
@@ -172,18 +172,8 @@ static void print_loc(void)static char *real_time_iso8601 (void ) { -#if GLIB_CHECK_VERSION (2 ,62 ,0 )g_autoptr (GDateTime) dt =g_date_time_new_now_utc (); -/* ignore deprecation warning, since GLIB_VERSION_MAX_ALLOWED is 2.56 */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations"return g_date_time_format_iso8601 (dt); -#pragma GCC diagnostic pop -#else -GTimeVal tv; -g_get_current_time (&tv); -return g_time_val_to_iso8601 (&tv); -#endif }/*
Signature · 1 line
2.44.0
PATCH v3 2/13 tests/lcitool/libvirt-ci: Update to the latest master branch
In reply to Thomas HuthWe need the latest fixes for the lcitool to be able to properly update our CentOS docker file to CentOS Stream 9.
--- tests/lcitool/libvirt-ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/lcitool/libvirt-ci +1 -1
@@ -1 +1 @@ -Subproject commit 77c800186f34b21be7660750577cc5582a914deb +Subproject commit cec67039719becbfbab866f9c23574f389cf9559
Signature · 1 line
2.44.0
PATCH v3 9/13 block/gluster: Use URI parsing code from glib
In reply to Thomas HuthSince version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter.
Since g_uri_get_path() returns a const pointer, we also need to tweak the parameter of parse_volume_options() (where we use the result of g_uri_get_path() as input).
--- block/gluster.c | 71 ++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 36 deletions(-)
block/gluster.c +35 -36
@@ -17,7 +17,6 @@#include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" -#include "qemu/uri.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/option.h"
@@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs) } } -static int parse_volume_options (BlockdevOptionsGluster *gconf,char *path) +static int parse_volume_options (BlockdevOptionsGluster *gconf,const char *path) { -char *p, *q; +const char *p, *q;if (!path) {return -EINVAL ;
@@ -349,13 +348,13 @@ static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path)static int qemu_gluster_parse_uri (BlockdevOptionsGluster *gconf,const char *filename) { +g_autoptr (GUri) uri =g_uri_parse (filename,G_URI_FLAGS_NONE ,NULL ); +g_autoptr (GHashTable) qp =NULL ;SocketAddress *gsconf; -URI *uri; -QueryParams *qp =NULL ;bool is_unix = false; -int ret =0 ; +const char *uri_scheme, *uri_query, *uri_server; +int uri_port, ret; - uri =uri_parse (filename);if (!uri) {return -EINVAL ; }
@@ -364,57 +363,57 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,QAPI_LIST_PREPEND (gconf->server, gsconf);/* transport */ -if (!uri->scheme || !strcmp (uri->scheme,"gluster" )) { + uri_scheme =g_uri_get_scheme (uri); +if (!uri_scheme || !strcmp (uri_scheme,"gluster" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ; - }else if (!strcmp (uri->scheme,"gluster+tcp" )) { + }else if (!strcmp (uri_scheme,"gluster+tcp" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ; - }else if (!strcmp (uri->scheme,"gluster+unix" )) { + }else if (!strcmp (uri_scheme,"gluster+unix" )) { gsconf->type =SOCKET_ADDRESS_TYPE_UNIX ; is_unix = true; - }else if (!strcmp (uri->scheme,"gluster+rdma" )) { + }else if (!strcmp (uri_scheme,"gluster+rdma" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ;warn_report ("rdma feature is not supported, falling back to tcp" ); }else { - ret = -EINVAL ; - goto out; +return -EINVAL ; } - ret =parse_volume_options (gconf, uri->path); + ret =parse_volume_options (gconf,g_uri_get_path (uri));if (ret <0 ) { - goto out; +return ret; } - qp =query_params_parse (uri->query); -if (qp->n >1 || (is_unix && !qp->n) || (!is_unix && qp->n)) { - ret = -EINVAL ; - goto out; + uri_query =g_uri_get_query (uri); +if (uri_query) { + qp =g_uri_parse_params (uri_query,-1 ,"&" ,G_URI_PARAMS_NONE ,NULL ); +if (!qp) { +return -EINVAL ; + } + ret =g_hash_table_size (qp); +if (ret >1 || (is_unix && !ret) || (!is_unix && ret)) { +return -EINVAL ; + } } + uri_server =g_uri_get_host (uri); + uri_port =g_uri_get_port (uri); +if (is_unix) { -if (uri->server || uri->port) { - ret = -EINVAL ; - goto out; - } -if (strcmp (qp->p[0 ].name,"socket" )) { - ret = -EINVAL ; - goto out; +char *uri_socket =g_hash_table_lookup (qp,"socket" ); +if (uri_server || uri_port !=-1 || !uri_socket) { +return -EINVAL ; } - gsconf->u.q_unix.path =g_strdup (qp->p[0 ].value); + gsconf->u.q_unix.path =g_strdup (uri_socket); }else { - gsconf->u.inet.host =g_strdup (uri->server ? uri->server :"localhost" ); -if (uri->port) { - gsconf->u.inet.port =g_strdup_printf ("%d" , uri->port); + gsconf->u.inet.host =g_strdup (uri_server ? uri_server :"localhost" ); +if (uri_port >0 ) { + gsconf->u.inet.port =g_strdup_printf ("%d" , uri_port); }else { gsconf->u.inet.port =g_strdup_printf ("%d" ,GLUSTER_DEFAULT_PORT ); } } -out: -if (qp) { -query_params_free (qp); - } -uri_free (uri); -return ret; +return 0 ; } static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
Signature · 1 line
2.44.0
PATCH v3 13/13 util/uri: Remove the old URI parsing code
In reply to Thomas HuthNow that we switched all consumers of the URI code to use the URI parsing functions from glib instead, we can remove our internal URI parsing code since it is not used anymore.
--- include/qemu/uri.h | 99 --- util/uri.c | 1466 -------------------------------------------- util/meson.build | 2 +- 3 files changed, 1 insertion(+), 1566 deletions(-) delete mode 100644 include/qemu/uri.h delete mode 100644 util/uri.c
include/qemu/uri.h deleted +0 -99
@@ -1,99 +0,0 @@ -/** -* Summary: library of generic URI related routines -* Description: library of generic URI related routines -* Implements RFC 2396 -* -* Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* -* Except as contained in this notice, the name of Daniel Veillard shall not -* be used in advertising or otherwise to promote the sale, use or other -* dealings in this Software without prior written authorization from him. -* -* Author: Daniel Veillard -** -* Copyright (C) 2007 Red Hat, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library. If not, see <https://www.gnu.org/licenses/>. -* -* Authors: -* Richard W.M. Jones <[email protected]> -* -* Utility functions to help parse and assemble query strings. -*/ - -#ifndef QEMU_URI_H -#define QEMU_URI_H - -/** -* URI: -* -* A parsed URI reference. This is a struct containing the various fields -* as described in RFC 2396 but separated for further processing. -*/ -typedef struct URI { -char *scheme;/* the URI scheme */ -char *opaque;/* opaque part */ -char *authority;/* the authority part */ -char *server;/* the server part */ -char *user;/* the user part */ -int port;/* the port number */ -char *path;/* the path string */ -char *fragment;/* the fragment identifier */ -int cleanup;/* parsing potentially unclean URI */ -char *query;/* the query string (as it appears in the URI) */ -}URI ; - -URI *uri_new (void ); -URI *uri_parse (const char *str); -URI *uri_parse_raw (const char *str,int raw); -int uri_parse_into (URI *uri,const char *str); -char *uri_to_string (URI *uri); -void uri_free (URI *uri); - -/* Single web service query parameter 'name=value'. */ -typedef struct QueryParam { -char *name;/* Name (unescaped). */ -char *value;/* Value (unescaped). */ -int ignore;/* Ignore this field in qparam_get_query */ -}QueryParam ; - -/* Set of parameters. */ -typedef struct QueryParams { -int n;/* number of parameters used */ -int alloc;/* allocated space */ -QueryParam *p;/* array of parameters */ -}QueryParams ; - -QueryParams *query_params_new (int init_alloc); -QueryParams *query_params_parse (const char *query); -void query_params_free (QueryParams *ps); - -#endif /* QEMU_URI_H */
util/uri.c deleted +0 -1466
1,466 lines not on this page · raw message
util/meson.build +1 -1
@@ -94,7 +94,7 @@ if have_block util_ss.add(files('hbitmap.c')) util_ss.add(files('hexdump.c')) util_ss.add(files('iova-tree.c')) - util_ss.add(files('iov.c', 'uri.c')) + util_ss.add(files('iov.c')) util_ss.add(files('nvdimm-utils.c')) util_ss.add(files('block-helpers.c')) util_ss.add(files('qemu-coroutine-sleep.c'))
Signature · 1 line
2.44.0
PATCH v3 6/13 ci: move external build environment setups to CentOS Stream 9
In reply to Thomas HuthFrom: Paolo Bonzini <[email protected]>
RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active support for the previous major version 8 now.
Thus upgrade our CentOS Stream build environment playbooks to major version 9 now.
Message-ID: <[email protected]>
---
.../stream/{8 => 9}/build-environment.yml | 31 ++++++-------
.../stream/{8 => 9}/x86_64/configure | 4 +-
.../stream/{8 => 9}/x86_64/test-avocado | 0
scripts/ci/setup/build-environment.yml | 44 +++++++------------
4 files changed, 34 insertions(+), 45 deletions(-)
rename scripts/ci/org.centos/stream/{8 => 9}/build-environment.yml (75%)
rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/configure (98%)
rename scripts/ci/org.centos/stream/{8 => 9}/x86_64/test-avocado (100%)scripts/ci/org.centos/stream/9/build-environment.yml renamed from scripts/ci/org.centos/stream/8/build-environment.yml +16 -15
@@ -2,32 +2,32 @@ - name: Installation of extra packages to build QEMU hosts: all tasks: - - name: Extra check for CentOS Stream 8 + - name: Extra check for CentOS Stream 9 lineinfile: path: /etc/redhat-release - line: CentOS Stream release 8 + line: CentOS Stream release 9 state: present check_mode: yes - register: centos_stream_8 + register: centos_stream_9 - - name: Enable EPEL repo on CentOS Stream 8 + - name: Enable EPEL repo on CentOS Stream 9 dnf: name: - epel-release state: present when: - - centos_stream_8 + - centos_stream_9 - - name: Enable PowerTools repo on CentOS Stream 8 + - name: Enable CRB repo on CentOS Stream 9 ini_file: - path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo - section: powertools + path: /etc/yum.repos.d/centos.repo + section: crb option: enabled value: "1" when: - - centos_stream_8 + - centos_stream_9 - - name: Install basic packages to build QEMU on CentOS Stream 8 + - name: Install basic packages to build QEMU on CentOS Stream 9 dnf: name: - bzip2
@@ -42,7 +42,6 @@ - gettext - git - glib2-devel - - glusterfs-api-devel - gnutls-devel - libaio-devel - libcap-ng-devel
@@ -61,22 +60,24 @@ - lzo-devel - make - mesa-libEGL-devel + - meson - nettle-devel - ninja-build - nmap-ncat - numactl-devel - pixman-devel - - python38 + - python3 + - python3-pip - python3-sphinx + - python3-sphinx_rtd_theme + - python3-tomli - rdma-core-devel - redhat-rpm-config - snappy-devel - - spice-glib-devel - - spice-server-devel - systemd-devel - systemtap-sdt-devel - tar - zlib-devel state: present when: - - centos_stream_8 + - centos_stream_9
scripts/ci/org.centos/stream/9/x86_64/configure renamed from scripts/ci/org.centos/stream/8/x86_64/configure +1 -3
@@ -16,7 +16,7 @@ # that patches adding downstream specific devices are not available. # ../configure \ ---python=/usr/bin/python3.8 \ +--python=/usr/bin/python3.9 \ --prefix="/usr" \ --libdir="/usr/lib64" \ --datadir="/usr/share" \
@@ -157,7 +157,6 @@ --enable-docs \ --enable-fdt \ --enable-gcrypt \ ---enable-glusterfs \ --enable-gnutls \ --enable-guest-agent \ --enable-iconv \
@@ -180,7 +179,6 @@ --enable-seccomp \ --enable-snappy \ --enable-smartcard \ ---enable-spice \ --enable-system \ --enable-tcg \ --enable-tools \
scripts/ci/org.centos/stream/9/x86_64/test-avocado renamed from scripts/ci/org.centos/stream/8/x86_64/test-avocado +0 -0
scripts/ci/setup/build-environment.yml +17 -27
95 lines not on this page · raw message
Signature · 1 line
2.44.0
PATCH v3 12/13 block/ssh: Use URI parsing code from glib
In reply to Thomas HuthSince version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter.
While we're at it, also emit a warning when encountering unknown parameters in the URI, so that the users have a chance to detect their typos or other mistakes.
--- block/ssh.c | 75 ++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 35 deletions(-)
block/ssh.c +40 -35
@@ -37,7 +37,6 @@#include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/sockets.h" -#include "qemu/uri.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h"
@@ -181,65 +180,71 @@ static void sftp_error_trace(BDRVSSHState *s, const char *op)static int parse_uri (const char *filename,QDict *options,Error **errp) { -URI *uri =NULL ; -QueryParams *qp; +g_autoptr (GUri) uri =g_uri_parse (filename,G_URI_FLAGS_NONE ,NULL ); +const char *uri_host, *uri_path, *uri_user, *uri_query;char *port_str; -int i; +int port; +g_autoptr (GError) gerror =NULL ; +char *qp_name, *qp_value; +GUriParamsIter qp; - uri =uri_parse (filename);if (!uri) {return -EINVAL ; } -if (g_strcmp0 (uri->scheme,"ssh" ) !=0 ) { +if (g_strcmp0 (g_uri_get_scheme (uri),"ssh" ) !=0 ) {error_setg (errp,"URI scheme must be 'ssh'" ); - goto err; +return -EINVAL ; } -if (!uri->server ||strcmp (uri->server,"" ) ==0 ) { + uri_host =g_uri_get_host (uri); +if (!uri_host ||g_str_equal (uri_host,"" )) {error_setg (errp,"missing hostname in URI" ); - goto err; +return -EINVAL ; } -if (!uri->path ||strcmp (uri->path,"" ) ==0 ) { + uri_path =g_uri_get_path (uri); +if (!uri_path ||g_str_equal (uri_path,"" )) {error_setg (errp,"missing remote path in URI" ); - goto err; - } - - qp =query_params_parse (uri->query); -if (!qp) { -error_setg (errp,"could not parse query parameters" ); - goto err; +return -EINVAL ; } -if (uri->user &&strcmp (uri->user,"" ) !=0 ) { -qdict_put_str (options,"user" , uri->user); + uri_user =g_uri_get_user (uri); +if (uri_user && !g_str_equal (uri_user,"" )) { +qdict_put_str (options,"user" , uri_user); } -qdict_put_str (options,"server.host" , uri->server); +qdict_put_str (options,"server.host" , uri_host); - port_str =g_strdup_printf ("%d" , uri->port ?:22 ); + port =g_uri_get_port (uri); + port_str =g_strdup_printf ("%d" , port >0 ? port :22 );qdict_put_str (options,"server.port" , port_str);g_free (port_str); -qdict_put_str (options,"path" , uri->path); - -/* Pick out any query parameters that we understand, and ignore -* the rest. -*/ -for (i =0 ; i < qp->n; ++i) { -if (strcmp (qp->p[i].name,"host_key_check" ) ==0 ) { -qdict_put_str (options,"host_key_check" , qp->p[i].value); +qdict_put_str (options,"path" , uri_path); + + uri_query =g_uri_get_query (uri); +if (uri_query) { +g_uri_params_iter_init (&qp, uri_query,-1 ,"&" ,G_URI_PARAMS_NONE ); +while (g_uri_params_iter_next (&qp, &qp_name, &qp_value, &gerror)) { +if (!qp_name || !qp_value || gerror) { +warn_report ("Failed to parse SSH URI parameters '%s'" , + uri_query); +break ; + } +/* +* Pick out the query parameters that we understand, and ignore +* (or rather warn about) the rest. +*/ +if (g_str_equal (qp_name,"host_key_check" )) { +qdict_put_str (options,"host_key_check" , qp_value); + }else { +warn_report ("Unsupported parameter '%s' in URI" , qp_name); + } } } -query_params_free (qp); -uri_free (uri);return 0 ; - - err: -uri_free (uri); -return -EINVAL ; }static bool ssh_has_filename_options_conflict (QDict *options,Error **errp)
Signature · 1 line
2.44.0
PATCH v3 7/13 Bump minimum glib version to v2.66
In reply to Thomas HuthNow that we dropped support for CentOS 8 and Ubuntu 20.04, we can look into bumping the glib version to a new minimum for further clean-ups. According to repology.org, available versions are:
CentOS Stream 9: 2.66.7 Debian 11: 2.66.8 Fedora 38: 2.74.1 Freebsd: 2.78.4 Homebrew: 2.80.0 Openbsd: 2.78.4 OpenSuse leap 15.5: 2.70.5 pkgsrc_current: 2.78.4 Ubuntu 22.04: 2.72.1
Thus it should be safe to bump the minimum glib version to 2.66 now. Version 2.66 comes with new functions for URI parsing which will allow further clean-ups in the following patches.
--- meson.build | 16 +--------------- include/glib-compat.h | 27 ++------------------------- qga/commands-posix-ssh.c | 4 ++-- 3 files changed, 5 insertions(+), 42 deletions(-)
meson.build +1 -15
@@ -869,7 +869,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ # When bumping glib minimum version, please check also whether to increase # the _WIN32_WINNT setting in osdep.h according to the value from glib -glib_req_ver = '>=2.56.0' +glib_req_ver = '>=2.66.0' glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true, method: 'pkg-config') glib_cflags = []
@@ -910,20 +910,6 @@ if not cc.compiles(''' to the right pkg-config files for your build target.''') endif -# Silence clang warnings triggered by glib < 2.57.2 -if not cc.compiles(''' - #include <glib.h> - typedef struct Foo { - int i; - } Foo; - static void foo_free(Foo *f) - { - g_free(f); - } - G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free) - int main(void) { return 0; }''', dependencies: glib_pc, args: ['-Wunused-function', '-Werror']) - glib_cflags += cc.get_supported_arguments('-Wno-unused-function') -endif glib = declare_dependency(dependencies: [glib_pc, gmodule], compile_args: glib_cflags, version: glib_pc.version())
include/glib-compat.h +2 -25
@@ -19,12 +19,12 @@/* Ask for warnings for anything that was marked deprecated in * the defined version, or before. It is a candidate for rewrite. */ -#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56 +#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_66/* Ask for warnings if code tries to use function that did not * exist in the defined version. These risk breaking builds */ -#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56 +#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_66#pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -105,29 +105,6 @@ static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) }#define g_memdup2 (m, s) g_memdup2_qemu(m, s) -#if defined(G_OS_UNIX ) -/* -* Note: The fallback implementation is not MT-safe, and it returns a copy of -* the libc passwd (must be g_free() after use) but not the content. Because of -* these important differences the caller must be aware of, it's not #define for -* GLib API substitution. -*/ -static inline struct passwd * -g_unix_get_passwd_entry_qemu (const gchar *user_name,GError **error) -{ -#if GLIB_CHECK_VERSION (2 ,64 ,0 ) -return g_unix_get_passwd_entry (user_name, error); -#else -struct passwd *p =getpwnam (user_name); -if (!p) { -g_set_error_literal (error,G_UNIX_ERROR ,0 ,g_strerror (errno)); -return NULL ; - } -return (struct passwd *)g_memdup (p,sizeof (*p)); -#endif -} -#endif /* G_OS_UNIX */ -static inline bool qemu_g_test_slow (void ) {
qga/commands-posix-ssh.c +2 -2
@@ -35,7 +35,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error) return p; } -#define g_unix_get_passwd_entry_qemu (username, err) \ +#define g_unix_get_passwd_entry (username, err) \ test_get_passwd_entry(username, err)#endif
@@ -45,7 +45,7 @@ get_passwd_entry(const char *username, Error **errp)g_autoptr (GError) err =NULL ;struct passwd *p; - p =g_unix_get_passwd_entry_qemu (username, &err); + p =g_unix_get_passwd_entry (username, &err);if (p ==NULL ) {error_setg (errp,"failed to lookup user '%s': %s" , username, err->message);
Signature · 1 line
2.44.0
Re: [PATCH v3 01/13] tests: Remove Ubuntu 20.04 container
In reply to Thomas HuthQuoted 1 line · Thomas Huth
Since Ubuntu 22.04 is now available since two years, we can stop
Grammar suggestion:
Since Ubuntu 22.04 has now been available for more than two years,
Quoted 5 lines
actively supporting the previous LTS version of Ubuntu now.
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Thomas Huth <[email protected]>---
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org
Re: [PATCH v3 04/13] tests: Update our CI to use CentOS Stream 9 instead of 8
In reply to Thomas HuthQuoted 2 lines · Thomas Huth
RHEL 9 (and thus also the derivatives) are available since two years now, so according to QEMU's support policy, we can drop the active
Grammar suggestion:
RHEL 9 (and thus also the derivatives) have been available for two years now,
Quoted 13 lines
support for the previous major version 8 now.
Another reason for doing this is that Centos Stream 8 will go EOL soon:
https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/
"After May 31, 2024, CentOS Stream 8 will be archived
and no further updates will be provided."Thus upgrade our CentOS Stream container to major version 9 now.
Reviewed-by Daniel P. Berrangé <[email protected]>Signed-off-by Thomas Huth <[email protected]>
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org
Re: [PATCH v3 09/13] block/gluster: Use URI parsing code from glib
In reply to Thomas HuthQuoted 17 lines · Thomas Huth
Since version 2.66, glib has useful URI parsing functions, too. Use those instead of the QEMU-internal ones to be finally able to get rid of the latter.
Since
g_uri_get_path()returns a const pointer, we also need to tweak the parameter ofparse_volume_options()(where we use the result ofg_uri_get_path()as input).Reviewed-by Eric Blake <[email protected]>Reviewed-by Daniel P. Berrangé <[email protected]>Signed-off-by Thomas Huth <[email protected]>--- block/gluster.c | 71 ++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 36 deletions(-)
block/gluster.c static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf, · line 368
Quoted 7 lines
block/gluster.c +2
-1@@ -364,57 +363,57 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,QAPI_LIST_PREPEND (gconf->server, gsconf);/* transport */ -if (!uri->scheme || !strcmp (uri->scheme,"gluster" )) { + uri_scheme =g_uri_get_scheme (uri); +if (!uri_scheme || !strcmp (uri_scheme,"gluster" )) { gsconf->type =SOCKET_ADDRESS_TYPE_INET ;
It may be worth a mention in the commit message that we are aware that this provides a positive user-visible change as a side-effect: namely, by virtue of using glib's parser (which normalizes the scheme to lowercase) instead of our own (which did not), we now accept GLUSTER:// URIs in addition to the usual gluster:// spelling. Similar comments to all the other affected patches in the series.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org