From nobody Tue Feb 10 06:43:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1597762123; cv=none; d=zohomail.com; s=zohoarc; b=dAxNu5swtne4/MORE5QNBEiMMjc7QjhRxs2dw9r3VSZ7gxHZUOESlZeGZcSMaMbEk0NjQ7jD0dv7xauM6KjYOVlIF4W7dnWfkqBG/KYnJwjSNOiHkD6dXCzy8LSHYWoyqnRtjMvbKXEIzz0MqhF6sVuzneEjObl9JFLiW86+exs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597762123; 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=2tc68zbhlnCF6NnmT0MnKHV+5FwKMJ8m/veS8+Zxuqc=; b=FkTyfquCh9wXmEV86hiymW65ECRCJErrlJPAhWbSe9qSs9wg744FX6D3Yc7rj3do3ojH1RPshLRz/0w38AJBiUkwKP7L+GMqiJjKOIezFoSTjYX5drmaeWhIDktgImH0T1gBc2xJy/J5B69adcyWdtYzBDVNsi/Hy846+DkYyRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 159776212376935.338731251313106; Tue, 18 Aug 2020 07:48:43 -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-152-KHZaca0GPT-rCsq5W3ZvuQ-1; Tue, 18 Aug 2020 10:48:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CD7F18686D0; Tue, 18 Aug 2020 14:48:34 +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 E00495D757; Tue, 18 Aug 2020 14:48:33 +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 A6849181A71F; Tue, 18 Aug 2020 14:48:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07IEmGh1002846 for ; Tue, 18 Aug 2020 10:48:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 175087DFC0; Tue, 18 Aug 2020 14:48:16 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-237.phx2.redhat.com [10.3.113.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEEB65D757; Tue, 18 Aug 2020 14:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597762122; 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=2tc68zbhlnCF6NnmT0MnKHV+5FwKMJ8m/veS8+Zxuqc=; b=NI5M8YpG4OVMA347Bae+JzbuqrqmzqQYXQqY6z8xEI1ofBFM7UdtTBtIG6uAnFKvryFtPj 1OsB+4NN+M85BvabbFlbLnk01hUvG3fFUuBPD4tc/zAgOdBndTipJuzFb2pj9socLvVHEh HyMF/j8/wFGRciUjnc3qR5kO1npIEbA= X-MC-Unique: KHZaca0GPT-rCsq5W3ZvuQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v2 16/16] virsh: add "nodedev-start" command Date: Tue, 18 Aug 2020 09:48:06 -0500 Message-Id: <20200818144806.134738-17-jjongsma@redhat.com> In-Reply-To: <20200818144806.134738-1-jjongsma@redhat.com> References: <20200818144806.134738-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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 db56fbc5e9..eea576ff89 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -1113,6 +1113,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, @@ -1178,5 +1233,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