From: Eduardo Habkost <ehabkost@redhat.com> To: qemu-devel@nongnu.org Cc: "Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>, mprivozn@redhat.com, "Eric Blake" <eblake@redhat.com>, "Markus Armbruster" <armbru@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Hervé Poussineau" <hpoussin@reactos.org>, "David Gibson" <david@gibson.dropbear.id.au>, qemu-ppc@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] machine: Use SupportStatusInfo for deprecation info Date: Tue, 23 Apr 2019 18:22:45 -0300 [thread overview] Message-ID: <20190423212246.3542-3-ehabkost@redhat.com> (raw) In-Reply-To: <20190423212246.3542-1-ehabkost@redhat.com> Use SupportStatusInfo to represent deprecation information of machine types. Instead of using a generic "use XXX instead" message for humans, encode the suggested alternative in a machine-friendly way at the 'suggested_alternatives' field. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- include/hw/boards.h | 7 ++++--- hw/i386/pc_piix.c | 4 +++- hw/ppc/prep.c | 4 +++- vl.c | 13 +++++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index e231860666..243bf3c7ce 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -8,6 +8,8 @@ #include "hw/qdev.h" #include "qom/object.h" #include "qom/cpu.h" +#include "qapi/qapi-types-common.h" + /** * memory_region_allocate_system_memory - Allocate a board's main memory @@ -105,8 +107,7 @@ typedef struct { /** * MachineClass: - * @deprecation_reason: If set, the machine is marked as deprecated. The - * string should provide some clear information about what to use instead. + * @support_status: Support and deprecation status of machine type. * @max_cpus: maximum number of CPUs supported. Default: 1 * @min_cpus: minimum number of CPUs supported. Default: 1 * @default_cpus: number of CPUs instantiated if none are specified. Default: 1 @@ -169,7 +170,7 @@ struct MachineClass { char *name; const char *alias; const char *desc; - const char *deprecation_reason; + SupportStatusInfo support_status; void (*init)(MachineState *state); void (*reset)(void); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8ad8e885c6..97bd401618 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -781,7 +781,9 @@ static void pc_i440fx_0_15_machine_options(MachineClass *m) pc_i440fx_1_0_machine_options(m); m->hw_version = "0.15"; - m->deprecation_reason = "use a newer machine type instead"; + m->support_status.deprecated = true; + m->support_status.has_suggested_alternative = true; + m->support_status.suggested_alternative = g_strdup("pc"); compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 847d320465..9a02b0eec4 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -587,7 +587,9 @@ static void ppc_prep_init(MachineState *machine) static void prep_machine_init(MachineClass *mc) { - mc->deprecation_reason = "use 40p machine type instead"; + mc->support_status.deprecated = true; + mc->support_status.has_suggested_alternative = true; + mc->support_status.suggested_alternative = g_strdup("40p"); mc->desc = "PowerPC PREP platform"; mc->init = ppc_prep_init; mc->block_default_type = IF_IDE; diff --git a/vl.c b/vl.c index c696ad2a13..99b857ed2a 100644 --- a/vl.c +++ b/vl.c @@ -2610,7 +2610,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b) } printf("%-20s %s%s%s\n", mc->name, mc->desc, mc->is_default ? " (default)" : "", - mc->deprecation_reason ? " (deprecated)" : ""); + mc->support_status.deprecated ? " (deprecated)" : ""); } } @@ -4308,9 +4308,14 @@ int main(int argc, char **argv, char **envp) * called from configure_accelerator(). */ - if (!qtest_enabled() && machine_class->deprecation_reason) { - error_report("Machine type '%s' is deprecated: %s", - machine_class->name, machine_class->deprecation_reason); + if (!qtest_enabled() && machine_class->support_status.deprecated) { + error_report("Machine type '%s' is deprecated%s%s", machine_class->name, + machine_class->support_status.status_message ? ": " : "", + machine_class->support_status.status_message ?: ""); + if (machine_class->support_status.suggested_alternative) { + error_report("Suggested solution: use '%s' machine type instead", + machine_class->support_status.suggested_alternative); + } } /* -- 2.18.0.rc1.1.g3f1ff2140
WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com> To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" <mst@redhat.com>, mprivozn@redhat.com, "Markus Armbruster" <armbru@redhat.com>, "Hervé Poussineau" <hpoussin@reactos.org>, qemu-ppc@nongnu.org, "David Gibson" <david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 2/3] machine: Use SupportStatusInfo for deprecation info Date: Tue, 23 Apr 2019 18:22:45 -0300 [thread overview] Message-ID: <20190423212246.3542-3-ehabkost@redhat.com> (raw) Message-ID: <20190423212245.sTJvtu4MEJBwYwd-ujR64U2g49B5U8deKGLcMSq9RMg@z> (raw) In-Reply-To: <20190423212246.3542-1-ehabkost@redhat.com> Use SupportStatusInfo to represent deprecation information of machine types. Instead of using a generic "use XXX instead" message for humans, encode the suggested alternative in a machine-friendly way at the 'suggested_alternatives' field. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- include/hw/boards.h | 7 ++++--- hw/i386/pc_piix.c | 4 +++- hw/ppc/prep.c | 4 +++- vl.c | 13 +++++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index e231860666..243bf3c7ce 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -8,6 +8,8 @@ #include "hw/qdev.h" #include "qom/object.h" #include "qom/cpu.h" +#include "qapi/qapi-types-common.h" + /** * memory_region_allocate_system_memory - Allocate a board's main memory @@ -105,8 +107,7 @@ typedef struct { /** * MachineClass: - * @deprecation_reason: If set, the machine is marked as deprecated. The - * string should provide some clear information about what to use instead. + * @support_status: Support and deprecation status of machine type. * @max_cpus: maximum number of CPUs supported. Default: 1 * @min_cpus: minimum number of CPUs supported. Default: 1 * @default_cpus: number of CPUs instantiated if none are specified. Default: 1 @@ -169,7 +170,7 @@ struct MachineClass { char *name; const char *alias; const char *desc; - const char *deprecation_reason; + SupportStatusInfo support_status; void (*init)(MachineState *state); void (*reset)(void); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8ad8e885c6..97bd401618 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -781,7 +781,9 @@ static void pc_i440fx_0_15_machine_options(MachineClass *m) pc_i440fx_1_0_machine_options(m); m->hw_version = "0.15"; - m->deprecation_reason = "use a newer machine type instead"; + m->support_status.deprecated = true; + m->support_status.has_suggested_alternative = true; + m->support_status.suggested_alternative = g_strdup("pc"); compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 847d320465..9a02b0eec4 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -587,7 +587,9 @@ static void ppc_prep_init(MachineState *machine) static void prep_machine_init(MachineClass *mc) { - mc->deprecation_reason = "use 40p machine type instead"; + mc->support_status.deprecated = true; + mc->support_status.has_suggested_alternative = true; + mc->support_status.suggested_alternative = g_strdup("40p"); mc->desc = "PowerPC PREP platform"; mc->init = ppc_prep_init; mc->block_default_type = IF_IDE; diff --git a/vl.c b/vl.c index c696ad2a13..99b857ed2a 100644 --- a/vl.c +++ b/vl.c @@ -2610,7 +2610,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b) } printf("%-20s %s%s%s\n", mc->name, mc->desc, mc->is_default ? " (default)" : "", - mc->deprecation_reason ? " (deprecated)" : ""); + mc->support_status.deprecated ? " (deprecated)" : ""); } } @@ -4308,9 +4308,14 @@ int main(int argc, char **argv, char **envp) * called from configure_accelerator(). */ - if (!qtest_enabled() && machine_class->deprecation_reason) { - error_report("Machine type '%s' is deprecated: %s", - machine_class->name, machine_class->deprecation_reason); + if (!qtest_enabled() && machine_class->support_status.deprecated) { + error_report("Machine type '%s' is deprecated%s%s", machine_class->name, + machine_class->support_status.status_message ? ": " : "", + machine_class->support_status.status_message ?: ""); + if (machine_class->support_status.suggested_alternative) { + error_report("Suggested solution: use '%s' machine type instead", + machine_class->support_status.suggested_alternative); + } } /* -- 2.18.0.rc1.1.g3f1ff2140
next prev parent reply other threads:[~2019-04-23 21:23 UTC|newest] Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-23 21:22 [Qemu-devel] [PATCH 0/3] Export machine type deprecation info through QMP Eduardo Habkost 2019-04-23 21:22 ` Eduardo Habkost 2019-04-23 21:22 ` [Qemu-devel] [PATCH 1/3] qapi: SupportStatusInfo struct Eduardo Habkost 2019-04-23 21:22 ` Eduardo Habkost 2019-04-23 22:23 ` Philippe Mathieu-Daudé 2019-04-23 22:23 ` Philippe Mathieu-Daudé 2019-04-24 18:24 ` Eduardo Habkost 2019-04-24 18:24 ` Eduardo Habkost 2019-04-24 8:26 ` Daniel P. Berrangé 2019-04-24 8:26 ` Daniel P. Berrangé 2019-04-24 18:20 ` Eduardo Habkost 2019-04-24 18:20 ` Eduardo Habkost 2019-04-30 10:10 ` Daniel P. Berrangé 2019-04-30 10:10 ` Daniel P. Berrangé 2019-04-30 12:42 ` Eduardo Habkost 2019-04-30 12:42 ` Eduardo Habkost 2019-04-30 12:47 ` Daniel P. Berrangé 2019-04-30 12:47 ` Daniel P. Berrangé 2019-04-25 14:20 ` Wainer dos Santos Moschetta 2019-04-25 14:20 ` Wainer dos Santos Moschetta 2019-04-25 17:42 ` Eduardo Habkost 2019-04-25 17:42 ` Eduardo Habkost 2019-04-30 10:03 ` Daniel P. Berrangé 2019-04-30 10:03 ` Daniel P. Berrangé 2019-04-23 21:22 ` Eduardo Habkost [this message] 2019-04-23 21:22 ` [Qemu-devel] [PATCH 2/3] machine: Use SupportStatusInfo for deprecation info Eduardo Habkost 2019-04-23 22:26 ` Philippe Mathieu-Daudé 2019-04-23 22:26 ` Philippe Mathieu-Daudé 2019-04-24 1:37 ` David Gibson 2019-04-24 1:37 ` David Gibson 2019-04-24 8:23 ` Daniel P. Berrangé 2019-04-24 8:23 ` Daniel P. Berrangé 2019-04-24 18:29 ` Eduardo Habkost 2019-04-24 18:29 ` Eduardo Habkost 2019-04-23 21:22 ` [Qemu-devel] [PATCH 3/3] qmp: Add deprecation information to query-machines Eduardo Habkost 2019-04-23 21:22 ` Eduardo Habkost 2019-04-24 8:28 ` Daniel P. Berrangé 2019-04-24 8:28 ` Daniel P. Berrangé 2019-04-25 14:54 ` Wainer dos Santos Moschetta 2019-04-25 14:54 ` Wainer dos Santos Moschetta 2019-04-25 17:43 ` Eduardo Habkost 2019-04-25 17:43 ` Eduardo Habkost 2019-04-23 21:28 ` [Qemu-devel] [PATCH 0/3] Export machine type deprecation info through QMP no-reply 2019-04-23 21:28 ` no-reply 2019-04-24 7:56 ` Thomas Huth 2019-04-24 7:56 ` Thomas Huth 2019-04-24 8:31 ` Daniel P. Berrangé 2019-04-24 8:31 ` Daniel P. Berrangé 2019-04-24 18:14 ` Eduardo Habkost 2019-04-24 18:14 ` Eduardo Habkost 2019-04-24 18:10 ` Eduardo Habkost 2019-04-24 18:10 ` Eduardo Habkost 2019-04-25 7:38 ` Thomas Huth 2019-04-25 7:38 ` Thomas Huth 2019-04-30 10:11 ` Daniel P. Berrangé 2019-04-30 10:11 ` Daniel P. Berrangé 2019-04-24 8:23 ` Michal Privoznik 2019-04-24 8:23 ` Michal Privoznik 2019-05-07 5:07 ` Markus Armbruster 2019-05-07 16:18 ` Eduardo Habkost 2019-05-08 9:16 ` Markus Armbruster 2019-05-08 20:28 ` Eduardo Habkost 2019-05-09 8:31 ` Markus Armbruster 2019-05-09 9:14 ` Daniel P. Berrangé 2019-05-09 15:52 ` Eduardo Habkost 2019-05-09 16:08 ` Daniel P. Berrangé 2019-05-09 17:44 ` Eduardo Habkost 2019-05-10 6:28 ` Markus Armbruster 2019-05-10 17:03 ` Eduardo Habkost 2019-05-10 6:19 ` Markus Armbruster 2019-05-10 17:00 ` Eduardo Habkost 2019-05-09 18:19 ` Eduardo Habkost 2019-05-10 9:29 ` Markus Armbruster 2019-05-10 17:17 ` Eduardo Habkost 2019-05-10 17:26 ` Daniel P. Berrangé 2019-05-13 11:49 ` Markus Armbruster
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190423212246.3542-3-ehabkost@redhat.com \ --to=ehabkost@redhat.com \ --cc=armbru@redhat.com \ --cc=david@gibson.dropbear.id.au \ --cc=eblake@redhat.com \ --cc=hpoussin@reactos.org \ --cc=marcel.apfelbaum@gmail.com \ --cc=mprivozn@redhat.com \ --cc=mst@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=qemu-ppc@nongnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).