From nobody Thu May 16 09:16:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1657285328; cv=none; d=zohomail.com; s=zohoarc; b=E1V08WdAmou8xf9dXQYSSrNV/r0gHc3kOuW96muwdsSOf1opPvqFodR4mQuCoHvDruAa8ra+u0EQi+TYqp8z10XDcN3eDDYdtUfL5R39ZCl5IFFx3OS1dp7eX7ksHTu4rKorHEVCdMub7rgrYe3Sqe/qeqzTmwHQXJZRom9u8wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657285328; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=3nErcBjLSwJGyEg+PRx6FtTxFtvvHEhWVQvSu/Oo278=; b=buV0rn7w66aFo0Suga3x51WELn/6CGqoVnQTbeueQWRqopHCUohU9ZT1ISQ4hSiPij29rXSX3NTXfBu9Vdv3kZVch94/Ksw29gfq5gsLJGOgkDB0YSb0YKHDfIgcFIOsAILn7EknJSKd1r24wequVxU+ff6xuitDcvH13Lb8mOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1657285328884769.6869910554184; Fri, 8 Jul 2022 06:02:08 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-XiAFyqLMO8CgKGVCFMpBpA-1; Fri, 08 Jul 2022 09:01:59 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 989E8101A58E; Fri, 8 Jul 2022 13:01:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E7BF492C3B; Fri, 8 Jul 2022 13:01:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 093A3194706D; Fri, 8 Jul 2022 13:01:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6C981194706C for ; Fri, 8 Jul 2022 13:01:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5A53E2EFA1; Fri, 8 Jul 2022 13:01:52 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03A6E9D7F for ; Fri, 8 Jul 2022 13:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657285326; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3nErcBjLSwJGyEg+PRx6FtTxFtvvHEhWVQvSu/Oo278=; b=PZv+GYCmaLhQwDLMHdppxdJpBcW60sEfIlxSCkno7taoUIr7VedC0Q9N6kJK8T0i0zkfU4 EQjz9tSwHn1wf9uROChLFaSo+1oIn0cH8DGTUAEt1oN4XY5zxsYjSzDMG8YREco6iu5igu GL0AwpT050S3ehZPgZN/7ctgvFMh1wg= X-MC-Unique: XiAFyqLMO8CgKGVCFMpBpA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2] virsh: Require --xpath for *dumpxml Date: Fri, 8 Jul 2022 15:01:50 +0200 Message-Id: <58c318eb973da98b775762ff42451af883413ff3.1657285230.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1657285329581100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Historically, the dumpxml command reject any unknown arguments, for instance: virsh dumpxml fedora xxx However, after v8.5.0-rc1~31 the second argument ('xxx') is treated as an XPath, but it's not that clearly visible. Therefore, require the --xpath switch, like this: virsh dumpxml fedora --xpath xxx Yes, this breaks already released virsh, but I think we can argue that the pool of users of this particular function is very small. We also document the argument being mandatory: dumpxml [--inactive] [--security-info] [--update-cpu] [--migratable] [--xpath EXPRESSION] [--wrap] domain The sooner we do this change, the better. The same applies for other *dumpxml functions (net-dumpxml, pool-dumpxml, vol-dumpxl to name a few). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2103524 Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- v2 of: https://listman.redhat.com/archives/libvir-list/2022-July/232733.html diff to v1: - Extended commit message to point out that we document --xpath as required, - Fixed the rest of the *dumpxml commands tools/virsh-backup.c | 1 + tools/virsh-checkpoint.c | 1 + tools/virsh-domain.c | 3 +++ tools/virsh-interface.c | 1 + tools/virsh-network.c | 2 ++ tools/virsh-nodedev.c | 1 + tools/virsh-nwfilter.c | 2 ++ tools/virsh-pool.c | 1 + tools/virsh-secret.c | 1 + tools/virsh-snapshot.c | 1 + tools/virsh-volume.c | 1 + 11 files changed, 15 insertions(+) diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c index db122abc09..1bb2c63113 100644 --- a/tools/virsh-backup.c +++ b/tools/virsh-backup.c @@ -117,6 +117,7 @@ static const vshCmdOptDef opts_backup_dumpxml[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index a7ef39849d..9605c893af 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -854,6 +854,7 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] =3D= { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 43034f2f81..8c6245ca2a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4529,6 +4529,7 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -4961,6 +4962,7 @@ static const vshCmdOptDef opts_managed_save_dumpxml[]= =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -10461,6 +10463,7 @@ static const vshCmdOptDef opts_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index b29ffc9bef..39ea53ec9d 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -472,6 +472,7 @@ static const vshCmdOptDef opts_interface_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 99ced6ccc6..004719dad6 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -351,6 +351,7 @@ static const vshCmdOptDef opts_network_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -1556,6 +1557,7 @@ static const vshCmdOptDef opts_network_port_dumpxml[]= =3D { VIRSH_COMMON_OPT_NETWORK_PORT(0), {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 37e361c701..2adcad9c10 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -567,6 +567,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index ff7f6f4026..d4112c8620 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -188,6 +188,7 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, @@ -610,6 +611,7 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml= [] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 820a61f889..8a98c6ae40 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -777,6 +777,7 @@ static const vshCmdOptDef opts_pool_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 79fa3faf5a..17d2bbd88d 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -140,6 +140,7 @@ static const vshCmdOptDef opts_secret_dumpxml[] =3D { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 83fdfb9616..8fa64ba903 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1609,6 +1609,7 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] =3D= { }, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index bf72d8135f..300a0aa8e5 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1161,6 +1161,7 @@ static const vshCmdOptDef opts_vol_dumpxml[] =3D { VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "xpath", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_REQ_OPT, .completer =3D virshCompleteEmpty, .help =3D N_("xpath expression to filter the XML document") }, --=20 2.35.1