From nobody Sun Feb 8 18:19:27 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=1628009254; cv=none; d=zohomail.com; s=zohoarc; b=UotfE42alitFLUBc1S0JRcYucv2S4EgJV87tIm40GCMXV2yhbn5JLfpXjB/5M7nWYEXsiu4mvnIg9PL9/F4q5ZwlXW4/a7VjKO2Hn7zNXSSddzxhGfLwoIRil+lGlfQcwjFDi4VuLyrOvOn3BSWbppKqGzhNrZB+e4WKzR22Ets= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628009254; 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=nqCW4ohHuAS1l9NUivMMJw0eC3WDuJ3dmxgvC6EpdGc=; b=I356V/DHAhasSAKljVO2FhhSYxi27N5KtVeXFN8vvG/Lkh8NRpi21gY3+9JyGIlEJnI9o3EP07BhRZGAAoORClEbIpN0nZN6oOHb6hCfmqxty3ywajR9i6k3YrWm8B8Cml+jBi9hY0X2ihrf2WSDeSuxwnGmP8EThqTvm11tbqo= 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 1628009254904108.63971834238623; Tue, 3 Aug 2021 09:47:34 -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-180-iQHlagZVPdepOUsAmNSFWw-1; Tue, 03 Aug 2021 12:47:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A43AE100F770; Tue, 3 Aug 2021 16:47:22 +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 88B2F1980E; Tue, 3 Aug 2021 16:47:22 +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 54B1B181A3F0; Tue, 3 Aug 2021 16:47:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 173EU938005608 for ; Tue, 3 Aug 2021 10:30:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7537510074E1; Tue, 3 Aug 2021 14:30:09 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id E76A210016F7 for ; Tue, 3 Aug 2021 14:30:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628009253; 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=nqCW4ohHuAS1l9NUivMMJw0eC3WDuJ3dmxgvC6EpdGc=; b=Ouem9LcvbVKrxjBBQdainXZMpqeLHGBS803s3wd3myl+zElMLRiKpduGCp9DZYSGqcfKto F1VdfNC2DY8Xl16R8XPmdyUEJnS3UM4KOYh8dhy6i1r74c0BaiblyWcvb9xuIOa8qOkWpj bI4K3ccIXnGY/oUR4T76U5oRUZz7UCw= X-MC-Unique: iQHlagZVPdepOUsAmNSFWw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] qemu: implement support for Fibre Channel VMID Date: Tue, 3 Aug 2021 16:29:33 +0200 Message-Id: <6bf923f6e6cf0ee3e5c4289cbe8f6c6697170847.1628000893.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.11 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) X-ZM-MESSAGEID: 1628009256202100005 Content-Type: text/plain; charset="utf-8" Based on kernel commit messages the interface is /sys/class/fc/fc_udev_device/appid_store where we need to write the following string "$INODE:$VMID". $INODE is the VM root cgroup inode in hexadecimal and $VMID is user provided string that will be attached to each FC frame for the VM within the cgroup identified by inode and has limit 128 bytes. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_cgroup.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index f2d99abcfa..df021b5985 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -904,6 +904,35 @@ qemuSetupCpuCgroup(virDomainObj *vm) } =20 =20 +static int +qemuSetupCgroupVMID(virDomainObj *vm) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + int inode =3D virCgroupGetInode(priv->cgroup); + const char *path =3D "/sys/class/fc/fc_udev_device/appid_store"; + g_autofree char *appid =3D NULL; + + if (!vm->def->vmid) + return 0; + + appid =3D g_strdup_printf("%X:%s", inode, vm->def->vmid); + + if (virFileWriteStr(path, appid, 0) < 0) { + if (errno =3D=3D ENOENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("FC VMID not available on this host")); + return -1; + } + + virReportSystemError(errno, + _("Unable to write '%s' to '%s'"), appid, pat= h); + return -1; + } + + return 0; +} + + static int qemuInitCgroup(virDomainObj *vm, size_t nnicindexes, @@ -1096,6 +1125,9 @@ qemuSetupCgroup(virDomainObj *vm, if (qemuSetupCpusetCgroup(vm) < 0) return -1; =20 + if (qemuSetupCgroupVMID(vm) < 0) + return -1; + return 0; } =20 --=20 2.31.1