From nobody Mon Feb 9 19:06:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1629498928; cv=none; d=zohomail.com; s=zohoarc; b=UwA1Pp6Q+c4aj2AG9t5U+LO2DP8NyrJPwcVO9dv9RWU7e4WG1TlgsfNQfDvrkcrL30A9lqtGfMLWmoz6Atc70/aM6poapO1KSujNX4PAAaf236SKpVVnSoeb1V+bqZqrKxEQGFVjmu9AGqYcDkNfUGyRJDovKxEMY3v7KLOngIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629498928; 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=mWocI7j3vAnFDj0gN77u7Qy0XQP+cC5U0qlO1bhHEew=; b=KYo1+wNZe+tL06ruLofOtIwpEM3eAaQJQubYHLhGvXuZoCCKm3BGC8RY516GL0kRt15F1uRcLHE13Qn8FtUUpDGbS3eng1uxbQTWuW3ljWhqxTkK8PGBH4Gupw3cP6yiTS9SQlXMBwYD9fLykSs7DH2qrN3EhAE951UbmYxL1G4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629498928711207.3625188863175; Fri, 20 Aug 2021 15:35:28 -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-500-CaP_FD1TOISGJbdK3EEKLw-1; Fri, 20 Aug 2021 18:35:25 -0400 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 1443C1082921; Fri, 20 Aug 2021 22:35:20 +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 E2F9F10190AA; Fri, 20 Aug 2021 22:35:19 +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 AB4804A707; Fri, 20 Aug 2021 22:35:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17KMThpB028183 for ; Fri, 20 Aug 2021 18:29:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 389521971B; Fri, 20 Aug 2021 22:29:43 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-114-57.phx2.redhat.com [10.3.114.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF3EF1A26A; Fri, 20 Aug 2021 22:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629498927; 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=mWocI7j3vAnFDj0gN77u7Qy0XQP+cC5U0qlO1bhHEew=; b=TS7FM/85E0CRgKa6TXvio3EKu9fT8aHbIj5D48gPqsWniBFxcw0p7jAYboE6goxvrPRuAR uR4yNb56q5+i4jPosLyNd/lXmoTO1HeffypML4lmoenLwkY51+Nnx/gNpQEcDl85qc7Xbq bbcxte/XmTNuI6hNumQql92CAALI4Qw= X-MC-Unique: CaP_FD1TOISGJbdK3EEKLw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v3 7/7] virsh: add nodedev-info Date: Fri, 20 Aug 2021 17:29:35 -0500 Message-Id: <20210820222935.3414029-8-jjongsma@redhat.com> In-Reply-To: <20210820222935.3414029-1-jjongsma@redhat.com> References: <20210820222935.3414029-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629498930739100001 This is currently the only way to view the 'autostart' property for a node device in virsh. Signed-off-by: Jonathon Jongsma Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/manpages/virsh.rst | 12 ++++++++ tools/virsh-nodedev.c | 68 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 08097a45bf..af8c4cb9eb 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -5057,6 +5057,18 @@ be either device name or wwn pair in "wwnn,wwpn" for= mat (only works for HBA). =20 =20 +nodedev-info +------------ + +**Syntax:** + +:: + + nodedev-info device + +Returns basic information about the *device* object. + + nodedev-list ------------ =20 diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 0a70029fc7..f1b4eb94bf 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -1218,6 +1218,68 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd= *cmd) } =20 =20 +/* + * "nodedev-info" command + */ +static const vshCmdInfo info_node_device_info[] =3D { + {.name =3D "help", + .data =3D N_("node device information") + }, + {.name =3D "desc", + .data =3D N_("Returns basic information about the node device") + }, + {.name =3D NULL} +}; + + +static const vshCmdOptDef opts_node_device_info[] =3D { + {.name =3D "device", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("device name or wwn pair in 'wwnn,wwpn' format"), + .completer =3D virshNodeDeviceNameCompleter, + }, + {.name =3D NULL} +}; + +static bool +cmdNodeDeviceInfo(vshControl *ctl, const vshCmd *cmd) +{ + virNodeDevicePtr device =3D NULL; + const char *device_value =3D NULL; + bool ret =3D false; + int autostart; + const char *parent =3D NULL; + + if (vshCommandOptStringReq(ctl, cmd, "device", &device_value) < 0) + return false; + + device =3D vshFindNodeDevice(ctl, device_value); + + if (!device) + goto cleanup; + + parent =3D virNodeDeviceGetParent(device); + vshPrint(ctl, "%-15s %s\n", _("Name:"), virNodeDeviceGetName(device)); + vshPrint(ctl, "%-15s %s\n", _("Parent:"), parent ? parent : ""); + vshPrint(ctl, "%-15s %s\n", _("Active:"), virNodeDeviceIsActive(device= ) ? + _("yes") : _("no")); + vshPrint(ctl, "%-15s %s\n", _("Persistent:"), + virNodeDeviceIsPersistent(device) ? _("yes") : _("no")); + if (virNodeDeviceGetAutostart(device, &autostart) < 0) + vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no autostart")); + else + vshPrint(ctl, "%-15s %s\n", _("Autostart:"), autostart ? _("yes") = : _("no")); + + ret =3D true; + cleanup: + if (device) + virNodeDeviceFree(device); + return ret; +} + + + const vshCmdDef nodedevCmds[] =3D { {.name =3D "nodedev-create", .handler =3D cmdNodeDeviceCreate, @@ -1295,5 +1357,11 @@ const vshCmdDef nodedevCmds[] =3D { .info =3D info_node_device_autostart, .flags =3D 0 }, + {.name =3D "nodedev-info", + .handler =3D cmdNodeDeviceInfo, + .opts =3D opts_node_device_info, + .info =3D info_node_device_info, + .flags =3D 0 + }, {.name =3D NULL} }; --=20 2.31.1