From nobody Tue Feb 10 00:58:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1578466251; cv=none; d=zohomail.com; s=zohoarc; b=dHe5Y6PQNLYQmWytmi8BgVibOLT64qwSxPDKSkfjwY6PvTqwNUI+tEYp4Kfvvvzw78Kb+RnFJz+KVfsCbGLByyjoyjTEiTzEVkDwgHz7+yNF+RZP+d885358w54QuOp3oiqgc2TTvEsQUTZurvDgYgAt3mKBC1WMSHlzMnHfB4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578466251; 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=tK/g1K59yhdGHdGwxMqsjTQtqly79viAz+40Wn42pg4=; b=PZ2NEH5wFM1nE1in6m1wMdG/f4QmUc0m2NvUaYZoduCZFxt9282fxBcFxmvcaZ8lqDMSBAYOqGhVAK6trBO066T06LUsDgqNUQEj5oQKBDa0OMHDWkLMn1kbgkkrtiTZaUvYtqcykXLrO49KJ+0zrQrLmlQvCr64qWOCiwR0uDo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1578466251410797.1373412530018; Tue, 7 Jan 2020 22:50:51 -0800 (PST) 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-295-RahY4v7RNVmcuKNSqrtq7w-1; Wed, 08 Jan 2020 01:50:48 -0500 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 C6E3D100550E; Wed, 8 Jan 2020 06:50:42 +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 A2FE57C359; Wed, 8 Jan 2020 06:50:42 +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 6A30618089CD; Wed, 8 Jan 2020 06:50:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0086oFOR001427 for ; Wed, 8 Jan 2020 01:50:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id EF1A210AF418; Wed, 8 Jan 2020 06:50:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E997810AF9D0 for ; Wed, 8 Jan 2020 06:50:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 857E5801381 for ; Wed, 8 Jan 2020 06:50:12 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-CtKq_XhdNcuwXxfUdC1ygg-1; Wed, 08 Jan 2020 01:50:10 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1ip5AM-0004p8-PE for libvir-list@redhat.com; Wed, 08 Jan 2020 09:50:06 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578466250; 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=tK/g1K59yhdGHdGwxMqsjTQtqly79viAz+40Wn42pg4=; b=cn308SQR+5JA46XP1muOiuu9C0JiYr5+4gzRYI8fjIV0sEU3kH0iT1pP7rLfePdcMvZ0Qd 0otID0H1qxb+lG+LqhFh2oYGc5QHOqyjOqZMkYvptk4CN58N8NyGqA7wEqjV7mFzuAj6n4 VT4irSNjqIIaMmhVqqxKcqkQ1NWWsSQ= From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 8 Jan 2020 09:49:30 +0300 Message-Id: <20200108064931.2385-7-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200108064931.2385-1-nshirokovskiy@virtuozzo.com> References: <20200108064931.2385-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-MC-Unique: CtKq_XhdNcuwXxfUdC1ygg-1 X-MC-Unique: RahY4v7RNVmcuKNSqrtq7w-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0086oFOR001427 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/7] qemu: get defaults from iotune group we move disk into 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 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For example if disk is not in the group and we want to move it there then it makes sense to specify only the group name in API call. Currently the destination group iotune settings will be overwritten with the disk settings which I would say is not what one would expect. Thus let's get defaults from the group we are moving to. And if we are moving the brand new group then is makes sense to copy the current disk iotune settings to the group. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_driver.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5713266329..5da3748dc7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19125,6 +19125,28 @@ qemuDomainSetGroupBlockIoTune(virDomainDefPtr def, } =20 =20 +static virDomainBlockIoTuneInfoPtr +qemuDomainFindGroupBlockIoTune(virDomainDefPtr def, + virDomainDiskDefPtr disk, + virDomainBlockIoTuneInfoPtr newiotune) +{ + size_t i; + + if (!newiotune->group_name || + STREQ_NULLABLE(disk->blkdeviotune.group_name, newiotune->group_nam= e)) + return &disk->blkdeviotune; + + for (i =3D 0; i < def->ndisks; i++) { + virDomainDiskDefPtr d =3D def->disks[i]; + + if (STREQ_NULLABLE(newiotune->group_name, d->blkdeviotune.group_na= me)) + return &d->blkdeviotune; + } + + return &disk->blkdeviotune; +} + + static int qemuDomainSetBlockIoTune(virDomainPtr dom, const char *path, @@ -19154,6 +19176,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, virTypedParameterPtr eventParams =3D NULL; int eventNparams =3D 0; int eventMaxparams =3D 0; + virDomainBlockIoTuneInfoPtr cur_info; + virDomainBlockIoTuneInfoPtr conf_cur_info; + =20 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); @@ -19375,7 +19400,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, goto endjob; } =20 - if (qemuDomainSetBlockIoTuneDefaults(&info, &disk->blkdeviotune, + cur_info =3D qemuDomainFindGroupBlockIoTune(def, disk, &info); + + if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info, set_fields) < 0) goto endjob; =20 @@ -19452,7 +19479,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, goto endjob; } =20 - if (qemuDomainSetBlockIoTuneDefaults(&conf_info, &conf_disk->blkde= viotune, + conf_cur_info =3D qemuDomainFindGroupBlockIoTune(persistentDef, co= nf_disk, &info); + + if (qemuDomainSetBlockIoTuneDefaults(&conf_info, conf_cur_info, set_fields) < 0) goto endjob; =20 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list