From nobody Sat May 11 20:23:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1651286502024878.9501312226937; Fri, 29 Apr 2022 19:41:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.317939.537489 (Exim 4.92) (envelope-from ) id 1nkd2y-0003fs-SJ; Sat, 30 Apr 2022 02:41:24 +0000 Received: by outflank-mailman (output) from mailman id 317939.537489; Sat, 30 Apr 2022 02:41:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nkd2y-0003fl-PJ; Sat, 30 Apr 2022 02:41:24 +0000 Received: by outflank-mailman (input) for mailman id 317939; Sat, 30 Apr 2022 02:41:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nkd2x-0003dd-99 for xen-devel@lists.xenproject.org; Sat, 30 Apr 2022 02:41:23 +0000 Received: from mailhost.m5p.com (mailhost.m5p.com [74.104.188.4]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 04d03138-c82f-11ec-8fc4-03012f2f19d4; Sat, 30 Apr 2022 04:41:22 +0200 (CEST) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.16.1/8.15.2) with ESMTPS id 23U2fBa7061612 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 29 Apr 2022 22:41:17 -0400 (EDT) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.16.1/8.15.2/Submit) id 23U2fBmE061611; Fri, 29 Apr 2022 19:41:11 -0700 (PDT) (envelope-from ehem) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 04d03138-c82f-11ec-8fc4-03012f2f19d4 Message-Id: In-Reply-To: References: From: Elliott Mitchell Cc: Wei Liu Cc: Anthony PERARD Date: Tue, 19 Apr 2022 18:56:03 -0700 Subject: [PATCH v2 1/3] tools/xl: Sort create command options To: xen-devel@lists.xenproject.org X-Spam-Status: No, score=2.5 required=10.0 tests=DATE_IN_PAST_96_XX, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=3.4.5 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on mattapan.m5p.com X-ZM-MESSAGEID: 1651286502396100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Hopefully simplify future changes by sorting options lists for `xl create`. While at it, declare the options list constant. Signed-off-by: Elliott Mitchell Reviewed-by: Anthony PERARD --- v2: Adding mention of making the list constant. Fix the getopt list sorting --- tools/xl/xl_cmdtable.c | 12 ++++++------ tools/xl/xl_vmcontrol.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 661323d488..35182ca196 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -24,16 +24,16 @@ const struct cmd_spec cmd_table[] =3D { &main_create, 1, 1, "Create a domain from config file ", " [options] [vars]", - "-h Print this help.\n" - "-p Leave the domain paused after it is created= .\n" "-c Connect to the console after the domain is = created.\n" + "-d Enable debug messages.\n" + "-e Do not wait in the background for the death= of the domain.\n" + "-F Run in foreground until death of the domain= .\n" "-f FILE, --defconfig=3DFILE\n Use the given con= figuration file.\n" - "-q, --quiet Quiet.\n" + "-h Print this help.\n" "-n, --dryrun Dry run - prints the resulting configuratio= n\n" " (deprecated in favour of global -N option)= .\n" - "-d Enable debug messages.\n" - "-F Run in foreground until death of the domain= .\n" - "-e Do not wait in the background for the death= of the domain.\n" + "-p Leave the domain paused after it is created= .\n" + "-q, --quiet Quiet.\n" "-V, --vncviewer Connect to the VNC display after the domain= is created.\n" "-A, --vncviewer-autopass\n" " Pass VNC password to viewer via stdin.\n" diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 435155a033..d081c6c290 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -1169,13 +1169,13 @@ int main_create(int argc, char **argv) int paused =3D 0, debug =3D 0, daemonize =3D 1, console_autoconnect = =3D 0, quiet =3D 0, monitor =3D 1, vnc =3D 0, vncautopass =3D 0, ignore_m= asks =3D 0; int opt, rc; - static struct option opts[] =3D { + static const struct option opts[] =3D { + {"defconfig", 1, 0, 'f'}, {"dryrun", 0, 0, 'n'}, + {"ignore-global-affinity-masks", 0, 0, 'i'}, {"quiet", 0, 0, 'q'}, - {"defconfig", 1, 0, 'f'}, {"vncviewer", 0, 0, 'V'}, {"vncviewer-autopass", 0, 0, 'A'}, - {"ignore-global-affinity-masks", 0, 0, 'i'}, COMMON_LONG_OPTS }; =20 @@ -1186,12 +1186,15 @@ int main_create(int argc, char **argv) argc--; argv++; } =20 - SWITCH_FOREACH_OPT(opt, "Fnqf:pcdeVAi", opts, "create", 0) { - case 'f': - filename =3D optarg; + SWITCH_FOREACH_OPT(opt, "AFVcdef:inpq", opts, "create", 0) { + case 'A': + vnc =3D vncautopass =3D 1; break; - case 'p': - paused =3D 1; + case 'F': + daemonize =3D 0; + break; + case 'V': + vnc =3D 1; break; case 'c': console_autoconnect =3D 1; @@ -1199,28 +1202,25 @@ int main_create(int argc, char **argv) case 'd': debug =3D 1; break; - case 'F': - daemonize =3D 0; - break; case 'e': daemonize =3D 0; monitor =3D 0; break; + case 'f': + filename =3D optarg; + break; + case 'i': + ignore_masks =3D 1; + break; case 'n': dryrun_only =3D 1; break; + case 'p': + paused =3D 1; + break; case 'q': quiet =3D 1; break; - case 'V': - vnc =3D 1; - break; - case 'A': - vnc =3D vncautopass =3D 1; - break; - case 'i': - ignore_masks =3D 1; - break; } =20 memset(&dom_info, 0, sizeof(dom_info)); --=20 2.30.2 From nobody Sat May 11 20:23:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 165128654347856.60085634935558; Fri, 29 Apr 2022 19:42:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.317947.537500 (Exim 4.92) (envelope-from ) id 1nkd3a-0004H0-4k; Sat, 30 Apr 2022 02:42:02 +0000 Received: by outflank-mailman (output) from mailman id 317947.537500; Sat, 30 Apr 2022 02:42:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nkd3a-0004Gt-1B; Sat, 30 Apr 2022 02:42:02 +0000 Received: by outflank-mailman (input) for mailman id 317947; Sat, 30 Apr 2022 02:42:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nkd3Y-0004Ge-LJ for xen-devel@lists.xenproject.org; Sat, 30 Apr 2022 02:42:00 +0000 Received: from mailhost.m5p.com (mailhost.m5p.com [74.104.188.4]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1a890cc2-c82f-11ec-a405-831a346695d4; Sat, 30 Apr 2022 04:41:58 +0200 (CEST) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.16.1/8.15.2) with ESMTPS id 23U2fm87061622 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 29 Apr 2022 22:41:54 -0400 (EDT) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.16.1/8.15.2/Submit) id 23U2fmBJ061621; Fri, 29 Apr 2022 19:41:48 -0700 (PDT) (envelope-from ehem) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1a890cc2-c82f-11ec-a405-831a346695d4 Message-Id: In-Reply-To: References: From: Elliott Mitchell Cc: Wei Liu Cc: Anthony PERARD Date: Fri, 29 Apr 2022 15:45:25 -0700 Subject: [PATCH v2 2/3] tools/xl: Use sparse init for dom_info, remove duplicate vars To: xen-devel@lists.xenproject.org X-Spam-Status: No, score=1.5 required=10.0 tests=DATE_IN_PAST_03_06, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=3.4.5 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on mattapan.m5p.com X-ZM-MESSAGEID: 1651286544715100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Rather than having shadow variables for every element of dom_info, it is better to properly initialize dom_info at the start. This also removes the misleading memset() in the middle of main_create(). Remove the dryrun element of domain_create as that has been displaced by the global "dryrun_only" variable. Signed-off-by: Elliott Mitchell Reviewed-by: Anthony PERARD --- v2: This was added due to the confusing situation with dom_info. --- tools/xl/xl.h | 1 - tools/xl/xl_vmcontrol.c | 76 ++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/tools/xl/xl.h b/tools/xl/xl.h index c5c4bedbdd..72538d6a81 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -34,7 +34,6 @@ struct domain_create { int daemonize; int monitor; /* handle guest reboots etc */ int paused; - int dryrun; int quiet; int vnc; int vncautopass; diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index d081c6c290..4bf041fb01 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -854,8 +854,8 @@ int create_domain(struct domain_create *dom_info) } } =20 - if (debug || dom_info->dryrun) { - FILE *cfg_print_fh =3D (debug && !dom_info->dryrun) ? stderr : std= out; + if (debug || dryrun_only) { + FILE *cfg_print_fh =3D (debug && !dryrun_only) ? stderr : stdout; if (default_output_format =3D=3D OUTPUT_FORMAT_SXP) { printf_info_sexp(-1, &d_config, cfg_print_fh); } else { @@ -873,7 +873,7 @@ int create_domain(struct domain_create *dom_info) =20 =20 ret =3D 0; - if (dom_info->dryrun) + if (dryrun_only) goto out; =20 start: @@ -1164,10 +1164,26 @@ out: =20 int main_create(int argc, char **argv) { - const char *filename =3D NULL; - struct domain_create dom_info; - int paused =3D 0, debug =3D 0, daemonize =3D 1, console_autoconnect = =3D 0, - quiet =3D 0, monitor =3D 1, vnc =3D 0, vncautopass =3D 0, ignore_m= asks =3D 0; + struct domain_create dom_info =3D { + /* Command-line options */ + .config_file =3D NULL, + .console_autoconnect =3D 0, + .debug =3D 0, + .daemonize =3D 1, + .ignore_global_affinity_masks =3D 0, + .monitor =3D 1, + .paused =3D 0, + .quiet =3D 0, + .vnc =3D 0, + .vncautopass =3D 0, + + /* Extra configuration file settings */ + .extra_config =3D NULL, + + /* FDs, initialize to invalid */ + .migrate_fd =3D -1, + .send_back_fd =3D -1, + }; int opt, rc; static const struct option opts[] =3D { {"defconfig", 1, 0, 'f'}, @@ -1179,58 +1195,54 @@ int main_create(int argc, char **argv) COMMON_LONG_OPTS }; =20 - dom_info.extra_config =3D NULL; - if (argv[1] && argv[1][0] !=3D '-' && !strchr(argv[1], '=3D')) { - filename =3D argv[1]; + dom_info.config_file =3D argv[1]; argc--; argv++; } =20 SWITCH_FOREACH_OPT(opt, "AFVcdef:inpq", opts, "create", 0) { case 'A': - vnc =3D vncautopass =3D 1; + dom_info.vnc =3D dom_info.vncautopass =3D 1; break; case 'F': - daemonize =3D 0; + dom_info.daemonize =3D 0; break; case 'V': - vnc =3D 1; + dom_info.vnc =3D 1; break; case 'c': - console_autoconnect =3D 1; + dom_info.console_autoconnect =3D 1; break; case 'd': - debug =3D 1; + dom_info.debug =3D 1; break; case 'e': - daemonize =3D 0; - monitor =3D 0; + dom_info.daemonize =3D 0; + dom_info.monitor =3D 0; break; case 'f': - filename =3D optarg; + dom_info.config_file =3D optarg; break; case 'i': - ignore_masks =3D 1; + dom_info.ignore_global_affinity_masks =3D 1; break; case 'n': dryrun_only =3D 1; break; case 'p': - paused =3D 1; + dom_info.paused =3D 1; break; case 'q': - quiet =3D 1; + dom_info.quiet =3D 1; break; } =20 - memset(&dom_info, 0, sizeof(dom_info)); - for (; optind < argc; optind++) { if (strchr(argv[optind], '=3D') !=3D NULL) { string_realloc_append(&dom_info.extra_config, argv[optind]); string_realloc_append(&dom_info.extra_config, "\n"); - } else if (!filename) { - filename =3D argv[optind]; + } else if (!dom_info.config_file) { + dom_info.config_file =3D argv[optind]; } else { help("create"); free(dom_info.extra_config); @@ -1238,20 +1250,6 @@ int main_create(int argc, char **argv) } } =20 - dom_info.debug =3D debug; - dom_info.daemonize =3D daemonize; - dom_info.monitor =3D monitor; - dom_info.paused =3D paused; - dom_info.dryrun =3D dryrun_only; - dom_info.quiet =3D quiet; - dom_info.config_file =3D filename; - dom_info.migrate_fd =3D -1; - dom_info.send_back_fd =3D -1; - dom_info.vnc =3D vnc; - dom_info.vncautopass =3D vncautopass; - dom_info.console_autoconnect =3D console_autoconnect; - dom_info.ignore_global_affinity_masks =3D ignore_masks; - rc =3D create_domain(&dom_info); if (rc < 0) { free(dom_info.extra_config); --=20 2.30.2 From nobody Sat May 11 20:23:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1651286576680587.050124748757; Fri, 29 Apr 2022 19:42:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.317958.537511 (Exim 4.92) (envelope-from ) id 1nkd4A-0004qE-EE; Sat, 30 Apr 2022 02:42:38 +0000 Received: by outflank-mailman (output) from mailman id 317958.537511; Sat, 30 Apr 2022 02:42:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nkd4A-0004q5-AJ; Sat, 30 Apr 2022 02:42:38 +0000 Received: by outflank-mailman (input) for mailman id 317958; Sat, 30 Apr 2022 02:42:36 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nkd48-0004Ge-Kg for xen-devel@lists.xenproject.org; Sat, 30 Apr 2022 02:42:36 +0000 Received: from mailhost.m5p.com (mailhost.m5p.com [74.104.188.4]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 30a69f7b-c82f-11ec-a405-831a346695d4; Sat, 30 Apr 2022 04:42:35 +0200 (CEST) Received: from m5p.com (mailhost.m5p.com [IPv6:2001:470:1f07:15ff:0:0:0:f7]) by mailhost.m5p.com (8.16.1/8.15.2) with ESMTPS id 23U2gPBT061633 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 29 Apr 2022 22:42:31 -0400 (EDT) (envelope-from ehem@m5p.com) Received: (from ehem@localhost) by m5p.com (8.16.1/8.15.2/Submit) id 23U2gPka061632; Fri, 29 Apr 2022 19:42:25 -0700 (PDT) (envelope-from ehem) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 30a69f7b-c82f-11ec-a405-831a346695d4 Message-Id: <9aa6160b2664a52ff778fad67c366d67d3a0f8ab.1651285313.git.ehem+xen@m5p.com> In-Reply-To: References: From: Elliott Mitchell Cc: Wei Liu Cc: Anthony PERARD Date: Tue, 19 Apr 2022 18:23:41 -0700 Subject: [PATCH v2 3/3] tools/xl: Allow specifying JSON for domain configuration file format To: xen-devel@lists.xenproject.org X-Spam-Status: No, score=2.5 required=10.0 tests=DATE_IN_PAST_96_XX, KHOP_HELO_FCRDNS autolearn=no autolearn_force=no version=3.4.5 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on mattapan.m5p.com X-ZM-MESSAGEID: 1651286578037100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" JSON is currently used when saving domains to mass storage. Being able to use JSON as the normal input to `xl create` has potential to be valuable. Add the functionality. Move the memset() earlier so to allow use of the structure sooner. Signed-off-by: Elliott Mitchell --- v2: Removing the UUOC situation. Correct the comparison to match the correct variable type. Rename to "config_format" from "format". Rename everything from "format" to "config_format". --- tools/xl/xl.h | 5 +++++ tools/xl/xl_cmdtable.c | 2 ++ tools/xl/xl_vmcontrol.c | 12 ++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/xl/xl.h b/tools/xl/xl.h index 72538d6a81..4b0828431f 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -48,6 +48,11 @@ struct domain_create { int migrate_fd; /* -1 means none */ int send_back_fd; /* -1 means none */ char **migration_domname_r; /* from malloc */ + enum { + CONFIG_FORMAT_DEFAULT, + CONFIG_FORMAT_JSON, + CONFIG_FORMAT_LEGACY, + } config_format; /* format specified for configuration */ }; =20 int create_domain(struct domain_create *dom_info); diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 35182ca196..8a791d8c49 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -30,6 +30,8 @@ const struct cmd_spec cmd_table[] =3D { "-F Run in foreground until death of the domain= .\n" "-f FILE, --defconfig=3DFILE\n Use the given con= figuration file.\n" "-h Print this help.\n" + "-j, --json Interpret configuration file as JSON format= \n" + "-J Use traditional configuration file format (= current default)\n" "-n, --dryrun Dry run - prints the resulting configuratio= n\n" " (deprecated in favour of global -N option)= .\n" "-p Leave the domain paused after it is created= .\n" diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index 4bf041fb01..dd8b3f81a6 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -789,7 +789,7 @@ int create_domain(struct domain_create *dom_info) extra_config); } config_source=3Dconfig_file; - config_in_json =3D false; + config_in_json =3D dom_info->config_format =3D=3D CONFIG_FORMAT_JS= ON; } else { if (!config_data) { fprintf(stderr, "Config file not specified and" @@ -1167,6 +1167,7 @@ int main_create(int argc, char **argv) struct domain_create dom_info =3D { /* Command-line options */ .config_file =3D NULL, + .config_format =3D CONFIG_FORMAT_DEFAULT, .console_autoconnect =3D 0, .debug =3D 0, .daemonize =3D 1, @@ -1189,6 +1190,7 @@ int main_create(int argc, char **argv) {"defconfig", 1, 0, 'f'}, {"dryrun", 0, 0, 'n'}, {"ignore-global-affinity-masks", 0, 0, 'i'}, + {"json", 0, 0, 'j'}, {"quiet", 0, 0, 'q'}, {"vncviewer", 0, 0, 'V'}, {"vncviewer-autopass", 0, 0, 'A'}, @@ -1200,13 +1202,16 @@ int main_create(int argc, char **argv) argc--; argv++; } =20 - SWITCH_FOREACH_OPT(opt, "AFVcdef:inpq", opts, "create", 0) { + SWITCH_FOREACH_OPT(opt, "AFJVcdef:ijnpq", opts, "create", 0) { case 'A': dom_info.vnc =3D dom_info.vncautopass =3D 1; break; case 'F': dom_info.daemonize =3D 0; break; + case 'J': + dom_info.config_format =3D CONFIG_FORMAT_LEGACY; + break; case 'V': dom_info.vnc =3D 1; break; @@ -1226,6 +1231,9 @@ int main_create(int argc, char **argv) case 'i': dom_info.ignore_global_affinity_masks =3D 1; break; + case 'j': + dom_info.config_format =3D CONFIG_FORMAT_JSON; + break; case 'n': dryrun_only =3D 1; break; --=20 2.30.2