[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/12] qmp: add cpu_set qmp command
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 11/12] qmp: add cpu_set qmp command |
Date: |
Thu, 21 Mar 2013 20:44:34 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
On 03/21/2013 08:28 AM, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
> +++ b/qapi-schema.json
> @@ -1385,6 +1385,15 @@
> { 'command': 'cpu', 'data': {'index': 'int'} }
>
> ##
> +# @cpu_set
> +#
I already mentioned naming this cpu-set on your cover letter. Additionally:
> +# Sets specified cpu to online/ofline mode
s/ofline/offline/
> +#
> +# Notes: semantics is : cpu_set id=x status=online|offline
> +##
> +{ 'command': 'cpu_set', 'data': {'id': 'int', 'status': 'str'} }
Don't open-code a 'str'. My preference would be a bool, with slightly
different naming.
Also, this is not the typical documentation style used in this file.
Rather, it would be more like:
# Sets specified cpu to online/offline mode
#
# @id: cpu id to be updated
#
# @online: true to put the cpu online, false to take it offline
#
##
{ 'command': 'cpu-set', 'data': {'id': 'int', 'online': 'bool'} }
> +void qmp_cpu_set(int64_t id, const char *status, Error **errp)
> +{
> + if (!strcmp(status, "online")) {
> + do_cpu_hot_add(id, errp);
> + } else if (!strcmp(status, "offline")) {
> + error_setg(errp, "Unplug is not implemented");
> + } else {
> + error_setg(errp, "Invalid parameter '%s'", status);
> + return;
This return could be omitted, with no change in behavior. But again, I
think a bool rather than an open-coded string parser would make this
simpler:
void qmp_cpu_set(int64_t id, bool online, Error **errp)
{
if (online) {
do_cpu_hot_add(id, errp);
} else {
error_setg(errp, "Unplug is not implemented");
}
}
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 05/12] target-i386: push hot-plugged VCPU state to KVM and unstop it, (continued)
- [Qemu-devel] [PATCH 07/12] target-i386: Add ICC_BUS and attach apic, kvmvapic and cpu to it, Igor Mammedov, 2013/03/21
- [Qemu-devel] [PATCH 09/12] rtc: update rtc_cmos on CPU hot-plug, Igor Mammedov, 2013/03/21
- [Qemu-devel] [PATCH 06/12] target-i386: replace FROM_SYSBUS() with QOM type cast, Igor Mammedov, 2013/03/21
- [Qemu-devel] [PATCH 08/12] introduce CPU hot-plug notifier, Igor Mammedov, 2013/03/21
- [Qemu-devel] [PATCH 10/12] acpi_piix4: add infrastructure to send CPU hot-plug GPE to guest, Igor Mammedov, 2013/03/21
- [Qemu-devel] [PATCH 11/12] qmp: add cpu_set qmp command, Igor Mammedov, 2013/03/21
- Re: [Qemu-devel] [PATCH 11/12] qmp: add cpu_set qmp command,
Eric Blake <=
- [Qemu-devel] [PATCH 11/12 v2] qmp: add cpu-set qmp command, Igor Mammedov, 2013/03/25
- Re: [Qemu-devel] [PATCH 11/12 v2] qmp: add cpu-set qmp command, Luiz Capitulino, 2013/03/25
- Re: [Qemu-devel] [PATCH 11/12 v2] qmp: add cpu-set qmp command, Eric Blake, 2013/03/25
- Re: [Qemu-devel] [PATCH 11/12 v2] qmp: add cpu-set qmp command, Igor Mammedov, 2013/03/26
- Re: [Qemu-devel] [PATCH 11/12 v2] qmp: add cpu-set qmp command, Luiz Capitulino, 2013/03/26
- Re: [Qemu-devel] [PATCH 11/12 v2] qmp: add cpu-set qmp command, Eric Blake, 2013/03/26
Re: [Qemu-devel] [PATCH 11/12] qmp: add cpu_set qmp command, Paolo Bonzini, 2013/03/27
[Qemu-devel] [PATCH 12/12] target-i386: implement CPU hot-add, Igor Mammedov, 2013/03/21