Compare commits
No commits in common. "c9-beta" and "c10s" have entirely different histories.
15
.gitignore
vendored
15
.gitignore
vendored
@ -1 +1,14 @@
|
||||
SOURCES/qemu-v9.1.0.tar.bz2
|
||||
/VSSSDK72.tar.gz
|
||||
/qemu-6.2.0.tar.bz2
|
||||
/qemu-7.0.0.tar.bz2
|
||||
/qemu-7.0.0
|
||||
/qemu-7.1.0.tar.bz2
|
||||
/qemu-7.1.0
|
||||
/qemu-8.0.0.tar.bz2
|
||||
/qemu-8.2.0
|
||||
/qemu-8.2.0.tar.bz2
|
||||
/qemu-9.0.0.tar.bz2
|
||||
/qemu-v9.1.0.tar.bz2
|
||||
/qemu-v10.0.0.tar.bz2
|
||||
/qemu-v10.1.0.tar.bz2
|
||||
/qemu-v10.2.0.tar.bz2
|
||||
@ -1 +0,0 @@
|
||||
a04987eab73dc2e5699e12bd9c6bb04a5a6e87b8 SOURCES/qemu-v9.1.0.tar.bz2
|
||||
@ -13,7 +13,7 @@ index 91ff57278e..586de296f5 100644
|
||||
--- a/VERSION
|
||||
+++ b/VERSION
|
||||
@@ -1 +1 @@
|
||||
-9.1.0
|
||||
+109.1.0
|
||||
-10.2.0
|
||||
+110.2.2
|
||||
--
|
||||
2.17.2
|
||||
43
0002-qga-win-Add-additional-VSS-logs.patch
Normal file
43
0002-qga-win-Add-additional-VSS-logs.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 1f65ab21e36089f38cf60c0236f7cc608c3cb7c8 Mon Sep 17 00:00:00 2001
|
||||
From: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
Date: Fri, 18 Jul 2025 10:14:35 +0300
|
||||
Subject: [PATCH 2/2] qga-win: Add additional VSS logs
|
||||
|
||||
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
---
|
||||
qga/vss-win32/requester.cpp | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
|
||||
index 4401d55e3a..f853b137a6 100644
|
||||
--- a/qga/vss-win32/requester.cpp
|
||||
+++ b/qga/vss-win32/requester.cpp
|
||||
@@ -415,6 +415,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
mbstowcs_s(&converted, volume_name_wchar, len,
|
||||
list->value, _TRUNCATE);
|
||||
|
||||
+ qga_debug("adding %S to snapshot set", volume_name_wchar);
|
||||
hr = vss_ctx.pVssbc->AddToSnapshotSet(volume_name_wchar,
|
||||
g_gProviderId, &pid);
|
||||
if (FAILED(hr)) {
|
||||
@@ -444,6 +445,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
for (;;) {
|
||||
if (GetDriveTypeW(short_volume_name) == DRIVE_FIXED) {
|
||||
VSS_ID pid;
|
||||
+ qga_debug("adding %S to snapshot set", short_volume_name);
|
||||
hr = vss_ctx.pVssbc->AddToSnapshotSet(short_volume_name,
|
||||
g_gProviderId, &pid);
|
||||
if (FAILED(hr)) {
|
||||
@@ -454,8 +456,8 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
*volume_path_name) {
|
||||
display_name = volume_path_name;
|
||||
}
|
||||
- err_set(errset, hr, "failed to add %S to snapshot set",
|
||||
- display_name);
|
||||
+ err_set(errset, hr, "failed to add %S (display name: %S) to snapshot set",
|
||||
+ short_volume_name, display_name);
|
||||
FindVolumeClose(volume);
|
||||
goto out;
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
5
gating.yaml
Normal file
5
gating.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules: []
|
||||
@ -1,13 +1,13 @@
|
||||
%{?mingw_package_header}
|
||||
|
||||
%define with_vss 1
|
||||
%define qemu_version 9.1.0
|
||||
%define qemu_version 10.2.0
|
||||
%define ga_manufacturer "RedHat"
|
||||
%define ga_distro "RHEL"
|
||||
|
||||
Name: mingw-qemu-ga-win
|
||||
Version: 109.1.0
|
||||
Release: 2%{?dist}
|
||||
Version: 110.2.3
|
||||
Release: 1%{?dist}
|
||||
Summary: Qemus Guest agent for Windows
|
||||
|
||||
Group: System Environment/Daemons
|
||||
@ -19,9 +19,11 @@ Requires(postun): systemd-units
|
||||
Source0: https://gitlab.com/qemu-project/qemu/-/archive/v%{qemu_version}/qemu-v%{qemu_version}.tar.bz2
|
||||
|
||||
Patch0001: 0001-Change-Version.patch
|
||||
Patch0002: 0002-qga-win-Add-additional-VSS-logs.patch
|
||||
Patch0003: v2_20260218_kkostiuk_qga_misc_fixes_and_improvements_2026_02_16.mbx
|
||||
|
||||
BuildArch: noarch
|
||||
# RHEL-57746 - mingw-qemu-ga-win failed to build on s390x
|
||||
# RHEL-57753 - mingw-qemu-ga-win failed to build on s390x
|
||||
ExclusiveArch: x86_64
|
||||
|
||||
Provides: bundled(mingw-gcc)
|
||||
@ -37,17 +39,14 @@ BuildRequires: libtool
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python-tomli
|
||||
BuildRequires: gettext
|
||||
BuildRequires: gettext-devel
|
||||
BuildRequires: mingw32-pixman >= 0.42.2
|
||||
BuildRequires: mingw64-pixman >= 0.42.2
|
||||
BuildRequires: mingw32-gcc >= 7.4.0
|
||||
BuildRequires: mingw32-gcc-c++ >= 7.4.0
|
||||
BuildRequires: mingw64-gcc >= 7.4.0
|
||||
BuildRequires: mingw64-gcc-c++ >= 7.4.0
|
||||
BuildRequires: mingw32-glib2 >= 2.78.0
|
||||
BuildRequires: mingw64-glib2 >= 2.78.0
|
||||
BuildRequires: mingw32-glib2 >= 2.89.2
|
||||
BuildRequires: mingw64-glib2 >= 2.89.2
|
||||
BuildRequires: mingw64-headers >= 10.0.0
|
||||
BuildRequires: mingw32-headers >= 10.0.0
|
||||
BuildRequires: mingw-w64-tools >= 10.0.0
|
||||
@ -68,7 +67,9 @@ This package does not need to be installed on the host OS.
|
||||
|
||||
%prep
|
||||
%setup -q -n qemu-v%{qemu_version}
|
||||
%patch0001 -p1
|
||||
%patch -P 0001 -p1
|
||||
%patch -P 0002 -p1
|
||||
%patch -P 0003 -p1
|
||||
|
||||
%build
|
||||
|
||||
@ -125,16 +126,70 @@ cp build/qga/qemu-ga-x86_64.msi $RPM_BUILD_ROOT%{mingw64_bindir}
|
||||
%{mingw64_bindir}/qemu-ga*
|
||||
|
||||
%changelog
|
||||
* Fri Sep 6 2024 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0-2
|
||||
- RHEL-57746 - mingw-qemu-ga-win failed to build on s390x
|
||||
* Web Jul 29 2026 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.2.3-1
|
||||
- RHEL-219215 - Rebuild mingw-qemu-ga-win for RHEL10.3 with Glib2 2.89.2
|
||||
|
||||
* Web Mar 25 2026 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.2.2-1
|
||||
- RHEL-151674 - command ‘guest-ssh-get-authorized-keys‘ failed since failed
|
||||
|
||||
* Fri Feb 20 2026 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.2.1-1
|
||||
- RHEL-148234 Move CoInitialize/CoInitializeSecurity to main process thread
|
||||
- RHEL-56925 Implement guest-network-get-route for Windows
|
||||
|
||||
* Wed Jan 21 2026 Elizabeth Ashurov <eashurov@redhat.com> 110.2.0-1
|
||||
- RHEL-141691 Rebase mingw-qemu-ga-win to QEMU 10.2.0
|
||||
|
||||
* Thu Sep 4 2025 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.1.0-1
|
||||
- RHEL-111001 Rebase mingw-qemu-ga-win to QEMU 10.1.0
|
||||
- RHEL-107458 [mingw-qemu-ga-win] QAPI error desc does not contain Windows error
|
||||
- RHEL-107446 QGA VSS wasn't removed if the QGA installation fail and quit
|
||||
- RHEL-107215 Fix don't daemonize before channel is initialized patch for Windows behavior
|
||||
|
||||
* Mon Aug 4 2025 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.0.2-1
|
||||
- RHEL-107174 QGA can't be installed before vioserial driver or without serial port configured
|
||||
|
||||
* Thu Jul 17 2025 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.0.1-1
|
||||
- RHEL-104252 QAPI error desc does not contain Windows error
|
||||
|
||||
* Fri Jun 20 2025 Kostiantyn Kostiuk <kkostiuk@redhat.com> 110.0.0-1
|
||||
- RHEL-83547 - Rebase mingw-qemu-ga-win to QEMU 10.0.0
|
||||
- RHEL-96980 - mingw-qga: Drop mingw-pixman build deps
|
||||
- RHEL-98947 - [mingw-qemu-ga-win] MSI installer ignore VSS installation result
|
||||
- RHEL-11824 - [QGA] VSS installation retry, if previously VSS service was not un-registered correctly
|
||||
|
||||
* Mon Mar 17 2025 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0-8
|
||||
- RHEL-71884 - [qemu-guest-agent][RFE] Report CPU load average for Windows VMs
|
||||
|
||||
* Mon Jan 20 2025 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0-7
|
||||
- RHEL-74469 - Rebuild mingw-qemu-ga-win package due to deps update
|
||||
|
||||
* Tue Jan 7 2025 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0-6
|
||||
- Fix version release
|
||||
- RHEL-70468 - win server 2k25 guest agent shows wrong output os version
|
||||
|
||||
* Thu Dec 12 2024 Dehan Meng <demeng@redhat.com> 109.1.0-5
|
||||
- RHEL-70468 - win server 2k25 guest agent shows wrong output os version
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 109.1.0-4
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
* Wed Sep 11 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0-3
|
||||
- RHEL-57753 - mingw-qemu-ga-win failed to build on s390x
|
||||
- Rebuild
|
||||
|
||||
* Fri Sep 6 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0-2
|
||||
- RHEL-57753 - mingw-qemu-ga-win failed to build on s390x
|
||||
|
||||
* Wed Sep 4 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 109.1.0
|
||||
- RHEL-57013 - Rebase qemu-ga to 9.1.0
|
||||
- RHEL-57012 - guest agent public ssh injection api support for Windows
|
||||
- RHEL-57014 - Rebase qemu-ga to 9.1.0
|
||||
- RHEL-32297 - guest agent public ssh injection api support for Windows
|
||||
- RHEL-36718 - The version of mingw-qemu-ga-win doesn't match inside query and via command 'guest-info'
|
||||
- Set version to 109.1.0
|
||||
|
||||
* Mon Jul 1 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 108.0.2
|
||||
- RHEL-45598 - Set version to 108.0.2
|
||||
* Tue May 7 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 108.0.2
|
||||
- Set version to 108.0.2
|
||||
- RHEL-35692 - Update gating.yaml for RHEL 10
|
||||
|
||||
* Tue Apr 30 2024 Konstantin Kostiuk <kkostiuk@redhat.com> 108.0.1
|
||||
- Set version to 108.0.1
|
||||
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (qemu-v10.2.0.tar.bz2) = 47f16a62925337faef396cbb5f49d4413063dfe51951fa087aacd87df8de3f72fa87d751d8ea50d298c48cccfa06a9dde863b49f19cb0499ecd87af22b533f19
|
||||
@ -0,0 +1,480 @@
|
||||
From git@z Thu Jan 1 00:00:00 1970
|
||||
Subject: [PATCH v2 1/3] qga: implement guest-network-get-route for Windows
|
||||
From: Elizabeth Ashurov <eashurov@redhat.com>
|
||||
Date: Wed, 18 Feb 2026 12:17:27 +0200
|
||||
Message-Id: <20260218101729.92630-2-kkostiuk@redhat.com>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Add Windows implementation of guest-network-get-route command to provide
|
||||
network routing information on Windows guests.
|
||||
|
||||
Features implemented:
|
||||
- IPv4 and IPv6 route information retrieval using GetIpForwardTable2
|
||||
- Human-readable interface names via GetAdaptersAddresses
|
||||
- Proper route metrics combining route and interface metrics
|
||||
- MTU information for network interfaces
|
||||
- Support for destination, gateway, mask, and metric fields for IPv4
|
||||
- Support for destination, nexthop, and desprefixlen fields for IPv6
|
||||
|
||||
Implementation uses modern Windows IP Helper API (GetIpForwardTable2,
|
||||
GetIfEntry2).
|
||||
|
||||
Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
|
||||
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
Link: https://lore.kernel.org/qemu-devel/20251222144031.3115317-1-eashurov@redhat.com
|
||||
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
---
|
||||
qga/commands-win32.c | 172 +++++++++++++++++++++++++++++++++++++++++++
|
||||
qga/qapi-schema.json | 11 +--
|
||||
2 files changed, 178 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
|
||||
index 0fd0c966e4..c0bf3467bd 100644
|
||||
--- a/qga/commands-win32.c
|
||||
+++ b/qga/commands-win32.c
|
||||
@@ -2592,3 +2592,175 @@ GuestLoadAverage *qmp_guest_get_load(Error **errp)
|
||||
ret->load15m = load_avg_15m;
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+/* Helper function to get interface name with fallbacks */
|
||||
+static char *get_interface_name(const MIB_IPFORWARD_ROW2 *row,
|
||||
+ IP_ADAPTER_ADDRESSES *adptr_addrs)
|
||||
+{
|
||||
+ IP_ADAPTER_ADDRESSES *adapter;
|
||||
+ char *iface_name = NULL;
|
||||
+
|
||||
+ if (adptr_addrs) {
|
||||
+ for (adapter = adptr_addrs; adapter; adapter = adapter->Next) {
|
||||
+ if (adapter->Luid.Value == row->InterfaceLuid.Value) {
|
||||
+ iface_name = guest_wctomb_dup(adapter->FriendlyName);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!iface_name) {
|
||||
+ iface_name = g_strdup_printf("if%lu", row->InterfaceIndex);
|
||||
+ }
|
||||
+
|
||||
+ return iface_name;
|
||||
+}
|
||||
+
|
||||
+/* Helper function to fill IPv4 route information */
|
||||
+static void fill_ipv4_route_info(GuestNetworkRoute *route,
|
||||
+ const MIB_IPFORWARD_ROW2 *row)
|
||||
+{
|
||||
+ struct sockaddr_in *addr_in;
|
||||
+ char addr_str[INET_ADDRSTRLEN];
|
||||
+
|
||||
+ addr_in = (struct sockaddr_in *)&row->DestinationPrefix.Prefix;
|
||||
+ if (inet_ntop(AF_INET, &addr_in->sin_addr, addr_str, INET_ADDRSTRLEN)) {
|
||||
+ route->destination = g_strdup(addr_str);
|
||||
+ } else {
|
||||
+ route->destination = g_strdup("0.0.0.0");
|
||||
+ }
|
||||
+
|
||||
+ if (row->DestinationPrefix.PrefixLength == 0) {
|
||||
+ route->mask = g_strdup("0.0.0.0");
|
||||
+ } else {
|
||||
+ uint32_t mask = htonl(0xFFFFFFFF << (32 -
|
||||
+ row->DestinationPrefix.PrefixLength));
|
||||
+ struct in_addr mask_addr = { .s_addr = mask };
|
||||
+ route->mask = g_strdup(inet_ntoa(mask_addr));
|
||||
+ }
|
||||
+
|
||||
+ addr_in = (struct sockaddr_in *)&row->NextHop;
|
||||
+ if (inet_ntop(AF_INET, &addr_in->sin_addr, addr_str, INET_ADDRSTRLEN)) {
|
||||
+ route->gateway = g_strdup(addr_str);
|
||||
+ } else {
|
||||
+ route->gateway = g_strdup("0.0.0.0");
|
||||
+ }
|
||||
+
|
||||
+ route->version = 4;
|
||||
+}
|
||||
+
|
||||
+/* Helper function to fill IPv6 route information */
|
||||
+static void fill_ipv6_route_info(GuestNetworkRoute *route,
|
||||
+ const MIB_IPFORWARD_ROW2 *row)
|
||||
+{
|
||||
+ struct sockaddr_in6 *addr_in6;
|
||||
+ char addr_str[INET6_ADDRSTRLEN];
|
||||
+
|
||||
+ addr_in6 = (struct sockaddr_in6 *)&row->DestinationPrefix.Prefix;
|
||||
+ if (inet_ntop(AF_INET6, &addr_in6->sin6_addr, addr_str, INET6_ADDRSTRLEN)) {
|
||||
+ route->destination = g_strdup(addr_str);
|
||||
+ } else {
|
||||
+ route->destination = g_strdup("::");
|
||||
+ }
|
||||
+
|
||||
+ addr_in6 = (struct sockaddr_in6 *)&row->NextHop;
|
||||
+ if (inet_ntop(AF_INET6, &addr_in6->sin6_addr, addr_str, INET6_ADDRSTRLEN)) {
|
||||
+ route->nexthop = g_strdup(addr_str);
|
||||
+ } else {
|
||||
+ route->nexthop = g_strdup("::");
|
||||
+ }
|
||||
+
|
||||
+ route->desprefixlen = g_strdup_printf("%u",
|
||||
+ row->DestinationPrefix.PrefixLength);
|
||||
+ route->version = 6;
|
||||
+}
|
||||
+
|
||||
+GuestNetworkRouteList *qmp_guest_network_get_route(Error **errp)
|
||||
+{
|
||||
+ GuestNetworkRouteList *head = NULL, **tail = &head;
|
||||
+ PMIB_IPFORWARD_TABLE2 pIpForwardTable2;
|
||||
+ DWORD dwRetVal = 0;
|
||||
+ DWORD i;
|
||||
+ PMIB_IPFORWARD_ROW2 row;
|
||||
+ GuestNetworkRoute *route;
|
||||
+ IP_ADAPTER_ADDRESSES *adptr_addrs;
|
||||
+ MIB_IPINTERFACE_ROW ipifrow;
|
||||
+ MIB_IF_ROW2 ifrow2;
|
||||
+ Error *local_err = NULL;
|
||||
+ GHashTable *interface_metric_cache;
|
||||
+
|
||||
+ dwRetVal = GetIpForwardTable2(AF_UNSPEC, &pIpForwardTable2);
|
||||
+ if (dwRetVal != NO_ERROR) {
|
||||
+ error_setg_win32(errp, dwRetVal, "failed to get IP routes");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ interface_metric_cache = g_hash_table_new_full(g_str_hash, g_str_equal,
|
||||
+ g_free, NULL);
|
||||
+ adptr_addrs = guest_get_adapters_addresses(&local_err);
|
||||
+ if (local_err) {
|
||||
+ error_free(local_err);
|
||||
+ adptr_addrs = NULL;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < pIpForwardTable2->NumEntries; i++) {
|
||||
+ row = &pIpForwardTable2->Table[i];
|
||||
+
|
||||
+ if (row->DestinationPrefix.Prefix.si_family == AF_INET) {
|
||||
+ route = g_new0(GuestNetworkRoute, 1);
|
||||
+ fill_ipv4_route_info(route, row);
|
||||
+ } else if (row->DestinationPrefix.Prefix.si_family == AF_INET6) {
|
||||
+ route = g_new0(GuestNetworkRoute, 1);
|
||||
+ fill_ipv6_route_info(route, row);
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ route->iface = get_interface_name(row, adptr_addrs);
|
||||
+
|
||||
+ /*
|
||||
+ * Get interface metric for combined route metric calculation.
|
||||
+ * Windows calculates effective route metric as route + interface metric.
|
||||
+ * This matches the values displayed by Windows 'route print' command.
|
||||
+ * See:
|
||||
+ * https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_row2
|
||||
+ */
|
||||
+ gchar *luid_key = g_strdup_printf("%" G_GUINT64_FORMAT,
|
||||
+ row->InterfaceLuid.Value);
|
||||
+ gpointer cached_metric = g_hash_table_lookup(interface_metric_cache,
|
||||
+ luid_key);
|
||||
+
|
||||
+ if (cached_metric) {
|
||||
+ route->metric = (int)row->Metric + GPOINTER_TO_INT(cached_metric);
|
||||
+ g_free(luid_key);
|
||||
+ } else {
|
||||
+ memset(&ipifrow, 0, sizeof(ipifrow));
|
||||
+ InitializeIpInterfaceEntry(&ipifrow);
|
||||
+ ipifrow.InterfaceLuid = row->InterfaceLuid;
|
||||
+ ipifrow.Family = row->DestinationPrefix.Prefix.si_family;
|
||||
+ if (GetIpInterfaceEntry(&ipifrow) == NO_ERROR) {
|
||||
+ g_hash_table_insert(interface_metric_cache, luid_key,
|
||||
+ GINT_TO_POINTER(ipifrow.Metric));
|
||||
+ route->metric = (int)row->Metric + (int)ipifrow.Metric;
|
||||
+ } else {
|
||||
+ route->metric = (int)row->Metric;
|
||||
+ g_free(luid_key);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ memset(&ifrow2, 0, sizeof(ifrow2));
|
||||
+ ifrow2.InterfaceLuid = row->InterfaceLuid;
|
||||
+ if (GetIfEntry2(&ifrow2) == NO_ERROR) {
|
||||
+ route->has_mtu = true;
|
||||
+ route->mtu = (int)ifrow2.Mtu;
|
||||
+ }
|
||||
+
|
||||
+ QAPI_LIST_APPEND(tail, route);
|
||||
+ route = NULL;
|
||||
+ }
|
||||
+
|
||||
+ FreeMibTable(pIpForwardTable2);
|
||||
+ g_free(adptr_addrs);
|
||||
+ g_hash_table_destroy(interface_metric_cache);
|
||||
+ return head;
|
||||
+}
|
||||
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
|
||||
index 5791b49dde..c57bc9a02f 100644
|
||||
--- a/qga/qapi-schema.json
|
||||
+++ b/qga/qapi-schema.json
|
||||
@@ -1879,7 +1879,8 @@
|
||||
##
|
||||
# @GuestNetworkRoute:
|
||||
#
|
||||
-# Route information, currently, only linux supported.
|
||||
+# Route information. Supported on Linux (since 9.1) and Windows
|
||||
+# (since 11.0).
|
||||
#
|
||||
# @iface: The destination network or host's egress network interface
|
||||
# in the routing table
|
||||
@@ -1916,7 +1917,7 @@
|
||||
#
|
||||
# @version: IP version (4 or 6)
|
||||
#
|
||||
-# Since: 9.1
|
||||
+# Since: 9.1 (Linux only); 11.0 (Windows)
|
||||
##
|
||||
{ 'struct': 'GuestNetworkRoute',
|
||||
'data': {'iface': 'str',
|
||||
@@ -1936,7 +1937,7 @@
|
||||
'*nexthop': 'str',
|
||||
'version': 'int'
|
||||
},
|
||||
- 'if': 'CONFIG_LINUX' }
|
||||
+ 'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32'] } }
|
||||
|
||||
##
|
||||
# @guest-network-get-route:
|
||||
@@ -1945,9 +1946,9 @@
|
||||
#
|
||||
# Returns: List of route info of guest.
|
||||
#
|
||||
-# Since: 9.1
|
||||
+# Since: 9.1 (Linux only); 11.0 (Windows)
|
||||
##
|
||||
{ 'command': 'guest-network-get-route',
|
||||
'returns': ['GuestNetworkRoute'],
|
||||
- 'if': 'CONFIG_LINUX'
|
||||
+ 'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32'] }
|
||||
}
|
||||
--
|
||||
2.52.0
|
||||
|
||||
From git@z Thu Jan 1 00:00:00 1970
|
||||
Subject: [PATCH v2 2/3] qga: Move CoInitialize/CoInitializeSecurity to main
|
||||
process thread
|
||||
From: Elizabeth Ashurov <eashurov@redhat.com>
|
||||
Date: Wed, 18 Feb 2026 12:17:28 +0200
|
||||
Message-Id: <20260218101729.92630-3-kkostiuk@redhat.com>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
Problem:
|
||||
Two issues with COM initialization:
|
||||
|
||||
Issue #1: Incorrect call order
|
||||
- requester_init() called CoInitializeSecurity first
|
||||
- Per Microsoft documentation, CoInitialize() must be called BEFORE
|
||||
CoInitializeSecurity()
|
||||
|
||||
Issue #2: Incorrect call location
|
||||
- CoInitializeSecurity was called from dll instead of the main process
|
||||
- Per Microsoft documentation, CoInitializeSecurity() must be called exactly once per process from
|
||||
the main executable, not from a DLL
|
||||
|
||||
Reference:
|
||||
https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-coinitializesecurity
|
||||
https://learn.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize
|
||||
|
||||
This caused incorrect COM initialization, preventing VSS Writers from
|
||||
calling back via IVssWriterCallback (hr = 0x80070005, Access denied,
|
||||
Event ID 8194).
|
||||
|
||||
Fix:
|
||||
- Initialize COM in main.c for both service and CLI modes
|
||||
- Call CoInitialize() followed by CoInitializeSecurity() in correct order
|
||||
in the main thread before any VSS operations
|
||||
- Add proper CoUninitialize() cleanup
|
||||
|
||||
Result:
|
||||
VSS Writers can now successfully call back to the agent. Event ID 8194
|
||||
error is resolved.
|
||||
|
||||
Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
|
||||
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
Tested-by: Dehan Meng <demeng@redhat.com>
|
||||
Link: https://lore.kernel.org/qemu-devel/20260211101744.757548-1-eashurov@redhat.com
|
||||
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
---
|
||||
qga/main.c | 42 +++++++++++++++++++++++++++++++++++++
|
||||
qga/vss-win32/requester.cpp | 13 ------------
|
||||
2 files changed, 42 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/qga/main.c b/qga/main.c
|
||||
index dd1c216f9a..fd19c7037d 100644
|
||||
--- a/qga/main.c
|
||||
+++ b/qga/main.c
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "qemu/systemd.h"
|
||||
#include "qemu-version.h"
|
||||
#ifdef _WIN32
|
||||
+#include <windows.h>
|
||||
+#include <objbase.h>
|
||||
#include <dbt.h>
|
||||
#include <pdh.h>
|
||||
#include "qga/service-win32.h"
|
||||
@@ -830,6 +832,29 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD type, LPVOID data,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/* Initialize COM for VSS operations */
|
||||
+static HRESULT init_com(void)
|
||||
+{
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ hr = CoInitialize(NULL);
|
||||
+ if (FAILED(hr)) {
|
||||
+ return hr;
|
||||
+ }
|
||||
+
|
||||
+ hr = CoInitializeSecurity(
|
||||
+ NULL, -1, NULL, NULL,
|
||||
+ RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
|
||||
+ RPC_C_IMP_LEVEL_IDENTIFY,
|
||||
+ NULL, EOAC_NONE, NULL);
|
||||
+ if (FAILED(hr)) {
|
||||
+ CoUninitialize();
|
||||
+ return hr;
|
||||
+ }
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
VOID WINAPI service_main(DWORD argc, TCHAR *argv[])
|
||||
{
|
||||
GAService *service = &ga_state->service;
|
||||
@@ -842,6 +867,13 @@ VOID WINAPI service_main(DWORD argc, TCHAR *argv[])
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* Initialize COM for VSS operations in the service thread */
|
||||
+ HRESULT hr_com = init_com();
|
||||
+ if (FAILED(hr_com)) {
|
||||
+ g_critical("Failed to initialize COM in service thread: 0x%lx", hr_com);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
service->status.dwServiceType = SERVICE_WIN32;
|
||||
service->status.dwCurrentState = SERVICE_RUNNING;
|
||||
service->status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
|
||||
@@ -866,6 +898,8 @@ VOID WINAPI service_main(DWORD argc, TCHAR *argv[])
|
||||
|
||||
run_agent(ga_state);
|
||||
|
||||
+ CoUninitialize();
|
||||
+
|
||||
UnregisterDeviceNotification(service->device_notification_handle);
|
||||
service->status.dwCurrentState = SERVICE_STOPPED;
|
||||
SetServiceStatus(service->status_handle, &service->status);
|
||||
@@ -1719,7 +1753,15 @@ int main(int argc, char **argv)
|
||||
StartServiceCtrlDispatcher(service_table);
|
||||
ret = EXIT_SUCCESS;
|
||||
} else {
|
||||
+ HRESULT hr_com = init_com();
|
||||
+ if (FAILED(hr_com)) {
|
||||
+ g_critical("Failed to initialize COM: 0x%lx", hr_com);
|
||||
+ ret = EXIT_FAILURE;
|
||||
+ goto end;
|
||||
+ }
|
||||
+
|
||||
ret = run_agent(s);
|
||||
+ CoUninitialize();
|
||||
}
|
||||
#else
|
||||
ret = run_agent(s);
|
||||
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
|
||||
index 74489fcd0a..626d6ab1ff 100644
|
||||
--- a/qga/vss-win32/requester.cpp
|
||||
+++ b/qga/vss-win32/requester.cpp
|
||||
@@ -60,15 +60,6 @@ STDAPI requester_init(void)
|
||||
{
|
||||
qga_debug_begin;
|
||||
|
||||
- COMInitializer initializer; /* to call CoInitializeSecurity */
|
||||
- HRESULT hr = CoInitializeSecurity(
|
||||
- NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
|
||||
- RPC_C_IMP_LEVEL_IDENTIFY, NULL, EOAC_NONE, NULL);
|
||||
- if (FAILED(hr)) {
|
||||
- qga_debug("failed to CoInitializeSecurity (error %lx)", hr);
|
||||
- return hr;
|
||||
- }
|
||||
-
|
||||
hLib = LoadLibraryA("VSSAPI.DLL");
|
||||
if (!hLib) {
|
||||
qga_debug("failed to load VSSAPI.DLL");
|
||||
@@ -320,8 +311,6 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
return;
|
||||
}
|
||||
|
||||
- CoInitialize(NULL);
|
||||
-
|
||||
/* Allow unrestricted access to events */
|
||||
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
|
||||
SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE);
|
||||
@@ -562,7 +551,6 @@ out:
|
||||
|
||||
out1:
|
||||
requester_cleanup();
|
||||
- CoUninitialize();
|
||||
|
||||
qga_debug_end;
|
||||
}
|
||||
@@ -643,7 +631,6 @@ void requester_thaw(int *num_vols, void *mountpints, ErrorSet *errset)
|
||||
*num_vols = vss_ctx.cFrozenVols;
|
||||
requester_cleanup();
|
||||
|
||||
- CoUninitialize();
|
||||
StopService();
|
||||
|
||||
qga_debug_end;
|
||||
--
|
||||
2.52.0
|
||||
|
||||
From git@z Thu Jan 1 00:00:00 1970
|
||||
Subject: [PATCH v2 3/3] qga: Fix VSS provider GetSnapshotProperties return
|
||||
value
|
||||
From: Elizabeth Ashurov <eashurov@redhat.com>
|
||||
Date: Wed, 18 Feb 2026 12:17:29 +0200
|
||||
Message-Id: <20260218101729.92630-4-kkostiuk@redhat.com>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
GetSnapshotProperties() returned VSS_E_OBJECT_NOT_FOUND causing
|
||||
"Snapshot id not found" errors during VSS operations.
|
||||
|
||||
Any error in this function causes a similar error in Windows VSS,
|
||||
so we must return S_OK there.
|
||||
|
||||
Signed-off-by: Elizabeth Ashurov <eashurov@redhat.com>
|
||||
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
Link: https://lore.kernel.org/qemu-devel/20260211101744.757548-2-eashurov@redhat.com
|
||||
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
|
||||
---
|
||||
qga/vss-win32/provider.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp
|
||||
index a102a23fbf..2b5c6f8e8e 100644
|
||||
--- a/qga/vss-win32/provider.cpp
|
||||
+++ b/qga/vss-win32/provider.cpp
|
||||
@@ -263,7 +263,7 @@ STDMETHODIMP CQGAVssProvider::SetContext(LONG lContext)
|
||||
STDMETHODIMP CQGAVssProvider::GetSnapshotProperties(
|
||||
VSS_ID SnapshotId, VSS_SNAPSHOT_PROP *pProp)
|
||||
{
|
||||
- return VSS_E_OBJECT_NOT_FOUND;
|
||||
+ return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CQGAVssProvider::Query(
|
||||
--
|
||||
2.52.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user