From nobody Mon Feb 9 03:46:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1631812679; cv=none; d=zohomail.com; s=zohoarc; b=gmblPLnnIsrMpbZrQZXJ5z9LfVOkrMRsFZSrrxHxerwcPMIiPdggfeJdnsReBhYDieFXOmn8KAYf1My0tTeg1EWvB8Wsm8IeMYovROhEuhC8IedIVbpmywAhSmS6EfL6AHUCeNPouukuki+CPKOBUMAuCDxR6RFktrIlE2NA43E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631812679; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kTfZKs6S6n1829ntjyz0IbyqXVawayxOt5OfmT7MWSE=; b=g9jF1g35Lk0PONrXwnmYioN1P0Ut5BUNt77rHm2CmH9nwzZeS7ib7MCg5ttlVLqZSfvGwkiycNxjiN6TXKQyoTvz007Yo3jjjq3ooigquw4gcjGziKrEBJN76Nfp+We511+M9V3LZ0r7ENFm6oFIg8RNVHlkuWFKdIRholnwZvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1631812679846339.20512029346503; Thu, 16 Sep 2021 10:17:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-TPWPX2zVNKyDmzRFd2_vaA-1; Thu, 16 Sep 2021 13:17:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F33E824FBD; Thu, 16 Sep 2021 17:17:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 438DA7A8CA; Thu, 16 Sep 2021 17:17:52 +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 10A67180598A; Thu, 16 Sep 2021 17:17:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18GHB2TK008351 for ; Thu, 16 Sep 2021 13:11:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 220F518B5E; Thu, 16 Sep 2021 17:11:02 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 709C26A255 for ; Thu, 16 Sep 2021 17:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631812678; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kTfZKs6S6n1829ntjyz0IbyqXVawayxOt5OfmT7MWSE=; b=IW/Uqh+tpF//1lXNbLE2yoRDtSK9ZE+Qznu2wUot+iA9IKVcm5cFtvEy/q1HVyZyXpD7d7 G+84o40YLDx5FHLma/pHz/GxPlC2rCyY0kuSy+3KUGu2iNS1q+eMD0gp+dgEJx3eWHmd5F h1l+iPFr7LABM3nRLWZbvqmoHgv1tXQ= X-MC-Unique: TPWPX2zVNKyDmzRFd2_vaA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/14] virsh: Expand VIRSH_COMMON_OPT_FILE for cases when it's not a local file used by virsh Date: Thu, 16 Sep 2021 19:10:41 +0200 Message-Id: <04aae0932abb85571d3c901a3c66d3a506743350.1631811763.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1631812681909100001 Content-Type: text/plain; charset="utf-8" In cases such as the APIs for managed save management, the file path provided via the '--file' option is passed to the API. We'll need to make them distinct from cases for when virsh is using the file so that different completers can be used. Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 36 ++++++++++++++++++++++++++++++------ tools/virsh-volume.c | 6 +++++- tools/virsh.h | 1 + 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 05fa5c07f6..f45ab5b9d1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4129,7 +4129,11 @@ static const vshCmdInfo info_save[] =3D { static const vshCmdOptDef opts_save[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), - VIRSH_COMMON_OPT_FILE(N_("where to save the data")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("where to save the data") + }, {.name =3D "bypass-cache", .type =3D VSH_OT_BOOL, .help =3D N_("avoid file system cache when saving") @@ -4474,7 +4478,11 @@ static const vshCmdInfo info_save_image_dumpxml[] = =3D { }; static const vshCmdOptDef opts_save_image_dumpxml[] =3D { - VIRSH_COMMON_OPT_FILE(N_("saved state file to read")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("saved state file to read") + }, {.name =3D "security-info", .type =3D VSH_OT_BOOL, .help =3D N_("include security sensitive information in XML dump") @@ -4518,7 +4526,11 @@ static const vshCmdInfo info_save_image_define[] =3D= { }; static const vshCmdOptDef opts_save_image_define[] =3D { - VIRSH_COMMON_OPT_FILE(N_("saved state file to modify")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("saved state file to modify") + }, {.name =3D "xml", .type =3D VSH_OT_DATA, .flags =3D VSH_OFLAG_REQ, @@ -4581,7 +4593,11 @@ static const vshCmdInfo info_save_image_edit[] =3D { }; static const vshCmdOptDef opts_save_image_edit[] =3D { - VIRSH_COMMON_OPT_FILE(N_("saved state file to edit")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("saved state file to edit") + }, {.name =3D "running", .type =3D VSH_OT_BOOL, .help =3D N_("set domain to be running on restore") @@ -5221,7 +5237,11 @@ static const vshCmdInfo info_restore[] =3D { }; static const vshCmdOptDef opts_restore[] =3D { - VIRSH_COMMON_OPT_FILE(N_("the state to restore")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("the state to restore") + }, {.name =3D "bypass-cache", .type =3D VSH_OT_BOOL, .help =3D N_("avoid file system cache when restoring") @@ -5293,7 +5313,11 @@ static const vshCmdInfo info_dump[] =3D { static const vshCmdOptDef opts_dump[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), - VIRSH_COMMON_OPT_FILE(N_("where to dump the core")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("where to dump the core") + }, VIRSH_COMMON_OPT_LIVE(N_("perform a live core dump if supported")), {.name =3D "crash", .type =3D VSH_OT_BOOL, diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 197ed2489c..b73837f4c8 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -775,7 +775,11 @@ static const vshCmdInfo info_vol_download[] =3D { static const vshCmdOptDef opts_vol_download[] =3D { VIRSH_COMMON_OPT_VOL_FULL, - VIRSH_COMMON_OPT_FILE(N_("file")), + {.name =3D "file", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("file") + }, VIRSH_COMMON_OPT_POOL_OPTIONAL, {.name =3D "offset", .type =3D VSH_OT_INT, diff --git a/tools/virsh.h b/tools/virsh.h index 4d777545ff..8e1b8ced90 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -95,6 +95,7 @@ .help =3D _helpstr \ } +/* Use this only for files which are existing and used locally by virsh */ #define VIRSH_COMMON_OPT_FILE(_helpstr) \ {.name =3D "file", \ .type =3D VSH_OT_DATA, \ --=20 2.31.1