From nobody Mon Feb 9 12:15:27 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594938256; cv=none; d=zohomail.com; s=zohoarc; b=Ij65UvGJOvyBjGjnBjgy83ZHeKiCvgXmIJWFP20qUfroEFyJ+mbtyH3n0PTLGKEdDhIcMReqZpVWa5RkK8E/F3WN+KUgrjFGMH31jH69VGLt9MrgB2eWTAui9TvBjAi3exvsAdmjA2CvKgNV7zrqEHjbe6KE4L51M0TsTAm3HKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594938256; 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=cm+XhgEsrz0tst1cfixoIP5yHvgGuR1Iv6q8FCSuf14=; b=DppLOOlDGAL8Y2bRtNw3Lg1dWDFJr51lDYG9T7mxoA666W335GSQD0IITZ4uKUENngFIAJGhVNKVnf2ficodTWXZ2K1zZZ5nYbvgtnFE0rm5HZZ0vxzFxaxTiNLbPy9NOtNZK54LCK6Zmfg1rC2oUmznOrtSB19Hqy7YDMPtAFU= 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; dmarc=pass header.from= (p=none dis=none) header.from= 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 1594938256029442.6336178840751; Thu, 16 Jul 2020 15:24:16 -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-135-rFiy9bcXPpKaXu6-RKl01g-1; Thu, 16 Jul 2020 18:22:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8099E108B; Thu, 16 Jul 2020 22:22:27 +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 5F7E860E3E; Thu, 16 Jul 2020 22:22:27 +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 0C14E180BACF; Thu, 16 Jul 2020 22:22:27 +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 06GMLtED022352 for ; Thu, 16 Jul 2020 18:21:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 506646FED1; Thu, 16 Jul 2020 22:21:55 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-112-38.phx2.redhat.com [10.3.112.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2203C724B8 for ; Thu, 16 Jul 2020 22:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594938254; 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=cm+XhgEsrz0tst1cfixoIP5yHvgGuR1Iv6q8FCSuf14=; b=ZGylPLFOUO2AhtQEKjfkfgD9UrWx8epLtHeyHerjmjWc3FEwlI6rpEujcNBb++srAtxcBf uoDDGeOEIqirejMQQfVsFv1kxlkhd76VYhs/cuWIwTN2snu/jhsP2JcFM+qLoZhpCeH/Et 0yorgPEzl8iIZ3LxBR/J01rAFCP/H8M= X-MC-Unique: rFiy9bcXPpKaXu6-RKl01g-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 16/16] virsh: add "nodedev-start" command Date: Thu, 16 Jul 2020 17:21:46 -0500 Message-Id: <20200716222146.1241-17-jjongsma@redhat.com> In-Reply-To: <20200716222146.1241-1-jjongsma@redhat.com> References: <20200716222146.1241-1-jjongsma@redhat.com> 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.12 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" This virsh command maps to virNodeDeviceCreate(), which starts a node device that has been previously defined by virNodeDeviceDefineXML(). This is only supported for mediated devices. Signed-off-by: Jonathon Jongsma --- tools/virsh-nodedev.c | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 2f984e8738..e4bcf62d09 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -1114,6 +1114,61 @@ cmdNodeDeviceDefine(vshControl *ctl, const vshCmd *c= md G_GNUC_UNUSED) } =20 =20 +/* + * "nodedev-start" command + */ +static const vshCmdInfo info_node_device_start[] =3D { + {.name =3D "help", + .data =3D N_("Start a previously defined inactive node device") + }, + {.name =3D "desc", + .data =3D N_("Starts the configuration for an inactive node device") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_node_device_start[] =3D { + {.name =3D "name", + .type =3D VSH_OT_ALIAS, + .help =3D "device" + }, + {.name =3D "device", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("device name"), + .completer =3D virshNodeDeviceNameCompleter, + }, + {.name =3D NULL} +}; + +static bool +cmdNodeDeviceStart(vshControl *ctl, const vshCmd *cmd) +{ + const char *name =3D NULL; + virNodeDevicePtr device; + bool ret =3D true; + virshControlPtr priv =3D ctl->privData; + + if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0) + return false; + + if (!(device =3D virNodeDeviceLookupByName(priv->conn, name))) { + vshError(ctl, _("Could not find matching device '%s'"), name); + return false; + } + + if (virNodeDeviceCreate(device) =3D=3D 0) { + vshPrintExtra(ctl, _("Device %s started\n"), name); + } else { + vshError(ctl, _("Failed to start device %s"), name); + ret =3D false; + } + + virNodeDeviceFree(device); + return ret; +} + + const vshCmdDef nodedevCmds[] =3D { {.name =3D "nodedev-create", .handler =3D cmdNodeDeviceCreate, @@ -1179,5 +1234,11 @@ const vshCmdDef nodedevCmds[] =3D { .info =3D info_node_device_undefine, .flags =3D 0 }, + {.name =3D "nodedev-start", + .handler =3D cmdNodeDeviceStart, + .opts =3D opts_node_device_start, + .info =3D info_node_device_start, + .flags =3D 0 + }, {.name =3D NULL} }; --=20 2.21.3