From nobody Tue Jul 14 21:21:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1783940516; cv=none; d=zohomail.com; s=zohoarc; b=ISkYiLZpFRnXbExLelyag0CMGq74CnuJwyuiVBzes71N9GHF4kBrNBH+WeHrDtgBBtz4SMghjN9D2eI4fbGQWboPq/BE0Yvo3lJzFkW7GrERl3ZYtZhbVmDOHlMinkfs9if+ZlcYke9jjCZ9op1Seo+QbVeh4LKqsBuetMuD9AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783940516; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=ff4mB9q6LCQv+Yn0PeMGMSQo7WPmGh9I8zmksM1VVZY=; b=GUHpysjI78h0FLvkB27W/UmtQhIgrMcXI66RsqLUkTIm3Qj1TF0SkKKaxmdCK/TSdajr6sWuMY2amkuq59ZSb0nC1KsVW5rx70Tb7FuHK88/DkO9r1w8zDhOjhZTciDKR0SRCrs1dAK2ekKxaoLUHImPcEJoHtNEvTxd6YPfFV8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1783940516192428.9144185554147; Mon, 13 Jul 2026 04:01:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D635B44069; Mon, 13 Jul 2026 07:01:54 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4C39443DD8; Mon, 13 Jul 2026 07:00:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6208D43DBE; Mon, 13 Jul 2026 07:00:33 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2BD81423FB for ; Mon, 13 Jul 2026 07:00:32 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-22-WKdJoSUOPDqrBcS-p-07RQ-1; Mon, 13 Jul 2026 07:00:30 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A7D771955DDE for ; Mon, 13 Jul 2026 11:00:29 +0000 (UTC) Received: from rsmigiel-thinkpadx1carbongen11-remote-csb.redhat.com (unknown [10.44.48.120]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BA7161686; Mon, 13 Jul 2026 11:00:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783940431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ff4mB9q6LCQv+Yn0PeMGMSQo7WPmGh9I8zmksM1VVZY=; b=CdiHX+eMCyIKurrZSZxnwwP+VQoIgHlH8HAo2NCyK49snsCqrSRs7fIlyEH0pYle98eI8z h4G37TCS3LdA5hjTr99bIIEl+lNnvdjrx+BtClO51sc/VI03EmvA4X2DxNub3V+GMaghY2 CP4/nWE+AKAE5TtsfHCOScRXNDDcFf8= X-MC-Unique: WKdJoSUOPDqrBcS-p-07RQ-1 X-Mimecast-MFC-AGG-ID: WKdJoSUOPDqrBcS-p-07RQ_1783940429 To: devel@lists.libvirt.org Subject: [PATCH v2 1/5] virsh: Add vshCompletePathLocalCreate completer for output paths Date: Mon, 13 Jul 2026 12:14:47 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: O1oECwKp9z-NtqnaQMvh6wEkxV9FkYwSVihUxmBzlhg_1783940429 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: R2AETK5ZIYJFRKJIGGZLLJ4XS6OEXR3D X-Message-ID-Hash: R2AETK5ZIYJFRKJIGGZLLJ4XS6OEXR3D X-MailFrom: rsmigiel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Radoslaw Smigielski X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Rados=C5=82aw_=C5=9Amigielski_via_Devel?= Reply-To: rsmigiel@redhat.com X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1783940519176158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Radoslaw Smigielski Add a completer callback for local file paths used as command output, where the target file may not exist yet. Use it for 'dump', 'save', and 'blockcopy' commands, and fix 'screenshot' to use it instead of vshCompletePathLocalExisting. Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9 Signed-off-by: Radoslaw Smigielski --- tools/virsh-domain.c | 5 ++++- tools/vsh-completer.c | 18 ++++++++++++++++++ tools/vsh-completer.h | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index aa4f2a7a481b..0a383ea40013 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2629,6 +2629,7 @@ static const vshCmdOptDef opts_blockcopy[] =3D { {.name =3D "dest", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, + .completer =3D vshCompletePathLocalCreate, .help =3D N_("path of the copy to create") }, {.name =3D "bandwidth", @@ -4651,6 +4652,7 @@ static const vshCmdOptDef opts_save[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, + .completer =3D vshCompletePathLocalCreate, .help =3D N_("where to save the data") }, {.name =3D "bypass-cache", @@ -5911,6 +5913,7 @@ static const vshCmdOptDef opts_dump[] =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, + .completer =3D vshCompletePathLocalCreate, .help =3D N_("where to dump the core") }, VIRSH_COMMON_OPT_LIVE(N_("perform a live core dump if supported")), @@ -6081,7 +6084,7 @@ static const vshCmdOptDef opts_screenshot[] =3D { {.name =3D "file", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, - .completer =3D vshCompletePathLocalExisting, + .completer =3D vshCompletePathLocalCreate, .help =3D N_("where to store the screenshot") }, {.name =3D "screen", diff --git a/tools/vsh-completer.c b/tools/vsh-completer.c index 8f0376879cdb..ba137ebe6c16 100644 --- a/tools/vsh-completer.c +++ b/tools/vsh-completer.c @@ -172,6 +172,24 @@ vshCompletePathLocalExisting(vshControl *ctl G_GNUC_UN= USED, } =20 =20 +/** + * vshCompletePathLocalCreate: + * + * Complete a path to local file used as output. + * The outout file may not exist yet. + * + * Note: For now this is a no-op. Readline does the correct thing + * and completes local files list. + */ +char ** +vshCompletePathLocalCreate(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int completerflags G_GNUC_UNUSED) +{ + return NULL; +} + + /** * vshCompleteEmpty: * diff --git a/tools/vsh-completer.h b/tools/vsh-completer.h index b479156062c0..5639974c0b86 100644 --- a/tools/vsh-completer.h +++ b/tools/vsh-completer.h @@ -35,6 +35,11 @@ vshCompletePathLocalExisting(vshControl *ctl, const vshCmd *cmd, unsigned int completerflags); =20 +char ** +vshCompletePathLocalCreate(vshControl *ctl, + const vshCmd *cmd, + unsigned int completerflags); + char ** vshCompleteEmpty(vshControl *ctl, const vshCmd *cmd, --=20 2.54.0 From nobody Tue Jul 14 21:21:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1783940664; cv=none; d=zohomail.com; s=zohoarc; b=PhMU8TvFXn3M+7WpbI5EHtGREg05T5kgq6T8ByE8mIGC4oC1zzhHrphg3QIfqu0fMjnGazQozOArNoJwv8h3c0klmBGpUQbNHyEV6dO3qt0k48dAM0edw31ZO56ZlZ+UMCbhAZb48UZVq2NGqCXhj/PtKRwpnlAOBuH5ocoWCcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783940664; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=FWsqrwW5gbMCJ1fVWrCXhaD+Am0P/09mc8meBlvihDE=; b=e2nryQFbeZcMGXddkwuajD1b4ht0DHg0mF6zxE1xl4degzLpyDRDjNl+vBGbFnMseyZLaytZEQM+xh8ixOpWYP1zis3DpNNdeQgRgSb2XUyWKNzd2kMgAcyg0q56QwEyfE+BbRY6MmZYHQnatXfvvsag4tM+QuNuLBASREtja3A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1783940664345276.72322514468874; Mon, 13 Jul 2026 04:04:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1AAC143FC2; Mon, 13 Jul 2026 07:04:22 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 8312643EA1; Mon, 13 Jul 2026 07:00:54 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id AD5834240B; Mon, 13 Jul 2026 07:00:35 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B38F142408 for ; Mon, 13 Jul 2026 07:00:34 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-LGEDclUsP2eIUmU5qMStag-1; Mon, 13 Jul 2026 07:00:31 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0F28C1801319 for ; Mon, 13 Jul 2026 11:00:31 +0000 (UTC) Received: from rsmigiel-thinkpadx1carbongen11-remote-csb.redhat.com (unknown [10.44.48.120]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 25AB136F33; Mon, 13 Jul 2026 11:00:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783940434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FWsqrwW5gbMCJ1fVWrCXhaD+Am0P/09mc8meBlvihDE=; b=D+ecFzJgeCvk/D4yszzago/AlHIa+4+1L5YwAvqDFhfNCWfTk+ednJLAiD8BXieSAuAgLK 5MN9/nK+1sO7bRZaSHnFzB+d9NvUp5QLLg9dDxxgy7YrTrlfRjpdWcSKS7sYUNIIjQDErD In1apt4TguhcPV3mOM5ZKOEMg2GXduE= X-MC-Unique: LGEDclUsP2eIUmU5qMStag-1 X-Mimecast-MFC-AGG-ID: LGEDclUsP2eIUmU5qMStag_1783940431 To: devel@lists.libvirt.org Subject: [PATCH v2 2/5] virsh: Add completer for '--type' option of 'domdisplay' command Date: Mon, 13 Jul 2026 12:14:48 +0200 Message-ID: <1524b25d9fc36c1282c4a6812c3a8bad9f9f54ef.1783937691.git.rsmigiel@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: PFa3SE8egzJE-PDqCPM9R9FMTib3uFIMfX8IpOAlh24_1783940431 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GAYI42DQNUSISAXQXEIA66RB5LS6GKPL X-Message-ID-Hash: GAYI42DQNUSISAXQXEIA66RB5LS6GKPL X-MailFrom: rsmigiel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Radoslaw Smigielski X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Rados=C5=82aw_=C5=9Amigielski_via_Devel?= Reply-To: rsmigiel@redhat.com X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1783940667339158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Radoslaw Smigielski The '--type' option of 'domdisplay' command selects a particular graphical display type. Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9 Signed-off-by: Radoslaw Smigielski --- tools/virsh-completer-domain.c | 12 ++++++++++++ tools/virsh-completer-domain.h | 5 +++++ tools/virsh-domain.c | 1 + 3 files changed, 18 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 8bdf68ac091d..afb080b868d7 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -1132,3 +1132,15 @@ virshDomainNetTypeCompleter(vshControl *ctl G_GNUC_U= NUSED, return vshEnumComplete(VIR_DOMAIN_NET_TYPE_LAST, virDomainNetTypeToString); } + + +char ** +virshDomainDisplayTypeCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + return vshEnumComplete(VIR_DOMAIN_GRAPHICS_TYPE_LAST, + virDomainGraphicsTypeToString); +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index dfbc10acaaa8..3aab7bedae20 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -204,3 +204,8 @@ char ** virshDomainNetTypeCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** +virshDomainDisplayTypeCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0a383ea40013..f15f686c7908 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12182,6 +12182,7 @@ static const vshCmdOptDef opts_domdisplay[] =3D { {.name =3D "type", .type =3D VSH_OT_STRING, .positional =3D true, + .completer =3D virshDomainDisplayTypeCompleter, .help =3D N_("select particular graphical display " "(e.g. \"vnc\", \"spice\", \"rdp\", \"dbus\")") }, --=20 2.54.0 From nobody Tue Jul 14 21:21:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1783940720; cv=none; d=zohomail.com; s=zohoarc; b=RDDGTsl1atueZlB3jQY6p4W+jR+UQ33dWmHFAbDGdIQnadjuRf5z1pTtBjqy1gWPWHuANoPakBLAekANl6ErsupMWF46+FjJJ4teIAtk0OqLHqdcGFp18r7SoaPORVr36c2II2IETBiQAnJ+wVBMhltUR8o0y8ywCPV4yIX6ul8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783940720; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=1ypLN9U+HpLNGlQ5vQM1bwMUKXKJXSU0naz9hefMnEk=; b=hB8YwUp6ZwfI4/k4AWPUex4LpTWME8Lx1iiy/v0H0BwYfKZdER3iCIh1Le612vPVjFy0iFfrVYhs5eRVkCWw3yXA0JP044H0FKeMkiZrNcsTjLcNziJgpQPMBRmxsiO+UfjH8xxTYAmn47I1M4+8ttCq8+tJ5LuzjCJKpC34/2U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1783940720757405.99819557315084; Mon, 13 Jul 2026 04:05:20 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8D6BC43F6F; Mon, 13 Jul 2026 07:05:19 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 0C1E744025; Mon, 13 Jul 2026 07:00:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B9E35423FB; Mon, 13 Jul 2026 07:00:35 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 337244240E for ; Mon, 13 Jul 2026 07:00:35 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-dE-sRRLTNiuH6Yt2u4dasw-1; Mon, 13 Jul 2026 07:00:33 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8337E1955D7D for ; Mon, 13 Jul 2026 11:00:32 +0000 (UTC) Received: from rsmigiel-thinkpadx1carbongen11-remote-csb.redhat.com (unknown [10.44.48.120]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 78DFD36F33; Mon, 13 Jul 2026 11:00:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783940434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1ypLN9U+HpLNGlQ5vQM1bwMUKXKJXSU0naz9hefMnEk=; b=SCS0rRefLBUQSQvRYQpHmQHy25zjNbfPHY3mwa8rVhKBy8+zb+LvC23dczEN+oDx7L/xSc xgOqg4L6Q2IMg2eIX23nBywKz3w5o1mEfWuhWeyrdfnrmA5XG041U0logrVSL0UQgfTZUb RZ+26gYcE4azFDyeAF+3EgFtef0AMYE= X-MC-Unique: dE-sRRLTNiuH6Yt2u4dasw-1 X-Mimecast-MFC-AGG-ID: dE-sRRLTNiuH6Yt2u4dasw_1783940432 To: devel@lists.libvirt.org Subject: [PATCH v2 3/5] virsh: Add completer for '--format' option of 'domxml-from-native' command Date: Mon, 13 Jul 2026 12:14:49 +0200 Message-ID: <8e2e0e10e84cee9dbf456f157eabf729778863a0.1783937691.git.rsmigiel@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dK4WcQxRYc5QCbBvbNZe85_pYcSvvyqoj9meJYpxWcE_1783940432 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: LCW5FPMFXFKEWUMNKTCY223OSLW4YRYV X-Message-ID-Hash: LCW5FPMFXFKEWUMNKTCY223OSLW4YRYV X-MailFrom: rsmigiel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Radoslaw Smigielski X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Rados=C5=82aw_=C5=9Amigielski_via_Devel?= Reply-To: rsmigiel@redhat.com X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1783940723829158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Radoslaw Smigielski The '--format' option of 'domxml-from-native' command specifies the native guest configuration format to import. Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9 Signed-off-by: Radoslaw Smigielski --- tools/virsh-completer-domain.c | 36 ++++++++++++++++++++++++++++++++++ tools/virsh-completer-domain.h | 5 +++++ tools/virsh-domain.c | 1 + 3 files changed, 42 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index afb080b868d7..65b02488bb39 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -1144,3 +1144,39 @@ virshDomainDisplayTypeCompleter(vshControl *ctl G_GN= UC_UNUSED, return vshEnumComplete(VIR_DOMAIN_GRAPHICS_TYPE_LAST, virDomainGraphicsTypeToString); } + + +char ** +virshDomainXMLNativeFormatCompleter(vshControl *ctl, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + virshControl *priv =3D ctl->privData; + const char *hvType =3D NULL; + const char **formats =3D NULL; + static const char *xenFormats[] =3D {"xen-xl", "xen-xm", NULL}; + static const char *lxcFormats[] =3D {"lxc-tools", NULL}; + static const char *vmxFormats[] =3D {"vmware-vmx", NULL}; + static const char *bhyveFormats[] =3D {"bhyve-argv", NULL}; + + virCheckFlags(0, NULL); + + if (!priv->conn || virConnectIsAlive(priv->conn) <=3D 0) + return NULL; + + if (!(hvType =3D virConnectGetType(priv->conn))) + return NULL; + + if (STREQ(hvType, "Xen")) + formats =3D xenFormats; + else if (STREQ(hvType, "LXC")) + formats =3D lxcFormats; + else if (STREQ(hvType, "VMware") || STREQ(hvType, "ESX")) + formats =3D vmxFormats; + else if (STREQ(hvType, "BHYVE")) + formats =3D bhyveFormats; + else + return NULL; + + return vshCommaStringListComplete(NULL, formats); +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index 3aab7bedae20..40de90afb79f 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -209,3 +209,8 @@ char ** virshDomainDisplayTypeCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** +virshDomainXMLNativeFormatCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f15f686c7908..c1c27433b0bf 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10917,6 +10917,7 @@ static const vshCmdOptDef opts_domxmlfromnative[] = =3D { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, + .completer =3D virshDomainXMLNativeFormatCompleter, .help =3D N_("source config data format") }, {.name =3D "config", --=20 2.54.0 From nobody Tue Jul 14 21:21:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1783940771; cv=none; d=zohomail.com; s=zohoarc; b=IExNvDBvuhJu+TNv4xtHJwh+7mFjS391yZkDfIWCqUAxwXscCO3r/Oab47N41U55nYNa1am8LKbiG7MXKsRfYrMSUA+vy6aqkLod4O2lzRfKbnVlae4NGV8CX0CIrKVieGIOMDpiX1398VjqarhWgu8IvwyCKr/5IhWJXMyDeRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783940771; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=Sme+GQHc1uOa6v6121AuNIQ/Z1C4yJ9Jins7QpL8fhA=; b=CL26Urr0y6gfeoUKe1ANmr7YDU0lx+ZKeS8G1AnZxKQsVBpqpQ4w98aYm644TREaTU0uE4UNFz5nlbUCfqI0goS7SmblfAgjpOiwvuVFxC9jtf9TXGJrZKWFg5s0hJ4IFRXoKICZgTUuczL3dKQm7xu4WzClcJTngWLvE45XTzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1783940771205550.6022667733799; Mon, 13 Jul 2026 04:06:11 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1564344046; Mon, 13 Jul 2026 07:06:10 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 987FF44068; Mon, 13 Jul 2026 07:01:03 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DF27642408; Mon, 13 Jul 2026 07:00:36 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3071F423FB for ; Mon, 13 Jul 2026 07:00:36 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-KmWm8QA5OkG6KJVBZ8nRvg-1; Mon, 13 Jul 2026 07:00:34 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D7B531955BC6 for ; Mon, 13 Jul 2026 11:00:33 +0000 (UTC) Received: from rsmigiel-thinkpadx1carbongen11-remote-csb.redhat.com (unknown [10.44.48.120]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC7EB1686; Mon, 13 Jul 2026 11:00:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783940435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sme+GQHc1uOa6v6121AuNIQ/Z1C4yJ9Jins7QpL8fhA=; b=LC+WjH/KZ5fDugV2qtilHTs3IAJf7BrNdY8kqpfdrK0Owj1YKH6OPPv9h+fGlFfFHzy8QC qi91Ho7v9VOf2oFL92i2riiRdeRuRwtEPRzFF5znKib29ESOjqPGBTHjKUBx7r2cqaOsMY yqNqcJOkwlKje/UTwE8ldcE5CcDWUPQ= X-MC-Unique: KmWm8QA5OkG6KJVBZ8nRvg-1 X-Mimecast-MFC-AGG-ID: KmWm8QA5OkG6KJVBZ8nRvg_1783940434 To: devel@lists.libvirt.org Subject: [PATCH v2 4/5] virsh: Add missing TAB completers for several options Date: Mon, 13 Jul 2026 12:14:50 +0200 Message-ID: <151e1d12b910904f5d1f6f54e68fe9ccdeca17a4.1783937691.git.rsmigiel@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7OZ8-GoTOgal-8QWbr6kl-OzlTXPvbNxLvX96eOGsy0_1783940434 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PHSJUJE6OZYAEV2CHOSYMFWR6EH6CQIR X-Message-ID-Hash: PHSJUJE6OZYAEV2CHOSYMFWR6EH6CQIR X-MailFrom: rsmigiel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Radoslaw Smigielski X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Rados=C5=82aw_=C5=9Amigielski_via_Devel?= Reply-To: rsmigiel@redhat.com X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1783940772164158501 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Radoslaw Smigielski Wire existing completers for 'domxml-to-native --format', 'vol-create-as --format', 'vol-create-as --backing-vol-format', and 'attach-disk --source-host-socket'. Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9 Signed-off-by: Radoslaw Smigielski --- tools/virsh-domain.c | 2 ++ tools/virsh-volume.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c1c27433b0bf..bd6c877b4521 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -521,6 +521,7 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "source-host-socket", .type =3D VSH_OT_STRING, + .completer =3D vshCompletePathLocalExisting, .help =3D N_("host socket for source of disk device") }, {.name =3D "throttle-groups", @@ -10968,6 +10969,7 @@ static const vshCmdOptDef opts_domxmltonative[] =3D= { .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, + .completer =3D virshDomainXMLNativeFormatCompleter, .help =3D N_("target config data type format") }, {.name =3D "domain", diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 7346d628d55d..21471e0496e9 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -197,6 +197,7 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { {.name =3D "format", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, + .completer =3D virshDomainStorageFileFormatCompleter, .help =3D N_("file format type raw,bochs,qcow,qcow2,qed,vmdk") }, {.name =3D "backing-vol", @@ -207,6 +208,7 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { {.name =3D "backing-vol-format", .type =3D VSH_OT_STRING, .unwanted_positional =3D true, + .completer =3D virshDomainStorageFileFormatCompleter, .help =3D N_("format of backing volume if taking a snapshot") }, {.name =3D "prealloc-metadata", --=20 2.54.0 From nobody Tue Jul 14 21:21:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1783940869; cv=none; d=zohomail.com; s=zohoarc; b=nRvHuzYM+Rutwh+Cstpuh2PeahlyZJ5Z9wK5GY8PRP3JcfCiI6iEHAUhLH27rqnB3xX/tgPUr5kTnUYrpMX+lIyEcISR86JLm2UZgZhjkOW9OQfPk/Rfr40q/YyRTXwVMrf6AThv2IXNNb/eeN2JJeiqr1ZuUCAXQkcvpJ5lXSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783940869; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=YF7vhEUYvU/0uy5HaEcBd595pGBUrd0yCh00KsE57cI=; b=nGvd37FE7XXYC+0RuVh9MnEuNwbHLhHYXNtyH/RJ4zWnmp/M9SHxiyfU9xuob9RyD2F2p//rqRNijK/chSlBsm5DikBHpodic1+AvvTo27w0fMqnWk6uq8ZODD/LynEFOIsiqpwAGqEjQVD3TcjpP1PoVCzFCvGtNtG572dx5Ds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1783940869103821.1154352637063; Mon, 13 Jul 2026 04:07:49 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DE4053F2F8; Mon, 13 Jul 2026 07:07:47 -0400 (EDT) Received: from [172.19.199.10] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 828D4440BA; Mon, 13 Jul 2026 07:01:09 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 414484404C; Mon, 13 Jul 2026 07:01:01 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3F1E843EB1 for ; Mon, 13 Jul 2026 07:00:39 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-3AnCNkqiPRuEGar-9Vg8AA-1; Mon, 13 Jul 2026 07:00:36 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4D8461805C19 for ; Mon, 13 Jul 2026 11:00:35 +0000 (UTC) Received: from rsmigiel-thinkpadx1carbongen11-remote-csb.redhat.com (unknown [10.44.48.120]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 637B536F29; Mon, 13 Jul 2026 11:00:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783940438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YF7vhEUYvU/0uy5HaEcBd595pGBUrd0yCh00KsE57cI=; b=VL4rc/dXpeq9/Fd4JcSIWBGqZeuFJgjN+CX6k07vu6JEXtjeByNw8xm04eY3vULdzOgHAl Oo+Rfsrapv41JKg7+A73OByWUmAwe9YfsNwXl59mrqyeqAIbpSwW6plPL1O8ULTortNbKJ aDaK/FyeeYUIzqvjQWmaqErItsRg2Ac= X-MC-Unique: 3AnCNkqiPRuEGar-9Vg8AA-1 X-Mimecast-MFC-AGG-ID: 3AnCNkqiPRuEGar-9Vg8AA_1783940435 To: devel@lists.libvirt.org Subject: [PATCH v2 5/5] virsh: Add missing TAB completers for 'attach-disk' command Date: Mon, 13 Jul 2026 12:14:51 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 7CxBi83vCXAmw54mcHDhCs6EZAdIfQT9qhQX8I6qAVM_1783940435 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: R6NBTT347ASVPBHSOX67UIPZ4V4G7PTH X-Message-ID-Hash: R6NBTT347ASVPBHSOX67UIPZ4V4G7PTH X-MailFrom: rsmigiel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Radoslaw Smigielski X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Rados=C5=82aw_=C5=9Amigielski_via_Devel?= Reply-To: rsmigiel@redhat.com X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1783940873033158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Radoslaw Smigielski Add enum and static-list completers for 'attach-disk' options targetbus, type, cache, io, mode, and sourcetype, and reuse the existing storage file format completer for subdriver. Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9 Signed-off-by: Radoslaw Smigielski --- tools/virsh-completer-domain.c | 74 ++++++++++++++++++++++++++++++++++ tools/virsh-completer-domain.h | 30 ++++++++++++++ tools/virsh-domain.c | 7 ++++ 3 files changed, 111 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 65b02488bb39..7251d70e997e 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -1180,3 +1180,77 @@ virshDomainXMLNativeFormatCompleter(vshControl *ctl, =20 return vshCommaStringListComplete(NULL, formats); } + + +char ** +virshDomainDiskBusCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + return vshEnumComplete(VIR_DOMAIN_DISK_BUS_LAST, + virDomainDiskBusTypeToString); +} + + +char ** +virshDomainDiskDeviceTypeCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + return vshEnumComplete(VIR_DOMAIN_DISK_DEVICE_LAST, + virDomainDiskDeviceTypeToString); +} + + +char ** +virshDomainDiskCacheCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + return vshEnumComplete(VIR_DOMAIN_DISK_CACHE_LAST, + virDomainDiskCacheTypeToString); +} + + +char ** +virshDomainDiskIoCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + virCheckFlags(0, NULL); + + return vshEnumComplete(VIR_DOMAIN_DISK_IO_LAST, + virDomainDiskIoTypeToString); +} + + +char ** +virshDomainAttachDiskModeCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + static const char *modes[] =3D {"readonly", "shareable", NULL}; + + virCheckFlags(0, NULL); + + return vshCommaStringListComplete(NULL, modes); +} + + +char ** +virshDomainAttachDiskSourceTypeCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + static const char *types[] =3D {"file", "block", "network", NULL}; + + virCheckFlags(0, NULL); + + return vshCommaStringListComplete(NULL, types); +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index 40de90afb79f..aa2e82649071 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -214,3 +214,33 @@ char ** virshDomainXMLNativeFormatCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** +virshDomainDiskBusCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + +char ** +virshDomainDiskDeviceTypeCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + +char ** +virshDomainDiskCacheCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + +char ** +virshDomainDiskIoCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + +char ** +virshDomainAttachDiskModeCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); + +char ** +virshDomainAttachDiskSourceTypeCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bd6c877b4521..ca35e3b7b214 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -435,6 +435,7 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "targetbus", .type =3D VSH_OT_STRING, + .completer =3D virshDomainDiskBusCompleter, .help =3D N_("target bus of disk device") }, {.name =3D "driver", @@ -443,6 +444,7 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "subdriver", .type =3D VSH_OT_STRING, + .completer =3D virshDomainStorageFileFormatCompleter, .help =3D N_("subdriver of disk device") }, {.name =3D "iothread", @@ -452,14 +454,17 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "cache", .type =3D VSH_OT_STRING, + .completer =3D virshDomainDiskCacheCompleter, .help =3D N_("cache mode of disk device") }, {.name =3D "io", .type =3D VSH_OT_STRING, + .completer =3D virshDomainDiskIoCompleter, .help =3D N_("io policy of disk device") }, {.name =3D "type", .type =3D VSH_OT_STRING, + .completer =3D virshDomainDiskDeviceTypeCompleter, .help =3D N_("target device type") }, {.name =3D "shareable", @@ -468,10 +473,12 @@ static const vshCmdOptDef opts_attach_disk[] =3D { }, {.name =3D "mode", .type =3D VSH_OT_STRING, + .completer =3D virshDomainAttachDiskModeCompleter, .help =3D N_("mode of device reading and writing") }, {.name =3D "sourcetype", .type =3D VSH_OT_STRING, + .completer =3D virshDomainAttachDiskSourceTypeCompleter, .help =3D N_("type of source (block|file|network)") }, {.name =3D "serial", --=20 2.54.0