From nobody Sat May 4 04:26:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1537948999670286.3661418242981; Wed, 26 Sep 2018 01:03:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FC1830832E6; Wed, 26 Sep 2018 08:03:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDB19600C3; Wed, 26 Sep 2018 08:03:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7AC664BB75; Wed, 26 Sep 2018 08:03:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8Q83BZe028464 for ; Wed, 26 Sep 2018 04:03:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB3D25E53D; Wed, 26 Sep 2018 08:03:11 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-115.brq.redhat.com [10.40.204.115]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A98C55E537 for ; Wed, 26 Sep 2018 08:03:09 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id B9CB12A5072; Wed, 26 Sep 2018 10:03:02 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 26 Sep 2018 10:02:57 +0200 Message-Id: <2f64cfeb8c6f8b9bc2e47c9ef5abee7064b9ef5d.1537948977.git.jdenemar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virsh: Require explicit --domain for domxml-to-native X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 26 Sep 2018 08:03:18 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The domxml-to-native virsh command accepts either --xml or --domain option followed by a file or domain name respectively. The --domain option is documented as required, which means an argument with no option is treated as --xml. Commit v4.3.0-127-gd86531daf2 broke this by making --domain optional and thus an argument with no option was treated as --domain. Signed-off-by: Jiri Denemark --- tools/virsh-domain.c | 6 +++--- tools/virsh.h | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cfb0095333..372bdb95d3 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9509,7 +9509,7 @@ static const vshCmdInfo info_qemu_monitor_event[] =3D= { =20 static const vshCmdOptDef opts_qemu_monitor_event[] =3D { VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), - 0), + 0, 0), {.name =3D "event", .type =3D VSH_OT_STRING, .help =3D N_("filter by event name") @@ -10062,7 +10062,7 @@ static const vshCmdOptDef opts_domxmltonative[] =3D= { .flags =3D VSH_OFLAG_REQ, .help =3D N_("target config data type format") }, - VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(0), + VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(VSH_OFLAG_REQ_OPT, 0), {.name =3D "xml", .type =3D VSH_OT_STRING, .help =3D N_("xml data file to export from") @@ -13312,7 +13312,7 @@ static const vshCmdInfo info_event[] =3D { =20 static const vshCmdOptDef opts_event[] =3D { VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("filter by domain name, id or uui= d"), - 0), + 0, 0), {.name =3D "event", .type =3D VSH_OT_STRING, .completer =3D virshDomainEventNameCompleter, diff --git a/tools/virsh.h b/tools/virsh.h index af0d6ce686..6ff5c74b5e 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -107,16 +107,18 @@ .help =3D _helpstr \ } =20 -# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, cflags) \ +# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, oflags, cflags) \ {.name =3D "domain", \ .type =3D VSH_OT_STRING, \ + .flags =3D oflags, \ .help =3D _helpstr, \ .completer =3D virshDomainNameCompleter, \ .completer_flags =3D cflags, \ } =20 -# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(cflags) \ - VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), cflag= s) +# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(oflags, cflags) \ + VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), \ + oflags, cflags) =20 # define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \ {.name =3D "domain", \ --=20 2.19.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list