From nobody Wed Feb 11 03:03:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583580748; cv=none; d=zohomail.com; s=zohoarc; b=eWzPQcaINVxjfjthy/SzvTcD1cXjOjZe+vFg3ETOxKKr7H66oGfkccgD4pSzBNvbigvV5qNmmWWteV/8tjPzuBTat3r6XuxgVFo8OKW6LosyFhtPxZjNDYAyzgQmpq9J+sqaXZin1O143BJtZ7IYpwMT+f9EXidy8OqYZH6WWV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583580748; h=Content-Type:Content-Transfer-Encoding:Cc: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=X922RFvsBlxuAJevYbT41077HY5FO5quHk2VfDpd5tw=; b=YCL1CGBmDGGx4swdtRE305o0N8el5P31n2YIADKws/LlTkbxQyPVwsR1qr32RnGpU8QyndhRucJMAfj8LX6y/u46MMlwadymQMAiX4knW5117lz2Kg90Wbvp8Ul3hs51HhMSYV2tU7TnVPC4QdHBaq39dxnK42VILPyhLz4gIFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1583580748540647.8832179564328; Sat, 7 Mar 2020 03:32:28 -0800 (PST) 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-327-CXTJSFF6M7G01GBfyvLpoA-1; Sat, 07 Mar 2020 06:32:25 -0500 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 59D3F107ACC4; Sat, 7 Mar 2020 11:32:19 +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 6C96D91D94; Sat, 7 Mar 2020 11:32:18 +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 E84BE18095FF; Sat, 7 Mar 2020 11:32:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 027BW9kI001036 for ; Sat, 7 Mar 2020 06:32:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2AE3A2038B80; Sat, 7 Mar 2020 11:32:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 244A42026D68 for ; Sat, 7 Mar 2020 11:32:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DEC780066D for ; Sat, 7 Mar 2020 11:32:06 +0000 (UTC) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-Dh92yhGzOLqmTTZaibGLeA-1; Sat, 07 Mar 2020 06:32:03 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id EF6ED61530B4E81A7B1D for ; Sat, 7 Mar 2020 19:31:59 +0800 (CST) Received: from huawei.com (10.133.210.227) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Sat, 7 Mar 2020 19:31:53 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583580747; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=X922RFvsBlxuAJevYbT41077HY5FO5quHk2VfDpd5tw=; b=cgTJ91DXgON2ZWuJHwT8cgGx0QCaC5vQCp4sj7p/i3yza4B9Az0WjoVXm0K/ucShK2z6ih g48GXe/EgJvIsc+6KR6rFQWLHk+x7kqRngkwVHSzpGGneEn8PTDA22g9YAx8/MVJghwNg5 OXrl+pzodyfxoX0h8Ml120ncYkOQhHc= X-MC-Unique: CXTJSFF6M7G01GBfyvLpoA-1 X-MC-Unique: Dh92yhGzOLqmTTZaibGLeA-1 From: Zhang Bo To: Subject: [PATCHv2 4/5] virt-admin: Introduce command srv-update-tls Date: Sat, 7 Mar 2020 19:31:03 +0800 Message-ID: <20200307113104.722-5-oscar.zhangbo@huawei.com> In-Reply-To: <20200307113104.722-1-oscar.zhangbo@huawei.com> References: <20200307113104.722-1-oscar.zhangbo@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.133.210.227] X-CFilter-Loop: Reflected X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 027BW9kI001036 X-loop: libvir-list@redhat.com Cc: Zhang Bo , dengkai1@huawei.com, wujing42@huawei.com, wuqingliang4@huawei.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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" wire-up virAdmServerUpdateTlsFiles API into virt-admin client. --- tools/virt-admin.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 32edfe5757..a8e5e0a5af 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -957,6 +957,60 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) goto cleanup; } =20 +/* ------------------------ + * Command srv-update-tls + * ------------------------ + */ +static const vshCmdInfo info_srv_update_tls_file[] =3D { + {.name =3D "help", + .data =3D N_("notify server to update TLS related files online.") + }, + {.name =3D "desc", + .data =3D N_("notify server to update the CA cert, " + "CA CRL, server cert / key without restarts. " + "See OPTIONS for currently supported attributes.") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_srv_update_tls_file[] =3D { + {.name =3D "server", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("Available servers on a daemon. " + "Currently only supports 'libvirtd'.") + }, + {.name =3D NULL} +}; + +static bool +cmdSrvUpdateTlsFiles(vshControl *ctl, const vshCmd *cmd) +{ + bool ret =3D false; + const char *srvname =3D NULL; + + virAdmServerPtr srv =3D NULL; + vshAdmControlPtr priv =3D ctl->privData; + + if (vshCommandOptStringReq(ctl, cmd, "server", &srvname) < 0) + return false; + + if (!(srv =3D virAdmConnectLookupServer(priv->conn, srvname, 0))) + goto cleanup; + + if (virAdmServerUpdateTlsFiles(srv, 0) < 0) { + vshError(ctl, "%s", _("Unable to update server's tls related files= .")); + goto cleanup; + } + + ret =3D true; + vshPrint(ctl, "update tls related files succeed\n"); + + cleanup: + virAdmServerFree(srv); + return ret; +} + /* -------------------------- * Command daemon-log-filters * -------------------------- @@ -1436,6 +1490,16 @@ static const vshCmdDef managementCmds[] =3D { .info =3D info_srv_clients_set, .flags =3D 0 }, + {.name =3D "srv-update-tls", + .flags =3D VSH_CMD_FLAG_ALIAS, + .alias =3D "server-update-tls" + }, + {.name =3D "server-update-tls", + .handler =3D cmdSrvUpdateTlsFiles, + .opts =3D opts_srv_update_tls_file, + .info =3D info_srv_update_tls_file, + .flags =3D 0 + }, {.name =3D "daemon-log-filters", .handler =3D cmdDaemonLogFilters, .opts =3D opts_daemon_log_filters, --=20 2.23.0.windows.1