* [PULL 0/6] Misc QGA patches
@ 2023-05-04 9:56 Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 1/6] qga/linux: add usb support to guest-get-fsinfo Konstantin Kostiuk
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Kostiantyn Kostiuk <kostyanf14@live.com>
The following changes since commit 044f8cf70a2fdf3b9e4c4d849c66e7855d2c446a:
Merge tag 'migration-20230428-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-05-03 10:29:30 +0100)
are available in the Git repository at:
git@github.com:kostyanf14/qemu.git tags/qga-pull-2023-05-04
for you to fetch changes up to 86dcb6ab9b603450eb6d896cdc95286de2c7d561:
qga: Fix suspend on Linux guests without systemd (2023-05-04 09:30:01 +0000)
----------------------------------------------------------------
qga-pull-2023-05-04
----------------------------------------------------------------
Daniel Xu (3):
qga: Refactor guest-exec capture-output to take enum
qga: Add `merged` variant to GuestExecCaptureOutputMode
qga: test: Add tests for `merged` flag
Kfir Manor (1):
qga/linux: add usb support to guest-get-fsinfo
Mark Somerville (1):
qga: Fix suspend on Linux guests without systemd
Thomas Huth (1):
qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601
qga/commands-posix.c | 18 +++---
qga/commands-win32.c | 2 -
qga/commands.c | 62 ++++++++++++++++++--
qga/qapi-schema.json | 36 +++++++++++-
tests/unit/test-qga.c | 158 ++++++++++++++++++++++++++++++++++++++++++++------
5 files changed, 244 insertions(+), 32 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PULL 1/6] qga/linux: add usb support to guest-get-fsinfo
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
@ 2023-05-04 9:56 ` Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 2/6] qga: Refactor guest-exec capture-output to take enum Konstantin Kostiuk
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Kfir Manor <kfir@daynix.com>
Signed-off-by: Kfir Manor <kfir@daynix.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands-posix.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 079689d79a..97754930c1 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -879,7 +879,9 @@ static bool build_guest_fsinfo_for_pci_dev(char const *syspath,
g_str_equal(driver, "sym53c8xx") ||
g_str_equal(driver, "virtio-pci") ||
g_str_equal(driver, "ahci") ||
- g_str_equal(driver, "nvme"))) {
+ g_str_equal(driver, "nvme") ||
+ g_str_equal(driver, "xhci_hcd") ||
+ g_str_equal(driver, "ehci-pci"))) {
break;
}
@@ -976,6 +978,8 @@ static bool build_guest_fsinfo_for_pci_dev(char const *syspath,
}
} else if (strcmp(driver, "nvme") == 0) {
disk->bus_type = GUEST_DISK_BUS_TYPE_NVME;
+ } else if (strcmp(driver, "ehci-pci") == 0 || strcmp(driver, "xhci_hcd") == 0) {
+ disk->bus_type = GUEST_DISK_BUS_TYPE_USB;
} else {
g_debug("unknown driver '%s' (sysfs path '%s')", driver, syspath);
goto cleanup;
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PULL 2/6] qga: Refactor guest-exec capture-output to take enum
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 1/6] qga/linux: add usb support to guest-get-fsinfo Konstantin Kostiuk
@ 2023-05-04 9:56 ` Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 3/6] qga: Add `merged` variant to GuestExecCaptureOutputMode Konstantin Kostiuk
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Daniel Xu <dxu@dxuuu.xyz>
Previously capture-output was an optional boolean flag that either
captured all output or captured none. While this is OK in most cases, it
lacks flexibility for more advanced capture cases, such as wanting to
only capture stdout.
This commits refactors guest-exec qapi to take an enum for capture mode
instead while preserving backwards compatibility.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands.c | 37 ++++++++++++++++++++++++++++++++++---
qga/qapi-schema.json | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/qga/commands.c b/qga/commands.c
index 172826f8f8..01f68b45ab 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -379,11 +379,23 @@ close:
return false;
}
+static GuestExecCaptureOutputMode ga_parse_capture_output(
+ GuestExecCaptureOutput *capture_output)
+{
+ if (!capture_output)
+ return GUEST_EXEC_CAPTURE_OUTPUT_MODE_NONE;
+ else if (capture_output->type == QTYPE_QBOOL)
+ return capture_output->u.flag ? GUEST_EXEC_CAPTURE_OUTPUT_MODE_SEPARATED
+ : GUEST_EXEC_CAPTURE_OUTPUT_MODE_NONE;
+ else
+ return capture_output->u.mode;
+}
+
GuestExec *qmp_guest_exec(const char *path,
bool has_arg, strList *arg,
bool has_env, strList *env,
const char *input_data,
- bool has_capture_output, bool capture_output,
+ GuestExecCaptureOutput *capture_output,
Error **errp)
{
GPid pid;
@@ -396,7 +408,8 @@ GuestExec *qmp_guest_exec(const char *path,
gint in_fd, out_fd, err_fd;
GIOChannel *in_ch, *out_ch, *err_ch;
GSpawnFlags flags;
- bool has_output = (has_capture_output && capture_output);
+ bool has_output = false;
+ GuestExecCaptureOutputMode output_mode;
g_autofree uint8_t *input = NULL;
size_t ninput = 0;
@@ -415,8 +428,26 @@ GuestExec *qmp_guest_exec(const char *path,
flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD |
G_SPAWN_SEARCH_PATH_FROM_ENVP;
- if (!has_output) {
+
+ output_mode = ga_parse_capture_output(capture_output);
+ switch (output_mode) {
+ case GUEST_EXEC_CAPTURE_OUTPUT_MODE_NONE:
flags |= G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL;
+ break;
+ case GUEST_EXEC_CAPTURE_OUTPUT_MODE_STDOUT:
+ has_output = true;
+ flags |= G_SPAWN_STDERR_TO_DEV_NULL;
+ break;
+ case GUEST_EXEC_CAPTURE_OUTPUT_MODE_STDERR:
+ has_output = true;
+ flags |= G_SPAWN_STDOUT_TO_DEV_NULL;
+ break;
+ case GUEST_EXEC_CAPTURE_OUTPUT_MODE_SEPARATED:
+ has_output = true;
+ break;
+ case GUEST_EXEC_CAPTURE_OUTPUT_MODE__MAX:
+ /* Silence warning; impossible branch */
+ break;
}
ret = g_spawn_async_with_pipes(NULL, argv, envp, flags,
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index 6a20eeb297..44e44c2a5c 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -1200,6 +1200,37 @@
{ 'struct': 'GuestExec',
'data': { 'pid': 'int'} }
+##
+# @GuestExecCaptureOutputMode:
+#
+# An enumeration of guest-exec capture modes.
+#
+# @none: do not capture any output
+# @stdout: only capture stdout
+# @stderr: only capture stderr
+# @separated: capture both stdout and stderr, but separated into
+# GuestExecStatus out-data and err-data, respectively
+#
+# Since: 8.0
+##
+ { 'enum': 'GuestExecCaptureOutputMode',
+ 'data': [ 'none', 'stdout', 'stderr', 'separated' ] }
+
+##
+# @GuestExecCaptureOutput:
+#
+# Controls what guest-exec output gets captures.
+#
+# @flag: captures both stdout and stderr if true. Equivalent
+# to GuestExecCaptureOutputMode::all. (since 2.5)
+# @mode: capture mode; preferred interface
+#
+# Since: 8.0
+##
+ { 'alternate': 'GuestExecCaptureOutput',
+ 'data': { 'flag': 'bool',
+ 'mode': 'GuestExecCaptureOutputMode'} }
+
##
# @guest-exec:
#
@@ -1218,7 +1249,7 @@
##
{ 'command': 'guest-exec',
'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
- '*input-data': 'str', '*capture-output': 'bool' },
+ '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
'returns': 'GuestExec' }
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PULL 3/6] qga: Add `merged` variant to GuestExecCaptureOutputMode
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 1/6] qga/linux: add usb support to guest-get-fsinfo Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 2/6] qga: Refactor guest-exec capture-output to take enum Konstantin Kostiuk
@ 2023-05-04 9:56 ` Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 4/6] qga: test: Add tests for `merged` flag Konstantin Kostiuk
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Daniel Xu <dxu@dxuuu.xyz>
Currently, any captured output (via `capture-output`) is segregated into
separate GuestExecStatus fields (`out-data` and `err-data`). This means
that downstream consumers have no way to reassemble the captured data
back into the original stream.
This is relevant for chatty and semi-interactive (ie. read only) CLI
tools. Such tools may deliberately interleave stdout and stderr for
visual effect. If segregated, the output becomes harder to visually
understand.
This commit adds a new enum variant to the GuestExecCaptureOutputMode
qapi to merge the output streams such that consumers can have a pristine
view of the original command output.
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands.c | 25 +++++++++++++++++++++++--
qga/qapi-schema.json | 5 ++++-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/qga/commands.c b/qga/commands.c
index 01f68b45ab..09c683e263 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -270,12 +270,26 @@ static void guest_exec_child_watch(GPid pid, gint status, gpointer data)
g_spawn_close_pid(pid);
}
-/** Reset ignored signals back to default. */
static void guest_exec_task_setup(gpointer data)
{
#if !defined(G_OS_WIN32)
+ bool has_merge = *(bool *)data;
struct sigaction sigact;
+ if (has_merge) {
+ /*
+ * FIXME: When `GLIB_VERSION_MIN_REQUIRED` is bumped to 2.58+, use
+ * g_spawn_async_with_fds() to be portable on windows. The current
+ * logic does not work on windows b/c `GSpawnChildSetupFunc` is run
+ * inside the parent, not the child.
+ */
+ if (dup2(STDOUT_FILENO, STDERR_FILENO) != 0) {
+ slog("dup2() failed to merge stderr into stdout: %s",
+ strerror(errno));
+ }
+ }
+
+ /* Reset ignored signals back to default. */
memset(&sigact, 0, sizeof(struct sigaction));
sigact.sa_handler = SIG_DFL;
@@ -409,6 +423,7 @@ GuestExec *qmp_guest_exec(const char *path,
GIOChannel *in_ch, *out_ch, *err_ch;
GSpawnFlags flags;
bool has_output = false;
+ bool has_merge = false;
GuestExecCaptureOutputMode output_mode;
g_autofree uint8_t *input = NULL;
size_t ninput = 0;
@@ -445,13 +460,19 @@ GuestExec *qmp_guest_exec(const char *path,
case GUEST_EXEC_CAPTURE_OUTPUT_MODE_SEPARATED:
has_output = true;
break;
+#if !defined(G_OS_WIN32)
+ case GUEST_EXEC_CAPTURE_OUTPUT_MODE_MERGED:
+ has_output = true;
+ has_merge = true;
+ break;
+#endif
case GUEST_EXEC_CAPTURE_OUTPUT_MODE__MAX:
/* Silence warning; impossible branch */
break;
}
ret = g_spawn_async_with_pipes(NULL, argv, envp, flags,
- guest_exec_task_setup, NULL, &pid, input_data ? &in_fd : NULL,
+ guest_exec_task_setup, &has_merge, &pid, input_data ? &in_fd : NULL,
has_output ? &out_fd : NULL, has_output ? &err_fd : NULL, &gerr);
if (!ret) {
error_setg(errp, QERR_QGA_COMMAND_FAILED, gerr->message);
diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json
index 44e44c2a5c..5a75e81be2 100644
--- a/qga/qapi-schema.json
+++ b/qga/qapi-schema.json
@@ -1210,11 +1210,14 @@
# @stderr: only capture stderr
# @separated: capture both stdout and stderr, but separated into
# GuestExecStatus out-data and err-data, respectively
+# @merged: capture both stdout and stderr, but merge together
+# into out-data. not effective on windows guests.
#
# Since: 8.0
##
{ 'enum': 'GuestExecCaptureOutputMode',
- 'data': [ 'none', 'stdout', 'stderr', 'separated' ] }
+ 'data': [ 'none', 'stdout', 'stderr', 'separated',
+ { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
##
# @GuestExecCaptureOutput:
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PULL 4/6] qga: test: Add tests for `merged` flag
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
` (2 preceding siblings ...)
2023-05-04 9:56 ` [PULL 3/6] qga: Add `merged` variant to GuestExecCaptureOutputMode Konstantin Kostiuk
@ 2023-05-04 9:56 ` Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 5/6] qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601 Konstantin Kostiuk
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Daniel Xu <dxu@dxuuu.xyz>
This commit adds a test to ensure `merged` functions as expected.
We also add a negative test to ensure we haven't regressed previous
functionality.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
tests/unit/test-qga.c | 158 +++++++++++++++++++++++++++++++++++++-----
1 file changed, 141 insertions(+), 17 deletions(-)
diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index b4e0a14573..360b4cab23 100644
--- a/tests/unit/test-qga.c
+++ b/tests/unit/test-qga.c
@@ -755,6 +755,31 @@ static void test_qga_fsfreeze_status(gconstpointer fix)
g_assert_cmpstr(status, ==, "thawed");
}
+static QDict *wait_for_guest_exec_completion(int fd, int64_t pid)
+{
+ QDict *ret = NULL;
+ int64_t now;
+ bool exited;
+ QDict *val;
+
+ now = g_get_monotonic_time();
+ do {
+ ret = qmp_fd(fd,
+ "{'execute': 'guest-exec-status',"
+ " 'arguments': { 'pid': %" PRId64 " } }", pid);
+ g_assert_nonnull(ret);
+ val = qdict_get_qdict(ret, "return");
+ exited = qdict_get_bool(val, "exited");
+ if (!exited) {
+ qobject_unref(ret);
+ }
+ } while (!exited &&
+ g_get_monotonic_time() < now + 5 * G_TIME_SPAN_SECOND);
+ g_assert(exited);
+
+ return ret;
+}
+
static void test_qga_guest_exec(gconstpointer fix)
{
const TestFixture *fixture = fix;
@@ -762,9 +787,8 @@ static void test_qga_guest_exec(gconstpointer fix)
QDict *val;
const gchar *out;
g_autofree guchar *decoded = NULL;
- int64_t pid, now, exitcode;
+ int64_t pid, exitcode;
gsize len;
- bool exited;
/* exec 'echo foo bar' */
ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
@@ -777,23 +801,10 @@ static void test_qga_guest_exec(gconstpointer fix)
g_assert_cmpint(pid, >, 0);
qobject_unref(ret);
- /* wait for completion */
- now = g_get_monotonic_time();
- do {
- ret = qmp_fd(fixture->fd,
- "{'execute': 'guest-exec-status',"
- " 'arguments': { 'pid': %" PRId64 " } }", pid);
- g_assert_nonnull(ret);
- val = qdict_get_qdict(ret, "return");
- exited = qdict_get_bool(val, "exited");
- if (!exited) {
- qobject_unref(ret);
- }
- } while (!exited &&
- g_get_monotonic_time() < now + 5 * G_TIME_SPAN_SECOND);
- g_assert(exited);
+ ret = wait_for_guest_exec_completion(fixture->fd, pid);
/* check stdout */
+ val = qdict_get_qdict(ret, "return");
exitcode = qdict_get_int(val, "exitcode");
g_assert_cmpint(exitcode, ==, 0);
out = qdict_get_str(val, "out-data");
@@ -802,6 +813,115 @@ static void test_qga_guest_exec(gconstpointer fix)
g_assert_cmpstr((char *)decoded, ==, "\" test_str \"");
}
+#if defined(G_OS_WIN32)
+static void test_qga_guest_exec_separated(gconstpointer fix)
+{
+}
+static void test_qga_guest_exec_merged(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ g_autoptr(QDict) ret = NULL;
+ QDict *val;
+ const gchar *class, *desc;
+ g_autofree guchar *decoded = NULL;
+
+ /* exec 'echo foo bar' */
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
+ " 'path': 'echo',"
+ " 'arg': [ 'execution never reaches here' ],"
+ " 'capture-output': 'merged' } }");
+
+ g_assert_nonnull(ret);
+ val = qdict_get_qdict(ret, "error");
+ g_assert_nonnull(val);
+ class = qdict_get_str(val, "class");
+ desc = qdict_get_str(val, "desc");
+ g_assert_cmpstr(class, ==, "GenericError");
+ g_assert_cmpint(strlen(desc), >, 0);
+}
+#else
+static void test_qga_guest_exec_separated(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ g_autoptr(QDict) ret = NULL;
+ QDict *val;
+ const gchar *out, *err;
+ g_autofree guchar *out_decoded = NULL;
+ g_autofree guchar *err_decoded = NULL;
+ int64_t pid, exitcode;
+ gsize len;
+
+ /* exec 'echo foo bar' */
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
+ " 'path': '/bin/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);
+ qmp_assert_no_error(ret);
+ val = qdict_get_qdict(ret, "return");
+ pid = qdict_get_int(val, "pid");
+ g_assert_cmpint(pid, >, 0);
+ qobject_unref(ret);
+
+ ret = wait_for_guest_exec_completion(fixture->fd, pid);
+
+ val = qdict_get_qdict(ret, "return");
+ exitcode = qdict_get_int(val, "exitcode");
+ g_assert_cmpint(exitcode, ==, 0);
+
+ /* check stdout */
+ out = qdict_get_str(val, "out-data");
+ out_decoded = g_base64_decode(out, &len);
+ g_assert_cmpint(len, ==, 14);
+ g_assert_cmpstr((char *)out_decoded, ==, "stdout\nstdout\n");
+
+ /* check stderr */
+ err = qdict_get_try_str(val, "err-data");
+ err_decoded = g_base64_decode(err, &len);
+ g_assert_cmpint(len, ==, 14);
+ g_assert_cmpstr((char *)err_decoded, ==, "stderr\nstderr\n");
+}
+
+static void test_qga_guest_exec_merged(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ g_autoptr(QDict) ret = NULL;
+ QDict *val;
+ const gchar *out, *err;
+ g_autofree guchar *decoded = NULL;
+ int64_t pid, exitcode;
+ gsize len;
+
+ /* exec 'echo foo bar' */
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-exec', 'arguments': {"
+ " 'path': '/bin/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);
+ qmp_assert_no_error(ret);
+ val = qdict_get_qdict(ret, "return");
+ pid = qdict_get_int(val, "pid");
+ g_assert_cmpint(pid, >, 0);
+ qobject_unref(ret);
+
+ ret = wait_for_guest_exec_completion(fixture->fd, pid);
+
+ val = qdict_get_qdict(ret, "return");
+ exitcode = qdict_get_int(val, "exitcode");
+ g_assert_cmpint(exitcode, ==, 0);
+
+ /* check stdout */
+ out = qdict_get_str(val, "out-data");
+ decoded = g_base64_decode(out, &len);
+ g_assert_cmpint(len, ==, 28);
+ g_assert_cmpstr((char *)decoded, ==, "stdout\nstderr\nstdout\nstderr\n");
+
+ /* check stderr */
+ err = qdict_get_try_str(val, "err-data");
+ g_assert_null(err);
+}
+#endif
+
static void test_qga_guest_exec_invalid(gconstpointer fix)
{
const TestFixture *fixture = fix;
@@ -972,6 +1092,10 @@ int main(int argc, char **argv)
g_test_add_data_func("/qga/blockedrpcs", NULL, test_qga_blockedrpcs);
g_test_add_data_func("/qga/config", NULL, test_qga_config);
g_test_add_data_func("/qga/guest-exec", &fix, test_qga_guest_exec);
+ g_test_add_data_func("/qga/guest-exec-separated", &fix,
+ test_qga_guest_exec_separated);
+ g_test_add_data_func("/qga/guest-exec-merged", &fix,
+ test_qga_guest_exec_merged);
g_test_add_data_func("/qga/guest-exec-invalid", &fix,
test_qga_guest_exec_invalid);
g_test_add_data_func("/qga/guest-get-osinfo", &fix,
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PULL 5/6] qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
` (3 preceding siblings ...)
2023-05-04 9:56 ` [PULL 4/6] qga: test: Add tests for `merged` flag Konstantin Kostiuk
@ 2023-05-04 9:56 ` Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 6/6] qga: Fix suspend on Linux guests without systemd Konstantin Kostiuk
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Thomas Huth <thuth@redhat.com>
All current versions of glib require _WIN32_WINNT set to 0x0601
or higher already, and we also use this value as a minimum in our
osdep.h header file, so there is no way to still compile this code
with an older version of the Windows ABI. Thus we can drop this
check now.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands-win32.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index b5fee6a2cd..d23875264f 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -484,7 +484,6 @@ static GuestDiskBusType win2qemu[] = {
[BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA,
[BusTypeSd] = GUEST_DISK_BUS_TYPE_SD,
[BusTypeMmc] = GUEST_DISK_BUS_TYPE_MMC,
-#if (_WIN32_WINNT >= 0x0601)
[BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL,
[BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL,
/*
@@ -492,7 +491,6 @@ static GuestDiskBusType win2qemu[] = {
*/
[BusTypeSpaces] = GUEST_DISK_BUS_TYPE_UNKNOWN,
[BusTypeNvme] = GUEST_DISK_BUS_TYPE_NVME,
-#endif
};
static GuestDiskBusType find_bus_type(STORAGE_BUS_TYPE bus)
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PULL 6/6] qga: Fix suspend on Linux guests without systemd
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
` (4 preceding siblings ...)
2023-05-04 9:56 ` [PULL 5/6] qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601 Konstantin Kostiuk
@ 2023-05-04 9:56 ` Konstantin Kostiuk
2023-05-04 11:10 ` [PULL 0/6] Misc QGA patches Richard Henderson
2023-05-04 14:41 ` Richard Henderson
7 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 9:56 UTC (permalink / raw)
To: qemu-devel, Peter Maydell
From: Mark Somerville <mark@qpok.net>
Allow the Linux guest agent to attempt each of the suspend methods
(systemctl, pm-* and writing to /sys) in turn.
Prior to this guests without systemd failed to suspend due to
`guest_suspend` returning early regardless of the return value of
`systemd_supports_mode`.
Signed-off-by: Mark Somerville <mark@qpok.net>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
qga/commands-posix.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 97754930c1..def857d773 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1922,10 +1922,10 @@ static void guest_suspend(SuspendMode mode, Error **errp)
if (systemd_supports_mode(mode, &local_err)) {
mode_supported = true;
systemd_suspend(mode, &local_err);
- }
- if (!local_err) {
- return;
+ if (!local_err) {
+ return;
+ }
}
error_free(local_err);
@@ -1934,10 +1934,10 @@ static void guest_suspend(SuspendMode mode, Error **errp)
if (pmutils_supports_mode(mode, &local_err)) {
mode_supported = true;
pmutils_suspend(mode, &local_err);
- }
- if (!local_err) {
- return;
+ if (!local_err) {
+ return;
+ }
}
error_free(local_err);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PULL 0/6] Misc QGA patches
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
` (5 preceding siblings ...)
2023-05-04 9:56 ` [PULL 6/6] qga: Fix suspend on Linux guests without systemd Konstantin Kostiuk
@ 2023-05-04 11:10 ` Richard Henderson
2023-05-04 11:22 ` Konstantin Kostiuk
2023-05-04 14:41 ` Richard Henderson
7 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2023-05-04 11:10 UTC (permalink / raw)
To: Konstantin Kostiuk, qemu-devel, Peter Maydell
On 5/4/23 10:56, Konstantin Kostiuk wrote:
> From: Kostiantyn Kostiuk<kostyanf14@live.com>
>
>
> The following changes since commit 044f8cf70a2fdf3b9e4c4d849c66e7855d2c446a:
>
> Merge tag 'migration-20230428-pull-request' ofhttps://gitlab.com/juan.quintela/qemu into staging (2023-05-03 10:29:30 +0100)
>
> are available in the Git repository at:
>
> git@github.com:kostyanf14/qemu.git tags/qga-pull-2023-05-04
Please adjust your .git/config to use url=https and pushurl=git@
so that you automatically get an https:// url here.
Fixed by hand while applying, so no need to re-send now.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PULL 0/6] Misc QGA patches
2023-05-04 11:10 ` [PULL 0/6] Misc QGA patches Richard Henderson
@ 2023-05-04 11:22 ` Konstantin Kostiuk
0 siblings, 0 replies; 10+ messages in thread
From: Konstantin Kostiuk @ 2023-05-04 11:22 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel, Peter Maydell
[-- Attachment #1: Type: text/plain, Size: 885 bytes --]
Thanks, Richard. It was ok to use git@ URL last time but not a problem to
fix.
Best Regards,
Konstantin Kostiuk.
On Thu, May 4, 2023 at 2:10 PM Richard Henderson <
richard.henderson@linaro.org> wrote:
> On 5/4/23 10:56, Konstantin Kostiuk wrote:
> > From: Kostiantyn Kostiuk<kostyanf14@live.com>
> >
> >
> > The following changes since commit
> 044f8cf70a2fdf3b9e4c4d849c66e7855d2c446a:
> >
> > Merge tag 'migration-20230428-pull-request' ofhttps://
> gitlab.com/juan.quintela/qemu into staging (2023-05-03 10:29:30 +0100)
> >
> > are available in the Git repository at:
> >
> > git@github.com:kostyanf14/qemu.git tags/qga-pull-2023-05-04
>
> Please adjust your .git/config to use url=https and pushurl=git@
> so that you automatically get an https:// url here.
>
> Fixed by hand while applying, so no need to re-send now.
>
>
> r~
>
>
[-- Attachment #2: Type: text/html, Size: 1610 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PULL 0/6] Misc QGA patches
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
` (6 preceding siblings ...)
2023-05-04 11:10 ` [PULL 0/6] Misc QGA patches Richard Henderson
@ 2023-05-04 14:41 ` Richard Henderson
7 siblings, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2023-05-04 14:41 UTC (permalink / raw)
To: Konstantin Kostiuk, qemu-devel, Peter Maydell
On 5/4/23 10:56, Konstantin Kostiuk wrote:
> From: Kostiantyn Kostiuk <kostyanf14@live.com>
>
>
> The following changes since commit 044f8cf70a2fdf3b9e4c4d849c66e7855d2c446a:
>
> Merge tag 'migration-20230428-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-05-03 10:29:30 +0100)
>
> are available in the Git repository at:
>
> git@github.com:kostyanf14/qemu.git tags/qga-pull-2023-05-04
>
> for you to fetch changes up to 86dcb6ab9b603450eb6d896cdc95286de2c7d561:
>
> qga: Fix suspend on Linux guests without systemd (2023-05-04 09:30:01 +0000)
>
> ----------------------------------------------------------------
> qga-pull-2023-05-04
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-05-05 8:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04 9:56 [PULL 0/6] Misc QGA patches Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 1/6] qga/linux: add usb support to guest-get-fsinfo Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 2/6] qga: Refactor guest-exec capture-output to take enum Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 3/6] qga: Add `merged` variant to GuestExecCaptureOutputMode Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 4/6] qga: test: Add tests for `merged` flag Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 5/6] qga/commands-win32.c: Drop the check for _WIN32_WINNT >= 0x0601 Konstantin Kostiuk
2023-05-04 9:56 ` [PULL 6/6] qga: Fix suspend on Linux guests without systemd Konstantin Kostiuk
2023-05-04 11:10 ` [PULL 0/6] Misc QGA patches Richard Henderson
2023-05-04 11:22 ` Konstantin Kostiuk
2023-05-04 14:41 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).