import OL libvirt-11.5.0-4.7.0.1.el10_1

This commit is contained in:
eabdullin 2026-02-25 07:24:05 +00:00
parent 729bf5df49
commit 8375425a99
5 changed files with 267 additions and 2 deletions

View File

@ -0,0 +1,119 @@
From 7dd390b47953b389ecabdc62ac3eec3091a8be3d Mon Sep 17 00:00:00 2001
Message-ID: <7dd390b47953b389ecabdc62ac3eec3091a8be3d.1769616662.git.jdenemar@redhat.com>
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 26 Jan 2026 10:47:01 +0000
Subject: [PATCH] esx: Abstract all URL-creation code into one function
Abstract the places where we create URLs into one place. This is just
refactoring and should not change the behaviour.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit e013d5b5cae732ddeae479098165b9331b8ea441)
Resolves: https://issues.redhat.com/browse/RHEL-142863
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/esx/esx_driver.c | 53 +++++++++++++++++++++++++++++++++++---------
1 file changed, 43 insertions(+), 10 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 8614ba3f32..432853c88a 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -589,7 +589,37 @@ esxCapsInit(esxPrivate *priv)
return NULL;
}
+static char *
+esxCreateURL(const char *transport,
+ const char *server,
+ int port,
+ const char *path)
+{
+ char *url;
+ url = g_strdup_printf("%s://%s:%d%s",
+ transport,
+ server,
+ port,
+ path);
+ return url;
+}
+
+/*
+ * Same as above, but add it to a buffer because the calling code will
+ * append query strings etc.
+ */
+static void
+esxCreateURLBuffer(virBuffer *buffer,
+ const char *transport,
+ const char *server,
+ int port,
+ const char *path)
+{
+ g_autofree char *url = esxCreateURL(transport, server, port, path);
+
+ virBufferAdd(buffer, url, -1);
+}
static int
esxConnectToHost(esxPrivate *priv,
@@ -626,8 +656,8 @@ esxConnectToHost(esxPrivate *priv,
conn->uri->server)))
goto cleanup;
- url = g_strdup_printf("%s://%s:%d/sdk", priv->parsedUri->transport,
- conn->uri->server, conn->uri->port);
+ url = esxCreateURL(priv->parsedUri->transport,
+ conn->uri->server, conn->uri->port, "/sdk");
if (esxVI_Context_Alloc(&priv->host) < 0 ||
esxVI_Context_Connect(priv->host, url, ipAddress, username, password,
@@ -713,8 +743,8 @@ esxConnectToVCenter(esxPrivate *priv,
if (!(password = virAuthGetPassword(conn, auth, "esx", username, hostname)))
return -1;
- url = g_strdup_printf("%s://%s:%d/sdk", priv->parsedUri->transport, hostname,
- conn->uri->port);
+ url = esxCreateURL(priv->parsedUri->transport, hostname,
+ conn->uri->port, "/sdk");
if (esxVI_Context_Alloc(&priv->vCenter) < 0 ||
esxVI_Context_Connect(priv->vCenter, url, ipAddress, username,
@@ -2364,8 +2394,9 @@ esxDomainScreenshot(virDomainPtr domain, virStreamPtr stream,
}
/* Build URL */
- virBufferAsprintf(&buffer, "%s://%s:%d/screen?id=", priv->parsedUri->transport,
- domain->conn->uri->server, domain->conn->uri->port);
+ esxCreateURLBuffer(&buffer, priv->parsedUri->transport,
+ domain->conn->uri->server, domain->conn->uri->port,
+ "/screen?id=");
virBufferURIEncodeString(&buffer, virtualMachine->obj->value);
url = virBufferContentAndReset(&buffer);
@@ -2570,8 +2601,9 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
goto cleanup;
}
- virBufferAsprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->transport,
- domain->conn->uri->server, domain->conn->uri->port);
+ esxCreateURLBuffer(&buffer, priv->parsedUri->transport,
+ domain->conn->uri->server, domain->conn->uri->port,
+ "/folder/");
virBufferURIEncodeString(&buffer, directoryAndFileName);
virBufferAddLit(&buffer, "?dcPath=");
esxUtil_EscapeInventoryObject(&buffer, priv->primary->datacenterPath);
@@ -2994,8 +3026,9 @@ esxDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
goto cleanup;
}
- virBufferAsprintf(&buffer, "%s://%s:%d/folder/", priv->parsedUri->transport,
- conn->uri->server, conn->uri->port);
+ esxCreateURLBuffer(&buffer, priv->parsedUri->transport,
+ conn->uri->server, conn->uri->port,
+ "/folder/");
if (directoryName) {
virBufferURIEncodeString(&buffer, directoryName);
--
2.52.0

View File

@ -0,0 +1,44 @@
From 33029bf5194d6562c8ffd20c9cc286ea298fb4b2 Mon Sep 17 00:00:00 2001
Message-ID: <33029bf5194d6562c8ffd20c9cc286ea298fb4b2.1769195688.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 20 Jan 2026 10:08:29 +0100
Subject: [PATCH] esx: Allow connecting to IPv6 server
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When connecting to a VMWare server, the hostname from URI is
resolved using esxUtil_ResolveHostname() which in turn calls
getaddrinfo(). But in the hints argument, we restrict the return
address to be IPv4 (AF_INET) which obviously fails if the address
to resolve is an IPv6 address. Set the hint to AF_UNSPEC which
allows both IPv4 and IPv6. While at it, also allow IPv4 addresses
mapped in IPv6 by setting AI_V4MAPPED flag.
Resolves: https://issues.redhat.com/browse/RHEL-138300
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 845210011a9ffd9d17e30c51cbc81ba67c5d3166)
Resolves: https://issues.redhat.com/browse/RHEL-142863
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/esx/esx_util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 9b714d90ba..963bcd0a75 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -280,8 +280,8 @@ esxUtil_ResolveHostname(const char *hostname, char **ipAddress)
int errcode;
g_autofree char *address = NULL;
- hints.ai_flags = AI_ADDRCONFIG;
- hints.ai_family = AF_INET;
+ hints.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED;
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
--
2.52.0

View File

@ -0,0 +1,29 @@
From ec2b306dfe705937dd5eab5c136af6fac7525f23 Mon Sep 17 00:00:00 2001
Message-ID: <ec2b306dfe705937dd5eab5c136af6fac7525f23.1769616662.git.jdenemar@redhat.com>
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 26 Jan 2026 10:38:02 +0000
Subject: [PATCH] esx: Debug URL just before opening with curl
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 38c952d89317f5b4bd23223f9a9d8be086ef7a40)
Resolves: https://issues.redhat.com/browse/RHEL-142863
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/esx/esx_vi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index d25f819bc5..44b24e3c91 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -231,6 +231,8 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url)
long responseCode = 0;
const char *redirectUrl = NULL;
+ VIR_DEBUG("URL: %s", url);
+
errorCode = curl_easy_perform(curl->handle);
if (errorCode != CURLE_OK) {
--
2.52.0

View File

@ -0,0 +1,57 @@
From b5ffe47a34a25a72e068ae1595b5d1102c9a980d Mon Sep 17 00:00:00 2001
Message-ID: <b5ffe47a34a25a72e068ae1595b5d1102c9a980d.1769616662.git.jdenemar@redhat.com>
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 26 Jan 2026 17:54:57 +0000
Subject: [PATCH] esx: Switch to creating URLs using virURIFormat
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since libvirt has existing support for creating URIs, use that rather
than home-rolling our own code without any escaping.
As a side-effect this ensures that URLs containing IPv6 addresses are
escaped correctly, for example as below (note square brackets):
https://[1234:56:0:789a:bcde:72ff:fe0a:7baa]:443/sdk
Fixes: https://issues.redhat.com/browse/RHEL-138300
Updates: commit 845210011a9ffd9d17e30c51cbc81ba67c5d3166
Reported-by: Ming Xie <mxie@redhat.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 13889feb14a24fdf7717960aa5331a0b63ce97ed)
Resolves: https://issues.redhat.com/browse/RHEL-142863
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/esx/esx_driver.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 432853c88a..9d1381db6b 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -595,14 +595,14 @@ esxCreateURL(const char *transport,
int port,
const char *path)
{
- char *url;
+ virURI uri = {
+ .scheme = (char*)transport,
+ .server = (char*)server,
+ .port = port,
+ .path = (char*)path,
+ };
- url = g_strdup_printf("%s://%s:%d%s",
- transport,
- server,
- port,
- path);
- return url;
+ return virURIFormat(&uri);
}
/*
--
2.52.0

View File

@ -289,7 +289,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 11.5.0
Release: 4.5%{?dist}%{?extra_release}
Release: 4.7.0.1%{?dist}%{?extra_release}
License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1
URL: https://libvirt.org/
@ -350,6 +350,10 @@ Patch50: libvirt-qemu-correctly-detect-working-TDX-support.patch
Patch51: libvirt-esx-Allow-disk-images-in-subdirectories.patch
Patch52: libvirt-esx_util-Introduce-esxUtil_EscapeInventoryObject.patch
Patch53: libvirt-esx-URI-encode-inventory-objects-twice.patch
Patch54: libvirt-esx-Allow-connecting-to-IPv6-server.patch
Patch55: libvirt-esx-Debug-URL-just-before-opening-with-curl.patch
Patch56: libvirt-esx-Abstract-all-URL-creation-code-into-one-function.patch
Patch57: libvirt-esx-Switch-to-creating-URLs-using-virURIFormat.patch
Requires: libvirt-daemon = %{version}-%{release}
@ -1399,7 +1403,8 @@ exit 1
%define arg_packager_version -Dpackager_version="%{release}"
%define arg_selinux_mount -Dselinux_mount="/sys/fs/selinux"
# place macros above and build commands below this comment
# Set SOURCE_DATE_EPOCH from changelog
%define source_date_epoch_from_changelog 1
export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/libvirt.spec)
@ -2745,6 +2750,17 @@ exit 0
%endif
%changelog
* Tue Feb 24 2026 EL Errata <el-errata_ww@oracle.com> - 11.5.0-4.7.0.1
- Set SOURCE_DATE_EPOCH from changelog [Orabug: 32019554]
* Wed Jan 28 2026 Jiri Denemark <jdenemar@redhat.com> - 11.5.0-4.7.el10_1
- esx: Debug URL just before opening with curl (RHEL-142863)
- esx: Abstract all URL-creation code into one function (RHEL-142863)
- esx: Switch to creating URLs using virURIFormat (RHEL-142863)
* Fri Jan 23 2026 Jiri Denemark <jdenemar@redhat.com> - 11.5.0-4.6.el10_1
- esx: Allow connecting to IPv6 server (RHEL-142863)
* Tue Jan 13 2026 Jiri Denemark <jdenemar@redhat.com> - 11.5.0-4.5.el10_1
- esx: Allow disk images in subdirectories (RHEL-140865)
- esx_util: Introduce esxUtil_EscapeInventoryObject() (RHEL-140465)