From nobody Mon Apr 29 13:43:11 2024 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=1629903413; cv=none; d=zohomail.com; s=zohoarc; b=fSWuuhOeQ7hN1kIP1at6pfYO7aZtnhvv2s7B79Yv71ESUf4xZJ77GBnsuSIPhtRFWT8Lq+PeB4uMN1CPMRZjlMbMOiPtDpFVnv8vCKyxDYVL2jnxaoMVJMyCK8MYMUfKho0HMHrKmv/he7jXGUu+k0Qm8q1zxjCWbfLQrfP5yO4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903413; 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=bawfjvPWmG/CdNOr8koe4huXxSTHIssdsz1z/X2BZvo=; b=nyXz4dWw2F/o2ofL1IlIUOcm+19HFckIrR3PW2CnKQF57dx/V/hfxSJ3PGp4/JmkSKVy7pC409fLXMLqJatzCMMiJx58yKrVe9WKuMmpeFbhhaRMjDWicsj3Z2xfxC0m23Pe1jteY3he/FbwV/Mxe8fTxtARbcavONr8ebNz1ms= 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 1629903413350955.4624048527089; Wed, 25 Aug 2021 07:56:53 -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-425-0n9jt-7ANaayigFhsO1xWg-1; Wed, 25 Aug 2021 10:56:50 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE836C7443; Wed, 25 Aug 2021 14:56:45 +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 8BA1F5D9C6; Wed, 25 Aug 2021 14:56:45 +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 561FC4A7C9; Wed, 25 Aug 2021 14:56:45 +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 17PEuh4T026011 for ; Wed, 25 Aug 2021 10:56:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 35BAB10074F8; Wed, 25 Aug 2021 14:56:43 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A9FD10023B0 for ; Wed, 25 Aug 2021 14:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903412; 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=bawfjvPWmG/CdNOr8koe4huXxSTHIssdsz1z/X2BZvo=; b=QIr9BKHE3qXfB0aHBII37yYW0c+VCE+vpBF1db8FVfmXdoNyPnrP16G76uYKxd64sVhbnm gX2ma6B8gD8FOfz6zjx9wvZ98Slwyzqu7rXgqixDU43WihJu56HVbiJBjXC3vLNLrciqPk kAt96Ew3kwc0PsygijS0XaCL9D0+jDI= X-MC-Unique: 0n9jt-7ANaayigFhsO1xWg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 1/7] conf: extract appid validation to virDomainDefResourceAppidValidate Date: Wed, 25 Aug 2021 16:56:29 +0200 Message-Id: <3ea8c109e1c3cb171202eb6a456f8e241c812e4f.1629902648.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.14 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: 1629903415488100003 Content-Type: text/plain; charset="utf-8" This will be needed by future patches adding appid API to allow changing it for running VMs. Signed-off-by: Pavel Hrdina --- src/conf/domain_validate.c | 42 +++++++++++++++++++++++--------------- src/conf/domain_validate.h | 2 ++ src/libvirt_private.syms | 1 + 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 60f7ccdddd..47e53f197d 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -58,29 +58,37 @@ virDomainDefBootValidate(const virDomainDef *def) #define APPID_LEN_MIN 1 #define APPID_LEN_MAX 128 =20 +int +virDomainDefResourceAppidValidate(const char *appid) +{ + int len; + + if (!virStringIsPrintable(appid)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Fibre Channel 'appid' is not a printable string"= )); + return -1; + } + + len =3D strlen(appid); + if (len < APPID_LEN_MIN || len > APPID_LEN_MAX) { + virReportError(VIR_ERR_INVALID_ARG, + _("Fibre Channel 'appid' string length must be betw= een [%d, %d]"), + APPID_LEN_MIN, APPID_LEN_MAX); + return -1; + } + + return 0; +} + + static int virDomainDefResourceValidate(const virDomainDef *def) { if (!def->resource) return 0; =20 - if (def->resource->appid) { - int len; - - if (!virStringIsPrintable(def->resource->appid)) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Fibre Channel 'appid' is not a printable str= ing")); - return -1; - } - - len =3D strlen(def->resource->appid); - if (len < APPID_LEN_MIN || len > APPID_LEN_MAX) { - virReportError(VIR_ERR_INVALID_ARG, - _("Fibre Channel 'appid' string length must be = between [%d, %d]"), - APPID_LEN_MIN, APPID_LEN_MAX); - return -1; - } - } + if (def->resource->appid) + return virDomainDefResourceAppidValidate(def->resource->appid); =20 return 0; } diff --git a/src/conf/domain_validate.h b/src/conf/domain_validate.h index 38a1abcc8f..6013488ccf 100644 --- a/src/conf/domain_validate.h +++ b/src/conf/domain_validate.h @@ -40,3 +40,5 @@ int virDomainDeviceDefValidate(const virDomainDeviceDef *= dev, void *parseOpaque); =20 int virDomainDiskDefValidateSource(const virStorageSource *src); + +int virDomainDefResourceAppidValidate(const char *appid); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fa11ee3df5..e13dacf590 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -765,6 +765,7 @@ virDomainConfVMNWFilterTeardown; =20 # conf/domain_validate.h virDomainActualNetDefValidate; +virDomainDefResourceAppidValidate; virDomainDefValidate; virDomainDeviceValidateAliasForHotplug; =20 --=20 2.31.1 From nobody Mon Apr 29 13:43:11 2024 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=1629903418; cv=none; d=zohomail.com; s=zohoarc; b=XeOp8NNqNvplDsIEo8kFZn5OVJ9QsFRW01XTDSQwlZmwvN0pBWMEYBce4O/48QC23UKMgbDB0Vz07cL6MEY9Zz0ze6zBfgLymc2lKiGtMmBE0bXa0rxTUw6Xrv0g8LVz1rRUuwvInP/EqyxfM+AM1DmaiMNTzWXygZAPAaWbtx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903418; 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=H98jnVQRHRzYEQyxp1OMwztYaqPt6pRrBsYxSKxQU6g=; b=HQS0Ja9Hqu3b6xQP/EFNHGJsKw8fnD0pKp58TI7IHv3Enxt/ETocMqawml+Ufb3mqkeK216qL8uxNtKzWGK5RDy6LmkiPdQGtf9X1PkFMkVB0Izr2obY0uEaU/6MTvpvs8X03r+42bRuyx05FgCFU/13w1KFW9+TgfipUGffKPE= 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 1629903418717889.265468509772; Wed, 25 Aug 2021 07:56:58 -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-326-3lOEwkamM4GlgkiKDGD-8A-1; Wed, 25 Aug 2021 10:56:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C12681009606; Wed, 25 Aug 2021 14:56:50 +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 58CC85C22B; Wed, 25 Aug 2021 14:56:50 +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 24D5E4A7CA; Wed, 25 Aug 2021 14:56:50 +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 17PEujAF026033 for ; Wed, 25 Aug 2021 10:56:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 64A0D10016FF; Wed, 25 Aug 2021 14:56:45 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9F461036D15 for ; Wed, 25 Aug 2021 14:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903417; 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=H98jnVQRHRzYEQyxp1OMwztYaqPt6pRrBsYxSKxQU6g=; b=KfV9mAdb2iZJ+dmjJJfEwsVL9gWcfESREyrG4KUlUe3En/Evs/cYhZJjXbveL+BRvEErz3 pbjQj7tetI1dK1HbSr4Vy9KQlsZKbPVfMFrqIkO2CdSotar1XtXeZKuyG9qcx1NS5pBC3G 5+BADRHyY/zd2ABYYAzXcgZAYemAsh8= X-MC-Unique: 3lOEwkamM4GlgkiKDGD-8A-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 2/7] cgroup: extract setting fibre channel appid into virCgroupSetFCAppid Date: Wed, 25 Aug 2021 16:56:31 +0200 Message-Id: <3701256eee5c5263b22a12aa3a40eaaafd98fa99.1629902648.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.16 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: 1629903420053100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 1 + src/qemu/qemu_cgroup.c | 17 +---------------- src/util/vircgroup.c | 24 ++++++++++++++++++++++++ src/util/vircgroup.h | 3 +++ 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index e13dacf590..0051a5574c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1954,6 +1954,7 @@ virCgroupSetCpusetCpus; virCgroupSetCpusetMemoryMigrate; virCgroupSetCpusetMems; virCgroupSetCpuShares; +virCgroupSetFCAppid; virCgroupSetFreezerState; virCgroupSetMemory; virCgroupSetMemoryHardLimit; diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 42dba1750d..736ef11c6e 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -908,27 +908,12 @@ static int qemuSetupCgroupAppid(virDomainObj *vm) { qemuDomainObjPrivate *priv =3D vm->privateData; - int inode =3D -1; - const char *path =3D "/sys/class/fc/fc_udev_device/appid_store"; - g_autofree char *appid =3D NULL; virDomainResourceDef *resource =3D vm->def->resource; =20 if (!resource || !resource->appid) return 0; =20 - inode =3D virCgroupGetInode(priv->cgroup); - if (inode < 0) - return -1; - - appid =3D g_strdup_printf("%X:%s", inode, resource->appid); - - if (virFileWriteStr(path, appid, 0) < 0) { - virReportSystemError(errno, - _("Unable to write '%s' to '%s'"), appid, pat= h); - return -1; - } - - return 0; + return virCgroupSetFCAppid(priv->cgroup, resource->appid); } =20 =20 diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 37b63a2e2d..ad0ee20862 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -4012,3 +4012,27 @@ virCgroupGetCpuPeriodQuota(virCgroup *cgroup, unsign= ed long long *period, =20 return 0; } + + +int +virCgroupSetFCAppid(virCgroup *group, + const char *appid) +{ + int inode =3D -1; + const char *path =3D "/sys/class/fc/fc_udev_device/appid_store"; + g_autofree char *vmid =3D NULL; + + inode =3D virCgroupGetInode(group); + if (inode < 0) + return -1; + + vmid =3D g_strdup_printf("%X:%s", inode, appid); + + if (virFileWriteStr(path, vmid, 0) < 0) { + virReportSystemError(errno, + _("Unable to write '%s' to '%s'"), vmid, path= ); + return -1; + } + + return 0; +} diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h index 690f09465c..a69b435b71 100644 --- a/src/util/vircgroup.h +++ b/src/util/vircgroup.h @@ -285,3 +285,6 @@ int virCgroupHasEmptyTasks(virCgroup *cgroup, int contr= oller); bool virCgroupControllerAvailable(int controller); =20 int virCgroupGetInode(virCgroup *cgroup); + +int virCgroupSetFCAppid(virCgroup *group, + const char *appid); --=20 2.31.1 From nobody Mon Apr 29 13:43:11 2024 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=1629903418; cv=none; d=zohomail.com; s=zohoarc; b=JshGHRUoYiMsToNuBbQpg8+wOc/hjBpQ+GHRDa3xxqjy6U0cfMDfoOR+/h7kLEM2LiS4UfMuRkdT8AYnULAoBlPAIchNLZdMpOU3WMu3lkE/o5ui+SrvIwD7sXPdjVE0pHA3JlvNVhQu+OEC+z6k0eAJRYCv6UydwURvkIu0pk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903418; 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=hstTmQKq251D5LAWKjM/r1qyS1DyCIU3FJTQ2P9nK1I=; b=BnEFXacC0EoADeZIZrDtao21jgOMo9R/c0ZcOgfKJ1uuCwaQliXlnQJT+yLoZRfHcvKDAdx94f1iSXzugMmR1bq1Nm3wtHcvLrI/K9RR89q5VwHKiOQBbpheO25hYMUr65hD3217Nr4EcTCxhmzv+aIZs5o94gyf4DNsC2Ud1Lo= 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 1629903418109376.0689785096656; Wed, 25 Aug 2021 07:56:58 -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-162-12D-3A3NN8-HNijUqVW8nQ-1; Wed, 25 Aug 2021 10:56:55 -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 8E5EF802934; Wed, 25 Aug 2021 14:56:49 +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 465A310074F8; Wed, 25 Aug 2021 14:56:49 +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 0F0F3181A100; Wed, 25 Aug 2021 14:56:49 +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 17PEukR9026039 for ; Wed, 25 Aug 2021 10:56:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 705CC10016FF; Wed, 25 Aug 2021 14:56:46 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5ACB1036D15 for ; Wed, 25 Aug 2021 14:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903417; 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=hstTmQKq251D5LAWKjM/r1qyS1DyCIU3FJTQ2P9nK1I=; b=FOwUVNX1fsZWEUB0g1AQScQO4uDmoYN5v2aTT0IbBYEn8yfv5RzETjdHdpNm8eVn3k4tu3 EzfQNpAVXIdpEra4StVg1zqm15gv4164P9CoVdzVMRrRkLi7zLUdNREv2yH9HGH3L+JWJU WUL2RmUh0tWY7TxuMmD94j7TxQ9zg+8= X-MC-Unique: 12D-3A3NN8-HNijUqVW8nQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 3/7] virCgroupSetFCAppid: properly handle when appid is NULL Date: Wed, 25 Aug 2021 16:56:32 +0200 Message-Id: <70a4d2accc0a98d4fd32c2ade5f1c867ff9d2de1.1629902648.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.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: 1629903419992100001 Content-Type: text/plain; charset="utf-8" With introduction of live changes of appid we should also support removal of the appid from VM. This is done by writing empty appid part to appid_store file. Signed-off-by: Pavel Hrdina --- src/util/vircgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index ad0ee20862..9470ab061d 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -4026,7 +4026,7 @@ virCgroupSetFCAppid(virCgroup *group, if (inode < 0) return -1; =20 - vmid =3D g_strdup_printf("%X:%s", inode, appid); + vmid =3D g_strdup_printf("%X:%s", inode, appid ? appid : ""); =20 if (virFileWriteStr(path, vmid, 0) < 0) { virReportSystemError(errno, --=20 2.31.1 From nobody Mon Apr 29 13:43:11 2024 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=1629903420; cv=none; d=zohomail.com; s=zohoarc; b=GxIneN+hVvkM4phmc0W4Vby6E8xJwwikeGwHZn2qTW2A2w0I+/yLSfoNEelFarefXCGjpHJDiifZzejBVL3Ec7Zm/kFsGgbf1BkN3eVKxMKTQ7/ndpejCNOLtlWtlog1QoTYaSvcv1CKmCzxTGth1Myx6bvLBxB95XT7NhbXaLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903420; 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=zpp5rsVlbw8WFSs0lzfPhl485dZOVqJciRUhFilZsms=; b=B8AFZ0r6V3g9uQPNN9UfKtuW348ipEvG7WgP2iASM3D6JYebDUWYitm+74+KaP0YMr5goyFiVYReHFn4yUvG2DvoAn3iIewJUG7eZTIySbAbchwzETuhM+vjjj3jumz4qazYZaJShxTkPgE3m+FRgHi82D1u4tm/lmYwnsxkZCs= 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 1629903420105918.3211707208891; Wed, 25 Aug 2021 07:57:00 -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-190-jJ9ZdQrbNaWK_r3YPF7aHQ-1; Wed, 25 Aug 2021 10:56:57 -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 61303802923; Wed, 25 Aug 2021 14:56:50 +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 43B971036D15; Wed, 25 Aug 2021 14:56:50 +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 0D8334A7CB; Wed, 25 Aug 2021 14:56:50 +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 17PEuleG026047 for ; Wed, 25 Aug 2021 10:56:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7AAE510016FF; Wed, 25 Aug 2021 14:56:47 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D58FF1036D15 for ; Wed, 25 Aug 2021 14:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903419; 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=zpp5rsVlbw8WFSs0lzfPhl485dZOVqJciRUhFilZsms=; b=OcCcSTHaegMan6p9kvUOSX0noqzpcKoW9EEu5XkuOucv6seWA+8uyEc3IeHfPpce/j3Uo8 Q5yhGtNp+rkN6mhq1R5rNU9YnJhUbkBRplG3ufkGZtftBojgBtApmqjSftTxlW8LFOXCw3 zroiUOrAJcTxYN9EQ2p9PXpG3zjKniM= X-MC-Unique: jJ9ZdQrbNaWK_r3YPF7aHQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 4/7] src: introduce virDomainSetFibreChannelAppid API Date: Wed, 25 Aug 2021 16:56:33 +0200 Message-Id: <52ae5a7050bb4a24046a731c49641c582c6655d1.1629902648.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.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: 1629903422169100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- include/libvirt/libvirt-domain.h | 4 +++ src/driver-hypervisor.h | 6 +++++ src/libvirt-domain.c | 44 ++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + 4 files changed, 55 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 7ef8ac51e5..4f7b88ef61 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -5153,4 +5153,8 @@ int virDomainStartDirtyRateCalc(virDomainPtr domain, int seconds, unsigned int flags); =20 +int virDomainSetFibreChannelAppid(virDomainPtr domain, + const char *appid, + unsigned int flags); + #endif /* LIBVIRT_DOMAIN_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index d642af8a37..e6b1ceb3ce 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1412,6 +1412,11 @@ typedef int =20 typedef struct _virHypervisorDriver virHypervisorDriver; =20 +typedef int +(*virDrvDomainSetFibreChannelAppid)(virDomainPtr domain, + const char *appid, + unsigned int flags); + /** * _virHypervisorDriver: * @@ -1676,4 +1681,5 @@ struct _virHypervisorDriver { virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet; virDrvDomainGetMessages domainGetMessages; virDrvDomainStartDirtyRateCalc domainStartDirtyRateCalc; + virDrvDomainSetFibreChannelAppid domainSetFibreChannelAppid; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index a8a386e839..f3e6854a39 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -13229,3 +13229,47 @@ virDomainStartDirtyRateCalc(virDomainPtr domain, virDispatchError(conn); return -1; } + + +/** + * virDomainSetFibreChannelAppid: + * @domain: a domain object + * @appid: user provided appid string + * @flags: extra flags + * + * Set the Fibre Channel APPID. Accepts only printable characters + * and maximal length is 128 characters. To remove the APPID use + * NULL as @appid value. + * + * Returns 0 in case of success, -1 otherwise. + */ +int +virDomainSetFibreChannelAppid(virDomainPtr domain, + const char *appid, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "appid=3D%s, flags=3D0x%x", appid, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + + virCheckReadOnlyGoto(conn->flags, error); + + if (conn->driver->domainSetFibreChannelAppid) { + int ret; + ret =3D conn->driver->domainSetFibreChannelAppid(domain, appid, fl= ags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 3a5fa7cb09..912b421632 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -900,6 +900,7 @@ LIBVIRT_7.7.0 { global: virNWFilterDefineXMLFlags; virNetworkDefineXMLFlags; + virDomainSetFibreChannelAppid; } LIBVIRT_7.3.0; =20 # .... define new API here using predicted next version number .... --=20 2.31.1 From nobody Mon Apr 29 13:43:11 2024 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=1629903426; cv=none; d=zohomail.com; s=zohoarc; b=bDFLN/IBWTU5xfwfcF+2QTxZELxpHDYFTNbRSea94JK6amczUJSi88UPa1ABp+hhAqVVwQTPdcPhEYF0/V5IT3JrveeGrCu1Mb4GqcKyNo/VvOo/pLIuxTTl0hsnWiI1U/SgxLQubBFNWsmZGP5RDSvGtPbubCY5Ci0OwcfOioI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903426; 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=1JD+CK4zZK7X5pp/DsmIUmY5jLq++zw3HOFWWjfmqVM=; b=CYJ971cXt60pKVEwwJjdz/MQfk9/+aEgSPs+2QTEwc0jTQk6Si7ndz+Zs+QvuUZf64jeS2kb0wlrgsw4YBxwvSQuVZtSBz5wbWmgGXbageccSK+n8iPuiO0jHWAbwTj+OnqEDWCndFGJPdVrkWyNryjWrFF230IKXfUyyTVHczk= 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 1629903426967124.62411869221705; Wed, 25 Aug 2021 07:57:06 -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-412-xJh4gpl9MKWVSb2B85vMkw-1; Wed, 25 Aug 2021 10:57:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20AC4190A7B4; Wed, 25 Aug 2021 14:56:53 +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 E9ADD19D9F; Wed, 25 Aug 2021 14:56:52 +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 B95C8181A1CE; Wed, 25 Aug 2021 14:56:52 +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 17PEumOP026066 for ; Wed, 25 Aug 2021 10:56:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8616110023B0; Wed, 25 Aug 2021 14:56:48 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAFA110016FF for ; Wed, 25 Aug 2021 14:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903425; 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=1JD+CK4zZK7X5pp/DsmIUmY5jLq++zw3HOFWWjfmqVM=; b=E7hauI4+puAVVLw0s0Ie8HuTVqb6+PRb2msbxStK3sIgxlve7Bfk/8QQR4ukNAlu72p0LA zjRqXDDNZ2UP0/zG7sNRRw1fvt3XIfSyTIIIF4R2keOAfdfmD9F0TB91fEkb6jCBoxhQZ1 5/OmpdGt16jI17cuf26lo9zKf4HFKmY= X-MC-Unique: xJh4gpl9MKWVSb2B85vMkw-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 5/7] remote: add RPC support for the virDomainSetFibreChannelAppid API Date: Wed, 25 Aug 2021 16:56:34 +0200 Message-Id: <2020ee99193d02efe590b24580b9032bfde090d4.1629902648.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.84 on 10.5.11.23 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: 1629903428839100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 14 +++++++++++++- src/remote_protocol-structs | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index b64a86af63..55a0b79f95 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8539,6 +8539,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainAuthorizedSSHKeysSet =3D remoteDomainAuthorizedSSHKeysSet, /* 6= .10.0 */ .domainGetMessages =3D remoteDomainGetMessages, /* 7.1.0 */ .domainStartDirtyRateCalc =3D remoteDomainStartDirtyRateCalc, /* 7.2.0= */ + .domainSetFibreChannelAppid =3D remoteDomainSetFibreChannelAppid, /* 7= .7.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index df1b126b0c..0a64504d45 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3854,6 +3854,12 @@ struct remote_domain_start_dirty_rate_calc_args { unsigned int flags; }; =20 +struct remote_domain_set_fibre_channel_appid_args { + remote_nonnull_domain dom; + remote_string appid; + unsigned int flags; +}; + =20 /*----- Protocol. -----*/ =20 @@ -6818,5 +6824,11 @@ enum remote_procedure { * @acl: network:write * @acl: network:save */ - REMOTE_PROC_NETWORK_DEFINE_XML_FLAGS =3D 432 + REMOTE_PROC_NETWORK_DEFINE_XML_FLAGS =3D 432, + + /** + * @generate: both + * @acl: domain:write + */ + REMOTE_PROC_DOMAIN_SET_FIBRE_CHANNEL_APPID =3D 433 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index dad83361fa..731cad112c 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -3206,6 +3206,11 @@ struct remote_domain_start_dirty_rate_calc_args { int seconds; u_int flags; }; +struct remote_domain_set_fibre_channel_appid_args { + remote_nonnull_domain dom; + remote_string appid; + u_int flags; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN =3D 1, REMOTE_PROC_CONNECT_CLOSE =3D 2, @@ -3639,4 +3644,5 @@ enum remote_procedure { REMOTE_PROC_NODE_DEVICE_CREATE =3D 430, REMOTE_PROC_NWFILTER_DEFINE_XML_FLAGS =3D 431, REMOTE_PROC_NETWORK_DEFINE_XML_FLAGS =3D 432, + REMOTE_PROC_DOMAIN_SET_FIBRE_CHANNEL_APPID =3D 433, }; --=20 2.31.1 From nobody Mon Apr 29 13:43:11 2024 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=1629903424; cv=none; d=zohomail.com; s=zohoarc; b=LnTnYT0t3w3rgvcSd+zVlrulyIdYuRGurTXoZs0491G4tUZmlS3k0VohYIlYnk+zhUSo5s7Ewc/yR0uXnal4Z4VCr22BcrgjJUvBoAG6YiBqt5SMYXwqTSIdpw48v3djNdYe+PjjYeeEld6x47+tIe2BVzcYyKDTVQz7IfMAosQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903424; 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=bp7m6tk8lEuwlhdS1jCC3SS9WxPOhMWWHKelcwTXk/E=; b=m5pjrUWLnYOUzEXLvIFIRxBzngHhHpIjD3sNySWmrQgDHz5OHd6hdMhuYIAYUkDSUI2klKY0wmrg2LzxrjtEeHV+XDhsYMjysdGKJTVK5B6mQvJjL86dXYMSEsfyUPvRGY2Isbdg66YXBbl6sr/7tpY7pVOF+Y9Zh9BY/fZYROw= 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 1629903424766857.7833317320333; Wed, 25 Aug 2021 07:57:04 -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-117-1uoHTBzcOyWbltndMKOnxg-1; Wed, 25 Aug 2021 10:57:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D4E31009607; Wed, 25 Aug 2021 14:56:56 +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 D43BD3AA2; Wed, 25 Aug 2021 14:56:55 +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 99091181A2AA; Wed, 25 Aug 2021 14:56:55 +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 17PEunLL026073 for ; Wed, 25 Aug 2021 10:56:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 90AB510016FF; Wed, 25 Aug 2021 14:56:49 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE26710023B0 for ; Wed, 25 Aug 2021 14:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903423; 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=bp7m6tk8lEuwlhdS1jCC3SS9WxPOhMWWHKelcwTXk/E=; b=UtqwSucJCaFNMhGjicqSQ6nVRXknPfyzWlXgOIbqhqu9aEpeOn4gVLDWHGWrRlXUU2pCfm taR8YErrmSIyspJU2kD1wWVWB+2tTSGT3Ic5hJFgxzjj9mV/Kk19cI8jwuYERe++ZdOIzt chvtdzp04DL9n3Cm5tdQV2uL2AROnkA= X-MC-Unique: 1uoHTBzcOyWbltndMKOnxg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 6/7] qemu: implement virDomainSetFibreChannelAppid API Date: Wed, 25 Aug 2021 16:56:35 +0200 Message-Id: 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.84 on 10.5.11.23 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: 1629903426652100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f1f961c51c..e8c819bfb9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20448,6 +20448,80 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, } =20 =20 +static void +qemuDomainUpdateFibreChannelAppid(virDomainDef *def, + const char *appid) +{ + if (!def->resource) { + def->resource =3D g_new0(virDomainResourceDef, 1); + } else { + g_free(def->resource->appid); + } + + def->resource->appid =3D g_strdup(appid); +} + + +static int +qemuDomainSetFibreChannelAppid(virDomainPtr dom, + const char *appid, + unsigned int flags) +{ + virQEMUDriver *driver =3D dom->conn->privateData; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + virDomainObj *vm =3D NULL; + virDomainDef *def =3D NULL; + virDomainDef *persistentDef =3D NULL; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); + + if (appid && virDomainDefResourceAppidValidate(appid) < 0) + return -1; + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + goto cleanup; + + if (virDomainSetFibreChannelAppidEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto endjob; + + if (def) { + qemuDomainObjPrivate *priv =3D vm->privateData; + + if (virCgroupSetFCAppid(priv->cgroup, appid) < 0) + goto endjob; + + qemuDomainUpdateFibreChannelAppid(def, appid); + + if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0) + goto endjob; + } + + if (persistentDef) { + qemuDomainUpdateFibreChannelAppid(persistentDef, appid); + + if (virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir= ) < 0) + goto endjob; + } + + ret =3D 0; + + endjob: + qemuDomainObjEndJob(driver, vm); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -20691,6 +20765,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainAuthorizedSSHKeysSet =3D qemuDomainAuthorizedSSHKeysSet, /* 6.1= 0.0 */ .domainGetMessages =3D qemuDomainGetMessages, /* 7.1.0 */ .domainStartDirtyRateCalc =3D qemuDomainStartDirtyRateCalc, /* 7.2.0 */ + .domainSetFibreChannelAppid =3D qemuDomainSetFibreChannelAppid, /* 7.7= .0 */ }; =20 =20 --=20 2.31.1 From nobody Mon Apr 29 13:43:11 2024 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=1629903421; cv=none; d=zohomail.com; s=zohoarc; b=d/DasgO2LiZrx9TBEUPwzhL9jEb9LTnxW+07C4xgnoLkjxVO8JGQjmxfOitIU19/VY5MA5SFJhKiljp/Dfc6E+ryx/LYGqBrtruo07CbNsCHChvo4SRphIxFjX1sQ6j6cAgWqn5N1MdUoJWmT2QPuXSfsQiNNnMRUOoCUxgPd5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629903421; 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=9SCNrbl9Adn/BLrrxdkrnxUHP4jcmij4RhBP0vL9XnU=; b=g6FCRLSsZ7Zx1XjQkGt2+fxxFH9e1VSkoyTmb7WC2qix1QD/T7n98xLF41lPfYbwqDQTSahQn8jgZZC+E6zT+OOF49SKR8YH4ymrd1dj3swxF8ij1+QZzGOYG82WYqqAbnkNibyzt99CMOffmihNzeLvoM7g1nXfdgwcHn7gxM8= 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 1629903421989764.4698424351965; Wed, 25 Aug 2021 07:57:01 -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-507-PFo2xVcZOne0jDsGAeYZpQ-1; Wed, 25 Aug 2021 10:56:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D2611009615; Wed, 25 Aug 2021 14:56:53 +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 E36CC5C25A; Wed, 25 Aug 2021 14:56:52 +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 B7BF7181A1CD; Wed, 25 Aug 2021 14:56:52 +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 17PEuoVr026082 for ; Wed, 25 Aug 2021 10:56:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BDB610016FF; Wed, 25 Aug 2021 14:56:50 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FC5410372F0 for ; Wed, 25 Aug 2021 14:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629903421; 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=9SCNrbl9Adn/BLrrxdkrnxUHP4jcmij4RhBP0vL9XnU=; b=FtdACbdmtvrTQ0Va7KQCCMQplJwiG2hUUXYCB0MsceaOlxCaxfmzwqnnD5J25S7Ac7zOl9 PyDy7D3/fZAsdonKKvGeFLTi7s0LuBx2ArDWFMGtW3+gv8COdtR5qySrxsiPkEfo6NQHD3 ZIJGu+fWLIL1bBzjIiu8T8ZWBbhFzBg= X-MC-Unique: PFo2xVcZOne0jDsGAeYZpQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [RFC 7/7] tools: introduce virsh setappid command Date: Wed, 25 Aug 2021 16:56:36 +0200 Message-Id: <12d6e6552763e53976e8b7dc4c30b8b405f338b4.1629902648.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.16 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: 1629903422406100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- docs/manpages/virsh.rst | 14 +++++++++ tools/virsh-domain.c | 65 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 2204bed3bb..5875b523a4 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -4515,6 +4515,20 @@ Output the IP address and port number for the VNC di= splay. If the information is not available the processes will provide an exit code of 1. =20 =20 +setappid +-------- + +**Syntax:** + +:: + + setappid domain appid + +Set the Fibre Channel appid string for domain that is used to create VMID = to +tag the traffic. Accepts only printable characters and maximal length is 1= 28 +characters. To remove the appid from VM don't pass any appid. + + DEVICE COMMANDS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e5bd1fdd75..07d9c7f954 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -14070,6 +14070,65 @@ cmdDomDirtyRateCalc(vshControl *ctl, const vshCmd = *cmd) } =20 =20 +/* + * "setappid" command + */ +static const vshCmdInfo info_setappid[] =3D { + {.name =3D "help", + .data =3D N_("Set domain Fibre Channel appid") + }, + {.name =3D "desc", + .data =3D N_("Set the Fibre Channel appid string for domain that is " + "used to create VMID to tag the traffic. Accepts only " + "printable characters and maximal length is 128 characters= . " + "To remove the appid from VM don't pass any appid.") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_setappid[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL(0), + VIRSH_COMMON_OPT_DOMAIN_CONFIG, + VIRSH_COMMON_OPT_DOMAIN_LIVE, + VIRSH_COMMON_OPT_DOMAIN_CURRENT, + {.name =3D "appid", + .type =3D VSH_OT_STRING, + .help =3D N_("User provided appid string"), + }, + {.name =3D NULL} +}; + +static bool +cmdSetAppid(vshControl *ctl, const vshCmd *cmd) +{ + g_autoptr(virshDomain) dom =3D NULL; + bool config =3D vshCommandOptBool(cmd, "config"); + bool live =3D vshCommandOptBool(cmd, "live"); + bool current =3D vshCommandOptBool(cmd, "current"); + const char *appid =3D NULL; + unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; + + VSH_EXCLUSIVE_OPTIONS_VAR(current, live); + VSH_EXCLUSIVE_OPTIONS_VAR(current, config); + + if (config) + flags |=3D VIR_DOMAIN_AFFECT_CONFIG; + if (live) + flags |=3D VIR_DOMAIN_AFFECT_LIVE; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (vshCommandOptStringReq(ctl, cmd, "appid", &appid) < 0) + return false; + + if (virDomainSetFibreChannelAppid(dom, (char *)appid, flags) < 0) + return false; + + return true; +} + + const vshCmdDef domManagementCmds[] =3D { {.name =3D "attach-device", .handler =3D cmdAttachDevice, @@ -14715,5 +14774,11 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_domdirtyrate_calc, .flags =3D 0 }, + {.name =3D "setappid", + .handler =3D cmdSetAppid, + .opts =3D opts_setappid, + .info =3D info_setappid, + .flags =3D 0 + }, {.name =3D NULL} }; --=20 2.31.1