From b68d8b677ebe1a50bf374ac18f4f80313d6a38f5 Mon Sep 17 00:00:00 2001 From: "Angel M. Villegas" Date: Fri, 13 Oct 2023 11:51:10 -0400 Subject: [PATCH 1/4] guest-agent: improve help for --allow-rpcs and --block-rpcs Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1757 Updates to qga help output and documentation for --allow-rpcs and --blocks-rpcs Signed-off-by: "Angel M. Villegas" Reviewed-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- docs/interop/qemu-ga.rst | 8 ++++---- qga/main.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst index 461c5a35ee..72fb75a6f5 100644 --- a/docs/interop/qemu-ga.rst +++ b/docs/interop/qemu-ga.rst @@ -81,13 +81,13 @@ Options .. option:: -b, --block-rpcs=LIST - Comma-separated list of RPCs to disable (no spaces, use ``help`` to - list available RPCs). + Comma-separated list of RPCs to disable (no spaces, use ``--block-rpcs=help`` + to list available RPCs). .. option:: -a, --allow-rpcs=LIST - Comma-separated list of RPCs to enable (no spaces, use ``help`` to - list available RPCs). + Comma-separated list of RPCs to enable (no spaces, use ``--allow-rpcs=help`` + to list available RPCs). .. option:: -D, --dump-conf diff --git a/qga/main.c b/qga/main.c index 8668b9f3d3..bdf5344584 100644 --- a/qga/main.c +++ b/qga/main.c @@ -261,9 +261,9 @@ QEMU_COPYRIGHT "\n" " -s, --service service commands: install, uninstall, vss-install, vss-uninstall\n" #endif " -b, --block-rpcs comma-separated list of RPCs to disable (no spaces,\n" -" use \"help\" to list available RPCs)\n" +" use \"--block-rpcs=help\" to list available RPCs)\n" " -a, --allow-rpcs comma-separated list of RPCs to enable (no spaces,\n" -" use \"help\" to list available RPCs)\n" +" use \"--allow-rpcs=help\" to list available RPCs)\n" " -D, --dump-conf dump a qemu-ga config file based on current config\n" " options / command-line parameters to stdout\n" " -r, --retry-path attempt re-opening path if it's unavailable or closed\n" From 8c72e19bfdf40ed8306769359c2b8902609672c7 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 3 Jan 2024 17:51:31 +0100 Subject: [PATCH 2/4] tests/unit/test-qga: do not qualify executable paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit guest-exec invocation does not need the full path of the executable to execute. Using only the command names ensures correct execution of the test on systems not adhering to the FHS. Signed-off-by: Samuel Tardieu Reviewed-by: Konstantin Kostiuk Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: "Daniel P. Berrangé" Signed-off-by: Konstantin Kostiuk --- tests/unit/test-qga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index 671e83cb86..8cddf5dc37 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -822,7 +822,7 @@ static void test_qga_guest_exec(gconstpointer fix) /* exec 'echo foo bar' */ ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {" - " 'path': '/bin/echo', 'arg': [ '-n', '\" test_str \"' ]," + " 'path': 'echo', 'arg': [ '-n', '\" test_str \"' ]," " 'capture-output': true } }"); g_assert_nonnull(ret); qmp_assert_no_error(ret); @@ -883,7 +883,7 @@ static void test_qga_guest_exec_separated(gconstpointer fix) /* exec 'echo foo bar' */ ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {" - " 'path': '/bin/bash'," + " 'path': 'bash'," " 'arg': [ '-c', 'for i in $(seq 4); do if (( $i %% 2 )); then echo stdout; else echo stderr 1>&2; fi; done;' ]," " 'capture-output': 'separated' } }"); g_assert_nonnull(ret); @@ -924,7 +924,7 @@ static void test_qga_guest_exec_merged(gconstpointer fix) /* exec 'echo foo bar' */ ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {" - " 'path': '/bin/bash'," + " 'path': 'bash'," " 'arg': [ '-c', 'for i in $(seq 4); do if (( $i %% 2 )); then echo stdout; else echo stderr 1>&2; fi; done;' ]," " 'capture-output': 'merged' } }"); g_assert_nonnull(ret); From 7c4486350a79532580a37d42abdeb1dc7e4fa6c9 Mon Sep 17 00:00:00 2001 From: Peng Ji Date: Wed, 27 Dec 2023 14:32:06 +0800 Subject: [PATCH 3/4] qga-win: Fix guest-get-fsinfo multi-disks collection When a volume has more than one disk, all disks cannot be returned correctly because there is not enough malloced memory for disk extents, so before executing DeviceIoControl for the second time, get the correct size of the required memory space to store all disk extents. Details: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-volume_disk_extents Signed-off-by: Peng Ji Reviewed-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/commands-win32.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 697c65507c..a1015757d8 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -935,6 +935,8 @@ static GuestDiskAddressList *build_guest_disk_info(char *guid, Error **errp) DWORD last_err = GetLastError(); if (last_err == ERROR_MORE_DATA) { /* Try once more with big enough buffer */ + size = sizeof(VOLUME_DISK_EXTENTS) + + (sizeof(DISK_EXTENT) * (extents->NumberOfDiskExtents - 1)); g_free(extents); extents = g_malloc0(size); if (!DeviceIoControl( From b3e0f64487a4b937d871ce4ce9c259e02ec02191 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 11 Jan 2024 14:43:22 -0500 Subject: [PATCH 4/4] qga: Solaris has net/if_arp.h and netinet/if_ether.h but not ETHER_ADDR_LEN Solaris has net/if_arp.h and netinet/if_ether.h rather than net/ethernet.h, but does not define ETHER_ADDR_LEN, instead providing ETHERADDRL. Signed-off-by: Nick Briggs Reviewed-by: Konstantin Kostiuk Signed-off-by: Konstantin Kostiuk --- qga/commands-posix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 6169bbf7a0..26008db497 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -45,9 +45,12 @@ #include #include #include -#if defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(CONFIG_SOLARIS) #include #include +#if !defined(ETHER_ADDR_LEN) && defined(ETHERADDRL) +#define ETHER_ADDR_LEN ETHERADDRL +#endif #else #include #endif