From nobody Sun Feb 8 19:24:20 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=1628171948; cv=none; d=zohomail.com; s=zohoarc; b=HAIBTV/MV9Gi4UDrU+WfHymcXuHpjC9e/9Tu/8zXipS99203LCEYFs9vABH2a8ytnq3mYtKwPyHU6Xp47mpxVHAnos9ZcMNtol5ezPSYEDY0stGeTk6NJKeunQ+uPXM8/UqlGjGw24971goFS+CmBLbDelS24NhQ+6BXWQujlDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628171948; 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=PetdnSy+8+bT6Md/Hvog1fQQ3hVC8aDvFCTR7Q79oH0=; b=gGbvCGOcd9Tp0vhjciBw6gI2AsFMOyXwNJuH9Scvc8M1POJpvb6vLfjuwBmXzSRliSkiAL5mOEDrscsPdBC3NWcBgf12xg7KjJl/cLVnMDnXcFn6fxMnDXaJUJ4mB6gkG+NBLhMQUmKNDuL8F8LHaip8W1eVuLrqXhj2iEVXYo4= 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) 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 1628171948605784.9463217733135; Thu, 5 Aug 2021 06:59:08 -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-63-nmNqRP9zNEqToK99NwICtA-1; Thu, 05 Aug 2021 09:59:05 -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 DCFBA87D545; Thu, 5 Aug 2021 13:58:59 +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 B698C1036D11; Thu, 5 Aug 2021 13:58:59 +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 7E781181A3F3; Thu, 5 Aug 2021 13:58:59 +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 175DuNIS014656 for ; Thu, 5 Aug 2021 09:56:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 40B3960CA1; Thu, 5 Aug 2021 13:56:23 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0B8060BF4 for ; Thu, 5 Aug 2021 13:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628171947; 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=PetdnSy+8+bT6Md/Hvog1fQQ3hVC8aDvFCTR7Q79oH0=; b=Y4J0CztEaOtuOiis5Kad70akdnIRDcx5K9PUlKe1prmBJPk+MP6fDKuWYsdSZydgP6YPQ5 1iQK6UHZr9zOBnXEihMZ7y9NBo3XifpNpgmY925RoOMX1o/bvTgUrdAJdpXsH1ZX3X/ZjZ yirV+XAuLyoQoUPgeuHYjY7z5stR5Fg= X-MC-Unique: nmNqRP9zNEqToK99NwICtA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 5/5] qemu: implement support for Fibre Channel VMID Date: Thu, 5 Aug 2021 15:56:09 +0200 Message-Id: <83b007b66cfd7a386f31ddb7187a962c1292bc3b.1628171661.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628171949178100002 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index f2d99abcfa..cd5d4341f7 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -904,6 +904,30 @@ 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; + virDomainResourceDef *resource =3D vm->def->resource; + + if (!resource || !resource->vmid) + return 0; + + appid =3D g_strdup_printf("%X:%s", inode, resource->vmid); + + if (virFileWriteStr(path, appid, 0) < 0) { + 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 +1120,9 @@ qemuSetupCgroup(virDomainObj *vm, if (qemuSetupCpusetCgroup(vm) < 0) return -1; =20 + if (qemuSetupCgroupVMID(vm) < 0) + return -1; + return 0; } =20 --=20 2.31.1