* [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze
@ 2021-03-17 3:22 Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 1/6] qga: Correct loop count in qmp_guest_get_vcpus() Michael Roth
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
The following changes since commit 5b7f5586d182b0cafb1f8d558992a14763e2953e:
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20210315-pull-request' into staging (2021-03-16 13:17:54 +0000)
are available in the Git repository at:
git@github.com:mdroth/qemu.git tags/qga-pull-2021-03-16-tag
for you to fetch changes up to c98939daeca3beb21c85560acede8d3529e363d9:
qga: return a more explicit error on why a command is disabled (2021-03-16 20:21:47 -0500)
----------------------------------------------------------------
qemu-ga patch queue for soft-freeze
* fix guest-get-vcpus reporting after vcpu unplug
* coding style fix-ups
* report a reason for disabled commands
----------------------------------------------------------------
AlexChen (4):
qga: Add spaces around operator
qga: Delete redundant spaces
qga: Open brace '{' following struct go on the same
qga: Switch and case should be at the same indent
Lin Ma (1):
qga: Correct loop count in qmp_guest_get_vcpus()
Marc-André Lureau (1):
qga: return a more explicit error on why a command is disabled
include/qapi/qmp/dispatch.h | 4 ++-
qapi/qmp-dispatch.c | 6 +++--
qapi/qmp-registry.c | 10 ++++---
qga/channel-win32.c | 7 ++---
qga/commands-posix.c | 47 ++++++++++++---------------------
qga/commands-win32.c | 26 +++++++++----------
qga/commands.c | 4 +--
qga/main.c | 63 ++++++++++++++++++++++-----------------------
8 files changed, 79 insertions(+), 88 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PULL for-6.0 1/6] qga: Correct loop count in qmp_guest_get_vcpus()
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
@ 2021-03-17 3:22 ` Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 2/6] qga: Add spaces around operator Michael Roth
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Marc-André Lureau, Lin Ma
From: Lin Ma <lma@suse.com>
The guest-get-vcpus returns incorrect vcpu info in case we hotunplug vcpus(not
the last one).
e.g.:
A VM has 4 VCPUs: cpu0 + 3 hotunpluggable online vcpus(cpu1, cpu2 and cpu3).
Hotunplug cpu2, Now only cpu0, cpu1 and cpu3 are present & online.
./qmp-shell /tmp/qmp-monitor.sock
(QEMU) query-hotpluggable-cpus
{"return": [
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 3}, "vcpus-count": 1,
"qom-path": "/machine/peripheral/cpu3", "type": "host-x86_64-cpu"},
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 2}, "vcpus-count": 1,
"qom-path": "/machine/peripheral/cpu2", "type": "host-x86_64-cpu"},
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 1}, "vcpus-count": 1,
"qom-path": "/machine/peripheral/cpu1", "type": "host-x86_64-cpu"},
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "vcpus-count": 1,
"qom-path": "/machine/unattached/device[0]", "type": "host-x86_64-cpu"}
]}
(QEMU) device_del id=cpu2
{"return": {}}
(QEMU) query-hotpluggable-cpus
{"return": [
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 3}, "vcpus-count": 1,
"qom-path": "/machine/peripheral/cpu3", "type": "host-x86_64-cpu"},
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 2}, "vcpus-count": 1,
"type": "host-x86_64-cpu"},
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 1}, "vcpus-count": 1,
"qom-path": "/machine/peripheral/cpu1", "type": "host-x86_64-cpu"},
{"props": {"core-id": 0, "thread-id": 0, "socket-id": 0}, "vcpus-count": 1,
"qom-path": "/machine/unattached/device[0]", "type": "host-x86_64-cpu"}
]}
Before:
./qmp-shell -N /tmp/qmp-ga.sock
Welcome to the QMP low-level shell!
Connected
(QEMU) guest-get-vcpus
{"return": [
{"online": true, "can-offline": false, "logical-id": 0},
{"online": true, "can-offline": true, "logical-id": 1}]}
After:
./qmp-shell -N /tmp/qmp-ga.sock
Welcome to the QMP low-level shell!
Connected
(QEMU) guest-get-vcpus
{"return": [
{"online": true, "can-offline": false, "logical-id": 0},
{"online": true, "can-offline": true, "logical-id": 1},
{"online": true, "can-offline": true, "logical-id": 3}]}
Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
*fix build breakage by using PRId64 for sscanf
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
qga/commands-posix.c | 43 ++++++++++++++-----------------------------
1 file changed, 14 insertions(+), 29 deletions(-)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 3f18df1bb6..665735fd09 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2370,24 +2370,6 @@ error:
return NULL;
}
-#define SYSCONF_EXACT(name, errp) sysconf_exact((name), #name, (errp))
-
-static long sysconf_exact(int name, const char *name_str, Error **errp)
-{
- long ret;
-
- errno = 0;
- ret = sysconf(name);
- if (ret == -1) {
- if (errno == 0) {
- error_setg(errp, "sysconf(%s): value indefinite", name_str);
- } else {
- error_setg_errno(errp, errno, "sysconf(%s)", name_str);
- }
- }
- return ret;
-}
-
/* Transfer online/offline status between @vcpu and the guest system.
*
* On input either @errp or *@errp must be NULL.
@@ -2458,30 +2440,33 @@ static void transfer_vcpu(GuestLogicalProcessor *vcpu, bool sys2vcpu,
GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
{
- int64_t current;
GuestLogicalProcessorList *head, **tail;
- long sc_max;
+ const char *cpu_dir = "/sys/devices/system/cpu";
+ const gchar *line;
+ g_autoptr(GDir) cpu_gdir = NULL;
Error *local_err = NULL;
- current = 0;
head = NULL;
tail = &head;
- sc_max = SYSCONF_EXACT(_SC_NPROCESSORS_CONF, &local_err);
+ cpu_gdir = g_dir_open(cpu_dir, 0, NULL);
- while (local_err == NULL && current < sc_max) {
- GuestLogicalProcessor *vcpu;
- int64_t id = current++;
- char *path = g_strdup_printf("/sys/devices/system/cpu/cpu%" PRId64 "/",
- id);
+ if (cpu_gdir == NULL) {
+ error_setg_errno(errp, errno, "failed to list entries: %s", cpu_dir);
+ return NULL;
+ }
- if (g_file_test(path, G_FILE_TEST_EXISTS)) {
+ while (local_err == NULL && (line = g_dir_read_name(cpu_gdir)) != NULL) {
+ GuestLogicalProcessor *vcpu;
+ int64_t id;
+ if (sscanf(line, "cpu%" PRId64, &id)) {
+ g_autofree char *path = g_strdup_printf("/sys/devices/system/cpu/"
+ "cpu%" PRId64 "/", id);
vcpu = g_malloc0(sizeof *vcpu);
vcpu->logical_id = id;
vcpu->has_can_offline = true; /* lolspeak ftw */
transfer_vcpu(vcpu, true, path, &local_err);
QAPI_LIST_APPEND(tail, vcpu);
}
- g_free(path);
}
if (local_err == NULL) {
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL for-6.0 2/6] qga: Add spaces around operator
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 1/6] qga: Correct loop count in qmp_guest_get_vcpus() Michael Roth
@ 2021-03-17 3:22 ` Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 3/6] qga: Delete redundant spaces Michael Roth
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: AlexChen, peter.maydell, Marc-André Lureau, Euler Robot
From: AlexChen <alex.chen@huawei.com>
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
*fix 80+ char violation while we're here
*fix w32 build breakage from changing INVALID_SET_FILE_POINTER
definition from a cast to a subtraction
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
qga/channel-win32.c | 7 ++++---
qga/commands-posix.c | 4 ++--
qga/commands-win32.c | 22 +++++++++++-----------
qga/commands.c | 4 ++--
qga/main.c | 4 ++--
5 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index 4f04868a76..779007e39b 100644
--- a/qga/channel-win32.c
+++ b/qga/channel-win32.c
@@ -292,9 +292,9 @@ static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method,
return false;
}
- if (method == GA_CHANNEL_ISA_SERIAL){
+ if (method == GA_CHANNEL_ISA_SERIAL) {
snprintf(newpath, sizeof(newpath), "\\\\.\\%s", path);
- }else {
+ } else {
g_strlcpy(newpath, path, sizeof(newpath));
}
@@ -307,7 +307,8 @@ static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method,
return false;
}
- if (method == GA_CHANNEL_ISA_SERIAL && !SetCommTimeouts(c->handle,&comTimeOut)) {
+ if (method == GA_CHANNEL_ISA_SERIAL
+ && !SetCommTimeouts(c->handle, &comTimeOut)) {
g_autofree gchar *emsg = g_win32_error_message(GetLastError());
g_critical("error setting timeout for com port: %s", emsg);
CloseHandle(c->handle);
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 665735fd09..4299ebd96f 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -110,7 +110,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
reopen_fd_to_null(2);
execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
- "hypervisor initiated shutdown", (char*)NULL, environ);
+ "hypervisor initiated shutdown", (char *)NULL, environ);
_exit(EXIT_FAILURE);
} else if (pid < 0) {
error_setg_errno(errp, errno, "failed to create child process");
@@ -479,7 +479,7 @@ GuestFileRead *guest_file_read_unsafe(GuestFileHandle *gfh,
gfh->state = RW_STATE_NEW;
}
- buf = g_malloc0(count+1);
+ buf = g_malloc0(count + 1);
read_count = fread(buf, 1, count, fh);
if (ferror(fh)) {
error_setg_errno(errp, errno, "failed to read file");
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a00e6cb165..4f4c579a3b 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -110,15 +110,15 @@ static OpenFlags guest_file_open_modes[] = {
{"w", GENERIC_WRITE, CREATE_ALWAYS},
{"wb", GENERIC_WRITE, CREATE_ALWAYS},
{"a", FILE_GENERIC_APPEND, OPEN_ALWAYS },
- {"r+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
- {"rb+", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
- {"r+b", GENERIC_WRITE|GENERIC_READ, OPEN_EXISTING},
- {"w+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
- {"wb+", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
- {"w+b", GENERIC_WRITE|GENERIC_READ, CREATE_ALWAYS},
- {"a+", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS },
- {"ab+", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS },
- {"a+b", FILE_GENERIC_APPEND|GENERIC_READ, OPEN_ALWAYS }
+ {"r+", GENERIC_WRITE | GENERIC_READ, OPEN_EXISTING},
+ {"rb+", GENERIC_WRITE | GENERIC_READ, OPEN_EXISTING},
+ {"r+b", GENERIC_WRITE | GENERIC_READ, OPEN_EXISTING},
+ {"w+", GENERIC_WRITE | GENERIC_READ, CREATE_ALWAYS},
+ {"wb+", GENERIC_WRITE | GENERIC_READ, CREATE_ALWAYS},
+ {"w+b", GENERIC_WRITE | GENERIC_READ, CREATE_ALWAYS},
+ {"a+", FILE_GENERIC_APPEND | GENERIC_READ, OPEN_ALWAYS },
+ {"ab+", FILE_GENERIC_APPEND | GENERIC_READ, OPEN_ALWAYS },
+ {"a+b", FILE_GENERIC_APPEND | GENERIC_READ, OPEN_ALWAYS }
};
#define debug_error(msg) do { \
@@ -280,7 +280,7 @@ static void acquire_privilege(const char *name, Error **errp)
Error *local_err = NULL;
if (OpenProcessToken(GetCurrentProcess(),
- TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token))
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token))
{
if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
@@ -1116,7 +1116,7 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
len = strlen(mnt_point);
mnt_point[len] = '\\';
- mnt_point[len+1] = 0;
+ mnt_point[len + 1] = 0;
if (!GetVolumeInformationByHandleW(hLocalDiskHandle, vol_info,
sizeof(vol_info), NULL, NULL, NULL,
diff --git a/qga/commands.c b/qga/commands.c
index e866fc7081..a6491d2cf8 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -22,9 +22,9 @@
#include "commands-common.h"
/* Maximum captured guest-exec out_data/err_data - 16MB */
-#define GUEST_EXEC_MAX_OUTPUT (16*1024*1024)
+#define GUEST_EXEC_MAX_OUTPUT (16 * 1024 * 1024)
/* Allocation and I/O buffer for reading guest-exec out_data/err_data - 4KB */
-#define GUEST_EXEC_IO_SIZE (4*1024)
+#define GUEST_EXEC_IO_SIZE (4 * 1024)
/*
* Maximum file size to read - 48MB
*
diff --git a/qga/main.c b/qga/main.c
index e7f8f3b161..560490467b 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -586,7 +586,7 @@ end:
static gboolean channel_event_cb(GIOCondition condition, gpointer data)
{
GAState *s = data;
- gchar buf[QGA_READ_COUNT_DEFAULT+1];
+ gchar buf[QGA_READ_COUNT_DEFAULT + 1];
gsize count;
GIOStatus status = ga_channel_read(s->channel, buf, QGA_READ_COUNT_DEFAULT, &count);
switch (status) {
@@ -610,7 +610,7 @@ static gboolean channel_event_cb(GIOCondition condition, gpointer data)
* host-side chardev. sleep a bit to mitigate this
*/
if (s->virtio) {
- usleep(100*1000);
+ usleep(100 * 1000);
}
return true;
default:
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL for-6.0 3/6] qga: Delete redundant spaces
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 1/6] qga: Correct loop count in qmp_guest_get_vcpus() Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 2/6] qga: Add spaces around operator Michael Roth
@ 2021-03-17 3:22 ` Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 4/6] qga: Open brace '{' following struct go on the same Michael Roth
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: AlexChen, peter.maydell, Marc-André Lureau, Euler Robot
From: AlexChen <alex.chen@huawei.com>
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
qga/commands-win32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 4f4c579a3b..27baf17d6c 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1323,7 +1323,7 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
DWORD char_count = 0;
char *path, *out;
GError *gerr = NULL;
- gchar * argv[4];
+ gchar *argv[4];
GetVolumePathNamesForVolumeNameW(guid, NULL, 0, &char_count);
@@ -2174,7 +2174,7 @@ static ga_win_10_0_server_t const WIN_10_0_SERVER_VERSION_MATRIX[3] = {
static void ga_get_win_version(RTL_OSVERSIONINFOEXW *info, Error **errp)
{
- typedef NTSTATUS(WINAPI * rtl_get_version_t)(
+ typedef NTSTATUS(WINAPI *rtl_get_version_t)(
RTL_OSVERSIONINFOEXW *os_version_info_ex);
info->dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL for-6.0 4/6] qga: Open brace '{' following struct go on the same
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
` (2 preceding siblings ...)
2021-03-17 3:22 ` [PULL for-6.0 3/6] qga: Delete redundant spaces Michael Roth
@ 2021-03-17 3:22 ` Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 5/6] qga: Switch and case should be at the same indent Michael Roth
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: AlexChen, peter.maydell, Marc-André Lureau, Euler Robot
From: AlexChen <alex.chen@huawei.com>
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
qga/main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/qga/main.c b/qga/main.c
index 560490467b..20db0058db 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -686,8 +686,7 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD type, LPVOID data,
DWORD ret = NO_ERROR;
GAService *service = &ga_state->service;
- switch (ctrl)
- {
+ switch (ctrl) {
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
quit_handler(SIGTERM);
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL for-6.0 5/6] qga: Switch and case should be at the same indent
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
` (3 preceding siblings ...)
2021-03-17 3:22 ` [PULL for-6.0 4/6] qga: Open brace '{' following struct go on the same Michael Roth
@ 2021-03-17 3:22 ` Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 6/6] qga: return a more explicit error on why a command is disabled Michael Roth
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: AlexChen, peter.maydell, Marc-André Lureau, Euler Robot
From: AlexChen <alex.chen@huawei.com>
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
qga/main.c | 52 ++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/qga/main.c b/qga/main.c
index 20db0058db..ebb910773b 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -279,20 +279,20 @@ QEMU_HELP_BOTTOM "\n"
static const char *ga_log_level_str(GLogLevelFlags level)
{
switch (level & G_LOG_LEVEL_MASK) {
- case G_LOG_LEVEL_ERROR:
- return "error";
- case G_LOG_LEVEL_CRITICAL:
- return "critical";
- case G_LOG_LEVEL_WARNING:
- return "warning";
- case G_LOG_LEVEL_MESSAGE:
- return "message";
- case G_LOG_LEVEL_INFO:
- return "info";
- case G_LOG_LEVEL_DEBUG:
- return "debug";
- default:
- return "user";
+ case G_LOG_LEVEL_ERROR:
+ return "error";
+ case G_LOG_LEVEL_CRITICAL:
+ return "critical";
+ case G_LOG_LEVEL_WARNING:
+ return "warning";
+ case G_LOG_LEVEL_MESSAGE:
+ return "message";
+ case G_LOG_LEVEL_INFO:
+ return "info";
+ case G_LOG_LEVEL_DEBUG:
+ return "debug";
+ default:
+ return "user";
}
}
@@ -687,19 +687,19 @@ DWORD WINAPI service_ctrl_handler(DWORD ctrl, DWORD type, LPVOID data,
GAService *service = &ga_state->service;
switch (ctrl) {
- case SERVICE_CONTROL_STOP:
- case SERVICE_CONTROL_SHUTDOWN:
- quit_handler(SIGTERM);
- SetEvent(ga_state->wakeup_event);
- service->status.dwCurrentState = SERVICE_STOP_PENDING;
- SetServiceStatus(service->status_handle, &service->status);
- break;
- case SERVICE_CONTROL_DEVICEEVENT:
- handle_serial_device_events(type, data);
- break;
+ case SERVICE_CONTROL_STOP:
+ case SERVICE_CONTROL_SHUTDOWN:
+ quit_handler(SIGTERM);
+ SetEvent(ga_state->wakeup_event);
+ service->status.dwCurrentState = SERVICE_STOP_PENDING;
+ SetServiceStatus(service->status_handle, &service->status);
+ break;
+ case SERVICE_CONTROL_DEVICEEVENT:
+ handle_serial_device_events(type, data);
+ break;
- default:
- ret = ERROR_CALL_NOT_IMPLEMENTED;
+ default:
+ ret = ERROR_CALL_NOT_IMPLEMENTED;
}
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PULL for-6.0 6/6] qga: return a more explicit error on why a command is disabled
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
` (4 preceding siblings ...)
2021-03-17 3:22 ` [PULL for-6.0 5/6] qga: Switch and case should be at the same indent Michael Roth
@ 2021-03-17 3:22 ` Michael Roth
2021-03-17 3:42 ` [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze no-reply
2021-03-18 14:07 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Michael Roth @ 2021-03-17 3:22 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Marc-André Lureau
From: Marc-André Lureau <marcandre.lureau@redhat.com>
qmp_disable_command() now takes an optional error string to return a
more explicit error message.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1928806
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
*fix up 80+ char line
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
include/qapi/qmp/dispatch.h | 4 +++-
qapi/qmp-dispatch.c | 6 ++++--
qapi/qmp-registry.c | 10 ++++++----
qga/main.c | 4 ++--
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
index 1486cac3ef..135dfdef71 100644
--- a/include/qapi/qmp/dispatch.h
+++ b/include/qapi/qmp/dispatch.h
@@ -36,6 +36,7 @@ typedef struct QmpCommand
QmpCommandOptions options;
QTAILQ_ENTRY(QmpCommand) node;
bool enabled;
+ const char *disable_reason;
} QmpCommand;
typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList;
@@ -44,7 +45,8 @@ void qmp_register_command(QmpCommandList *cmds, const char *name,
QmpCommandFunc *fn, QmpCommandOptions options);
const QmpCommand *qmp_find_command(const QmpCommandList *cmds,
const char *name);
-void qmp_disable_command(QmpCommandList *cmds, const char *name);
+void qmp_disable_command(QmpCommandList *cmds, const char *name,
+ const char *err_msg);
void qmp_enable_command(QmpCommandList *cmds, const char *name);
bool qmp_command_is_enabled(const QmpCommand *cmd);
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 0a2b20a4e4..5e597c76f7 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -157,8 +157,10 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
}
if (!cmd->enabled) {
error_set(&err, ERROR_CLASS_COMMAND_NOT_FOUND,
- "The command %s has been disabled for this instance",
- command);
+ "Command %s has been disabled%s%s",
+ command,
+ cmd->disable_reason ? ": " : "",
+ cmd->disable_reason ?: "");
goto out;
}
if (oob && !(cmd->options & QCO_ALLOW_OOB)) {
diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c
index 58c65b5052..f78c064aae 100644
--- a/qapi/qmp-registry.c
+++ b/qapi/qmp-registry.c
@@ -43,26 +43,28 @@ const QmpCommand *qmp_find_command(const QmpCommandList *cmds, const char *name)
}
static void qmp_toggle_command(QmpCommandList *cmds, const char *name,
- bool enabled)
+ bool enabled, const char *disable_reason)
{
QmpCommand *cmd;
QTAILQ_FOREACH(cmd, cmds, node) {
if (strcmp(cmd->name, name) == 0) {
cmd->enabled = enabled;
+ cmd->disable_reason = disable_reason;
return;
}
}
}
-void qmp_disable_command(QmpCommandList *cmds, const char *name)
+void qmp_disable_command(QmpCommandList *cmds, const char *name,
+ const char *disable_reason)
{
- qmp_toggle_command(cmds, name, false);
+ qmp_toggle_command(cmds, name, false, disable_reason);
}
void qmp_enable_command(QmpCommandList *cmds, const char *name)
{
- qmp_toggle_command(cmds, name, true);
+ qmp_toggle_command(cmds, name, true, NULL);
}
bool qmp_command_is_enabled(const QmpCommand *cmd)
diff --git a/qga/main.c b/qga/main.c
index ebb910773b..15fd3a4149 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -375,7 +375,7 @@ static void ga_disable_non_whitelisted(const QmpCommand *cmd, void *opaque)
}
if (!whitelisted) {
g_debug("disabling command: %s", name);
- qmp_disable_command(&ga_commands, name);
+ qmp_disable_command(&ga_commands, name, "the agent is in frozen state");
}
}
@@ -1328,7 +1328,7 @@ static GAState *initialize_agent(GAConfig *config, int socket_activation)
s->blacklist = config->blacklist;
do {
g_debug("disabling command: %s", (char *)l->data);
- qmp_disable_command(&ga_commands, l->data);
+ qmp_disable_command(&ga_commands, l->data, NULL);
l = g_list_next(l);
} while (l);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
` (5 preceding siblings ...)
2021-03-17 3:22 ` [PULL for-6.0 6/6] qga: return a more explicit error on why a command is disabled Michael Roth
@ 2021-03-17 3:42 ` no-reply
2021-03-18 14:07 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: no-reply @ 2021-03-17 3:42 UTC (permalink / raw)
To: michael.roth; +Cc: peter.maydell, qemu-devel
Patchew URL: https://patchew.org/QEMU/20210317032217.1460684-1-michael.roth@amd.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20210317032217.1460684-1-michael.roth@amd.com
Subject: [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/20210304123951.163411-1-joel@jms.id.au -> patchew/20210304123951.163411-1-joel@jms.id.au
* [new tag] patchew/20210317032217.1460684-1-michael.roth@amd.com -> patchew/20210317032217.1460684-1-michael.roth@amd.com
Switched to a new branch 'test'
737a2b0 qga: return a more explicit error on why a command is disabled
0bf8864 qga: Switch and case should be at the same indent
59f1523 qga: Open brace '{' following struct go on the same
9a65ca2 qga: Delete redundant spaces
f45a2c1 qga: Add spaces around operator
0a0eab1 qga: Correct loop count in qmp_guest_get_vcpus()
=== OUTPUT BEGIN ===
1/6 Checking commit 0a0eab1610f6 (qga: Correct loop count in qmp_guest_get_vcpus())
2/6 Checking commit f45a2c1f5bc7 (qga: Add spaces around operator)
3/6 Checking commit 9a65ca2783f0 (qga: Delete redundant spaces)
ERROR: spaces required around that '*' (ctx:WxV)
#34: FILE: qga/commands-win32.c:2177:
+ typedef NTSTATUS(WINAPI *rtl_get_version_t)(
^
total: 1 errors, 0 warnings, 16 lines checked
Patch 3/6 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/6 Checking commit 59f152349ac0 (qga: Open brace '{' following struct go on the same)
5/6 Checking commit 0bf88641ae37 (qga: Switch and case should be at the same indent)
6/6 Checking commit 737a2b0e78d0 (qga: return a more explicit error on why a command is disabled)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20210317032217.1460684-1-michael.roth@amd.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
` (6 preceding siblings ...)
2021-03-17 3:42 ` [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze no-reply
@ 2021-03-18 14:07 ` Peter Maydell
7 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2021-03-18 14:07 UTC (permalink / raw)
To: Michael Roth; +Cc: QEMU Developers
On Wed, 17 Mar 2021 at 03:22, Michael Roth <michael.roth@amd.com> wrote:
>
> The following changes since commit 5b7f5586d182b0cafb1f8d558992a14763e2953e:
>
> Merge remote-tracking branch 'remotes/kraxel/tags/usb-20210315-pull-request' into staging (2021-03-16 13:17:54 +0000)
>
> are available in the Git repository at:
>
> git@github.com:mdroth/qemu.git tags/qga-pull-2021-03-16-tag
>
> for you to fetch changes up to c98939daeca3beb21c85560acede8d3529e363d9:
>
> qga: return a more explicit error on why a command is disabled (2021-03-16 20:21:47 -0500)
>
> ----------------------------------------------------------------
> qemu-ga patch queue for soft-freeze
>
> * fix guest-get-vcpus reporting after vcpu unplug
> * coding style fix-ups
> * report a reason for disabled commands
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-03-18 14:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 3:22 [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 1/6] qga: Correct loop count in qmp_guest_get_vcpus() Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 2/6] qga: Add spaces around operator Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 3/6] qga: Delete redundant spaces Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 4/6] qga: Open brace '{' following struct go on the same Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 5/6] qga: Switch and case should be at the same indent Michael Roth
2021-03-17 3:22 ` [PULL for-6.0 6/6] qga: return a more explicit error on why a command is disabled Michael Roth
2021-03-17 3:42 ` [PULL for-6.0 0/6] qemu-ga patch queue for soft-freeze no-reply
2021-03-18 14:07 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.