From nobody Mon Feb 9 15:26:35 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com 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 1623717662405340.83602978493525; Mon, 14 Jun 2021 17:41:02 -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-397-BfiOHf_MPNOf84H2gXKQJw-1; Mon, 14 Jun 2021 20:40:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3CCE6100C666; Tue, 15 Jun 2021 00:40:53 +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 088AB9808; Tue, 15 Jun 2021 00:40:53 +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 C629746F58; Tue, 15 Jun 2021 00:40:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15F0dQbR001891 for ; Mon, 14 Jun 2021 20:39:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id C649A218B1FB; Tue, 15 Jun 2021 00:39:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C1A33218ADFF for ; Tue, 15 Jun 2021 00:39:26 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 87472802C15 for ; Tue, 15 Jun 2021 00:39:26 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-73-NBMhat8mNyWtEDGESvlQ_A-1; Mon, 14 Jun 2021 20:39:24 -0400 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2054.outbound.protection.outlook.com [104.47.9.54]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-18-drJsHlvqNwKd7VWXKl8apw-1; Tue, 15 Jun 2021 02:39:21 +0200 Received: from AM9PR04MB8602.eurprd04.prod.outlook.com (2603:10a6:20b:439::12) by AM9PR04MB9013.eurprd04.prod.outlook.com (2603:10a6:20b:409::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Tue, 15 Jun 2021 00:39:20 +0000 Received: from AM9PR04MB8602.eurprd04.prod.outlook.com ([fe80::cd4e:6cc0:8021:f249]) by AM9PR04MB8602.eurprd04.prod.outlook.com ([fe80::cd4e:6cc0:8021:f249%4]) with mapi id 15.20.4219.025; Tue, 15 Jun 2021 00:39:20 +0000 Received: from localhost (139.212.198.59) by HKAPR03CA0017.apcprd03.prod.outlook.com (2603:1096:203:c8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Tue, 15 Jun 2021 00:39:19 +0000 X-MC-Unique: BfiOHf_MPNOf84H2gXKQJw-1 X-MC-Unique: NBMhat8mNyWtEDGESvlQ_A-1 X-MC-Unique: drJsHlvqNwKd7VWXKl8apw-1 From: Lin Ma To: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] virsh: Add format completion to blockcopy command Date: Tue, 15 Jun 2021 08:38:26 +0800 Message-ID: <20210615003832.5571-7-lma@suse.com> In-Reply-To: <20210615003832.5571-1-lma@suse.com> References: <20210615003832.5571-1-lma@suse.com> X-Originating-IP: [139.212.198.59] X-ClientProxiedBy: HKAPR03CA0017.apcprd03.prod.outlook.com (2603:1096:203:c8::22) To AM9PR04MB8602.eurprd04.prod.outlook.com (2603:10a6:20b:439::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e5b35b7-14da-4145-e557-08d92f9603bc X-MS-TrafficTypeDiagnostic: AM9PR04MB9013: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: GtYD+izXZOI5/aRbwU/CBvBifB/n3TFAQnKhOXKfCHaF5Ng9s51a5BvIVJ69OWjCn9g2R5ghaUXYgvB3jAcdkKdWfSeJfZwmD5sZksqJMMJIWPAjmZTiwRVDNvl3UTAfLgpINPe753EZOjRaLymFd2JUt1e2FMt+HX1+Lpb6A8xSv3VvsFi5b2x2lrlwDw3suvvYegmvMhZyWyRol5HBk80vlIUm3Bm/LlIX4BErl5FqDUyimToMNr2yNlh4KIAC4DdAfMHj1fuju+rHdsLnimO/F2J3ykX6BEylfmbudCaK17yxYtQESFAAfjxT7XgJUcSD/vDH64H3gve9ITcgeccBzN+4Ze5kITaCU4v9AO/i+sE9ngFjTuYvBhb3MT5J0iZjG+vj/VSAV6HaLqjcEnbAHlGQAWuwmCenAeaJPXVThNqaakfi3Xon6fMglFLxnIWUzHSNsNa/PXRYOz2Xlf1lVrPRWbapA6XhWpUFRwdcFhGwyTXSxsAExl+ovdrmKT5y9JCntDc+nklKfRtHYJU9YkwRov4rHNs9wfHoWSht7lrpzw9R6KSlRO21/nZYnjJoi58APFU6ck//5cVaqL4vjpLN1DQB0IE1uA9TU50= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8602.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(346002)(366004)(376002)(136003)(396003)(107886003)(186003)(16526019)(36756003)(6486002)(4326008)(478600001)(316002)(5660300002)(83380400001)(66946007)(66476007)(66556008)(6916009)(86362001)(38100700002)(8936002)(26005)(450100002)(956004)(1076003)(6496006)(2616005)(6666004)(8676002)(2906002); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?oA7qkkG1g6rRnU++BbNLQY2SilAE4Q0fT4bihKd4X33JFyx94XhE440NfSfe?= =?us-ascii?Q?/clq4YsfLIbeth3ENm6C5alreMdIktfZv5XaXMpqjT022Mc+2F4efn03oEDb?= =?us-ascii?Q?QeabtW/ifCnpOlIy5a1oAS6wFOrIId6nh2PDmSqYCXPM175Op/JpIEiB9reO?= =?us-ascii?Q?ggSM3ykno34r48PYD9FZFSG+GGFNLtuqve2L3hW2cO7rj5tfMeBUkxiNpb2A?= =?us-ascii?Q?6c0yI8PcksSqBEkAWch6N1uhTDtoHCXmomyRXNTrjIOZkdWg3txLRKsXPWKu?= =?us-ascii?Q?G3Ynwr78CT9SIliCiDd0d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=?us-ascii?Q?OSCYR7nOWHJWkJJ3ljkHGV5XP4PQfgIO010KdsVz51JRdHDCSPTMG6b9Xdij?= =?us-ascii?Q?m27By99y/dp6SZMDlsw/7wTW+wudU+LEMR6vRxJsFlDfhvtS020CMbxUFwQS?= =?us-ascii?Q?A3evvNEH7a1vM5MzV0gd5OeP?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e5b35b7-14da-4145-e557-08d92f9603bc X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8602.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2021 00:39:20.7073 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AH2yN/vLPGnYE+c+YnAAP1cF3Mm5XXl/k3sv+q+K3tFSOMnt/S5mHIfDeJ97fsht X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB9013 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 15F0dQbR001891 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Lin Ma 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.84 on 10.5.11.23 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 Content-Type: text/plain; charset="utf-8" Signed-off-by: Lin Ma --- tools/virsh-completer-domain.c | 20 ++++++++++++++++++++ tools/virsh-completer-domain.h | 6 ++++++ tools/virsh-domain.c | 2 ++ 3 files changed, 28 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 256ac0b593..14e4d95ec3 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -35,6 +35,7 @@ #include "virkeynametable_linux.h" #include "virkeynametable_osx.h" #include "virkeynametable_win32.h" +#include "conf/storage_conf.h" =20 char ** virshDomainNameCompleter(vshControl *ctl, @@ -976,3 +977,22 @@ virshDomainMigrateCompMethodsCompleter(vshControl *ctl, =20 return virshCommaStringListComplete(method, methods); } + + +char ** +virshDomainStorageFileFormatCompleter(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int flags) +{ + char **ret =3D NULL; + size_t i; + + virCheckFlags(0, NULL); + + ret =3D g_new0(char *, VIR_STORAGE_FILE_LAST + 1); + + for (i =3D 0; i < VIR_STORAGE_FILE_LAST; i++) + ret[i] =3D g_strdup(virStorageFileFormatTypeToString(i)); + + return ret; +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index 5d56090504..45380906f9 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -132,3 +132,9 @@ char ** virshDomainMigrateCompMethodsCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + + +char ** +virshDomainStorageFileFormatCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index b3aa52b8a8..183f53f913 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2235,6 +2235,8 @@ static const vshCmdOptDef opts_blockcopy[] =3D { }, {.name =3D "format", .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_NONE, + .completer =3D virshDomainStorageFileFormatCompleter, .help =3D N_("format of the destination file") }, {.name =3D "granularity", --=20 2.26.2