[libvirt] [PATCH 1/2] Fix CPU hotplug command names

Probably as a result of a merge error, the CPU hotplug command names were completely wrong. * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix the CPU hotplug command names --- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_monitor_text.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index cde9899..96f246f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1181,7 +1181,7 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, int online) { int ret; - virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon", + virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("cpu_set", "U:cpu", (unsigned long long)cpu, "s:state", online ? "online" : "offline", NULL); diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 6ad07b1..db3806d 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -800,7 +800,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, /* - * Returns: 0 if balloon not supported, +1 if balloon adjust worked + * Returns: 0 if CPU hotplug not supported, +1 if CPU hotplug worked * or -1 on failure */ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) @@ -809,7 +809,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) char *reply = NULL; int ret = -1; - if (virAsprintf(&cmd, "set_cpu %d %s", cpu, online ? "online" : "offline") < 0) { + if (virAsprintf(&cmd, "cpu_set %d %s", cpu, online ? "online" : "offline") < 0) { virReportOOMError(); return -1; } -- 1.6.6.1

The text monitor code was checking for a '\n' prefix on several places. Previously this would work, but since the monitor code re-write the '\n' is already stripped off, so mustn't be checked for. * src/qemu/qemu_monitor_text.c: Fix monitor error checking --- src/qemu/qemu_monitor_text.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index db3806d..4c8c108 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -787,7 +787,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, /* If the command failed qemu prints: 'unknown command' * No message is printed on success it seems */ - if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { /* Don't set error - it is expected memory balloon fails on many qemu */ ret = 0; } else { @@ -816,7 +816,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) if (qemuMonitorCommand(mon, cmd, &reply) < 0) { qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could nt change CPU online status")); + "%s", _("could not change CPU online status")); VIR_FREE(cmd); return -1; } @@ -824,7 +824,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) /* If the command failed qemu prints: 'unknown command' * No message is printed on success it seems */ - if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { /* Don't set error - it is expected CPU onlining fails on many qemu - caller will handle */ ret = 0; } else { @@ -857,7 +857,7 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon, /* If the command failed qemu prints: * device not found, device is locked ... * No message is printed on success it seems */ - if (strstr(reply, "\ndevice ")) { + if (strstr(reply, "device ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, _("could not eject media on %s: %s"), devname, reply); goto cleanup; @@ -901,14 +901,14 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon, /* If the command failed qemu prints: * device not found, device is locked ... * No message is printed on success it seems */ - if (strstr(reply, "\ndevice ")) { + if (strstr(reply, "device ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, _("could not eject media on %s: %s"), devname, reply); goto cleanup; } /* Could not open message indicates bad filename */ - if (strstr(reply, "\nCould not open ")) { + if (strstr(reply, "Could not open ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, _("could not change media on %s: %s"), devname, reply); goto cleanup; @@ -2291,7 +2291,7 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon, goto cleanup; } - if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", _("setting disk password is not supported")); goto cleanup; -- 1.6.6.1

On 04/22/2010 09:49 AM, Daniel P. Berrange wrote:
The text monitor code was checking for a '\n' prefix on several places. Previously this would work, but since the monitor code re-write the '\n' is already stripped off, so mustn't be checked for.
* src/qemu/qemu_monitor_text.c: Fix monitor error checking --- src/qemu/qemu_monitor_text.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index db3806d..4c8c108 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -787,7 +787,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
/* If the command failed qemu prints: 'unknown command' * No message is printed on success it seems */ - if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { /* Don't set error - it is expected memory balloon fails on many qemu */ ret = 0; } else { @@ -816,7 +816,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online)
if (qemuMonitorCommand(mon, cmd, &reply) < 0) { qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could nt change CPU online status")); + "%s", _("could not change CPU online status"));
ACK. Nice way to sneak in the typo fix in the process. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Thu, Apr 22, 2010 at 04:49:01PM +0100, Daniel P. Berrange wrote:
The text monitor code was checking for a '\n' prefix on several places. Previously this would work, but since the monitor code re-write the '\n' is already stripped off, so mustn't be checked for.
* src/qemu/qemu_monitor_text.c: Fix monitor error checking --- src/qemu/qemu_monitor_text.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index db3806d..4c8c108 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -787,7 +787,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
/* If the command failed qemu prints: 'unknown command' * No message is printed on success it seems */ - if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { /* Don't set error - it is expected memory balloon fails on many qemu */ ret = 0; } else { @@ -816,7 +816,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online)
if (qemuMonitorCommand(mon, cmd, &reply) < 0) { qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could nt change CPU online status")); + "%s", _("could not change CPU online status")); VIR_FREE(cmd); return -1; } @@ -824,7 +824,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online)
/* If the command failed qemu prints: 'unknown command' * No message is printed on success it seems */ - if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { /* Don't set error - it is expected CPU onlining fails on many qemu - caller will handle */ ret = 0; } else { @@ -857,7 +857,7 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon, /* If the command failed qemu prints: * device not found, device is locked ... * No message is printed on success it seems */ - if (strstr(reply, "\ndevice ")) { + if (strstr(reply, "device ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, _("could not eject media on %s: %s"), devname, reply); goto cleanup; @@ -901,14 +901,14 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon, /* If the command failed qemu prints: * device not found, device is locked ... * No message is printed on success it seems */ - if (strstr(reply, "\ndevice ")) { + if (strstr(reply, "device ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, _("could not eject media on %s: %s"), devname, reply); goto cleanup; }
/* Could not open message indicates bad filename */ - if (strstr(reply, "\nCould not open ")) { + if (strstr(reply, "Could not open ")) { qemuReportError(VIR_ERR_OPERATION_FAILED, _("could not change media on %s: %s"), devname, reply); goto cleanup; @@ -2291,7 +2291,7 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon, goto cleanup; }
- if (strstr(reply, "\nunknown command:")) { + if (strstr(reply, "unknown command:")) { qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", _("setting disk password is not supported")); goto cleanup;
Including a typo cleanup too, ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 04/22/2010 09:49 AM, Daniel P. Berrange wrote:
Probably as a result of a merge error, the CPU hotplug command names were completely wrong.
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix the CPU hotplug command names --- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_monitor_text.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index cde9899..96f246f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1181,7 +1181,7 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, int online) { int ret; - virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon", + virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("cpu_set", "U:cpu", (unsigned long long)cpu, "s:state", online ? "online" : "offline", NULL);
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Thu, Apr 22, 2010 at 04:49:00PM +0100, Daniel P. Berrange wrote:
Probably as a result of a merge error, the CPU hotplug command names were completely wrong.
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix the CPU hotplug command names --- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_monitor_text.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index cde9899..96f246f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1181,7 +1181,7 @@ int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, int online) { int ret; - virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon", + virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("cpu_set", "U:cpu", (unsigned long long)cpu, "s:state", online ? "online" : "offline", NULL); diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 6ad07b1..db3806d 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -800,7 +800,7 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
/* - * Returns: 0 if balloon not supported, +1 if balloon adjust worked + * Returns: 0 if CPU hotplug not supported, +1 if CPU hotplug worked * or -1 on failure */ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) @@ -809,7 +809,7 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) char *reply = NULL; int ret = -1;
- if (virAsprintf(&cmd, "set_cpu %d %s", cpu, online ? "online" : "offline") < 0) { + if (virAsprintf(&cmd, "cpu_set %d %s", cpu, online ? "online" : "offline") < 0) { virReportOOMError(); return -1; }
ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake