From nobody Mon Feb 9 20:59:22 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=1614724332; cv=none; d=zohomail.com; s=zohoarc; b=Atl7eH2aEaYzFqcT1UbXnxGWQWdDy3LKEEHh6ZoaJv3oQ2gJyIXyYsP8roiYbaff5cHmwxyYkVQdvPNU+B+Eup9H/v0HBuYwnX1Ig7fLWfqjjGQiQzfOSyduqZo+txPsCFL7aCsU0CmVa2Ky63Db9zbqS1d1MILFMGlsZW74Ke8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614724332; 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=p4/q4cZsEU3MV2yWRCNaV5jOgQpInmTX7a7sikyIiUg=; b=OyMwuWZO3PGfK/dZxEHyIsD9EVO+t2cRAlH89POoXSd1+xIaom8mF1C+bARDrlfpUhmV4YP4Qt7gHKLqMT3+8QpOHURrol9L/7+6oob0FCDASoPA/wGcJD2I1COsyWKVLur+xbYCVWPpDRidJktCIEE1EZuM19L1ppL75kHCyt4= 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) header.from= 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 1614724332722239.69837837782848; Tue, 2 Mar 2021 14:32:12 -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-385-VV4vXZ8jPESt9sBfE6Io9w-1; Tue, 02 Mar 2021 17:32:09 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EF8880196C; Tue, 2 Mar 2021 22:32:03 +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 D7A42100AE2F; Tue, 2 Mar 2021 22:32:02 +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 97E9318077D9; Tue, 2 Mar 2021 22:32:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 122MVIx0007902 for ; Tue, 2 Mar 2021 17:31:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id C295A60C6D; Tue, 2 Mar 2021 22:31:18 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-115-28.phx2.redhat.com [10.3.115.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CA8B60BFA; Tue, 2 Mar 2021 22:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614724331; 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=p4/q4cZsEU3MV2yWRCNaV5jOgQpInmTX7a7sikyIiUg=; b=NRWOda7MRikbAsfZZfVRNzAOYBss0tFdXlVLEHzia/hvZinlD6fBiMyurf39UnFsczysQn 6LnLGlIv/MNr0XWGdz4UnnIBLLFxsh7K+gNBa7GJ52cLQMpxJCnkcDwAS/ODgTK5Sdye8E nOdAwBkf1O1J2NvemZPEHNgZuH4pFkk= X-MC-Unique: VV4vXZ8jPESt9sBfE6Io9w-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v5 24/30] virsh: add "nodedev-start" command Date: Tue, 2 Mar 2021 16:30:59 -0600 Message-Id: <20210302223105.314580-25-jjongsma@redhat.com> In-Reply-To: <20210302223105.314580-1-jjongsma@redhat.com> References: <20210302223105.314580-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: eskultet@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.84 on 10.5.11.22 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) 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 Reviewed-by: Erik Skultety --- tools/virsh-nodedev.c | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index fda955988b..5254142825 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -1112,6 +1112,57 @@ 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 an inactive node device") + }, + {.name =3D "desc", + .data =3D N_("Starts an inactive node device that was previously defi= ned") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_node_device_start[] =3D { + {.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, @@ -1177,5 +1228,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.26.2