From nobody Wed May 15 06:13:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1657266969; cv=none; d=zohomail.com; s=zohoarc; b=ZyLgKQdUdA5BUKAstG937rS39/qyoTwKKPJiWBfQt7Yc5x8KZEL1YO5V+tmSd9FXpxDPu4j/jmIDIZ0zHP7KQCqReUOarCqoMzqFf7AlzLWi5EdidLYv2Gz3dyp/j0VbyXYhEBhyLGadj9GKqujVCV3/A3iBS3oGYMZAmCOb2YE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657266969; 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=55FFhiVLxit682pJTwWUWf/0GnJL3OC+WF0+UtWeNVg=; b=LeQm+Ijs+NaWEDrMOrDsgfJ2zReKbwDC51viEeKh/BHWuFDQJmcBykRaiJ8PdHNM1N4sjg0aQ9UxNgVW43Pg007pBLvl/fSpY4Z+cUO+J0AoAtmvdFLYwWzTQVMGeZ0MoMerMBpeCt3x7sX1PT92rAbvxOeV2+fkE9V3MzZ1QQ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1657266969436509.45071754018386; Fri, 8 Jul 2022 00:56:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-YX09z_AiOQiQ8IWfCZitwg-1; Fri, 08 Jul 2022 03:55:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9670D101AA69; Fri, 8 Jul 2022 07:55:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8341D1121315; Fri, 8 Jul 2022 07:55:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2C182194707E; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CABC4194706C for ; Fri, 8 Jul 2022 07:55:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BF4E01121320; Fri, 8 Jul 2022 07:55:16 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67EF71121315 for ; Fri, 8 Jul 2022 07:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657266968; 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=55FFhiVLxit682pJTwWUWf/0GnJL3OC+WF0+UtWeNVg=; b=MhRthwQmobfRN43Q75CXh6c72JXqLB5Q3BHt4IgCspo65q4io9Dt1JhOe27E2S3ayYYmDY VruFgDKh7RT0R07RK+0cGT4CtJ0Zlb6TF6//FyeHyucHHFPh8/adgN4jT5gFkYwdUmD+A3 25kDCZlQA7+ORW9INq9RNcSJ8MCWKyU= X-MC-Unique: YX09z_AiOQiQ8IWfCZitwg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/5] domain_conf: Format more often Date: Fri, 8 Jul 2022 09:55:10 +0200 Message-Id: <8fe58c309c66f890de05c403ab0da89115b905a3.1657266850.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 1657266970028100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The element is formatted inside virDomainDefaultIOThreadDefFormat() which is called only from virDomainDefIOThreadsFormat() (so that IOThread related stuff is formatted calling one function). However, when there are no defined (or only autoallocated ones are present), then the outer formatting function exits early never calling the formatter. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 46 ++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b639022396..24f17a8b91 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26349,40 +26349,38 @@ static void virDomainDefIOThreadsFormat(virBuffer *buf, const virDomainDef *def) { - g_auto(virBuffer) childrenBuf =3D VIR_BUFFER_INIT_CHILD(buf); - size_t i; - - if (def->niothreadids =3D=3D 0) - return; + if (def->niothreadids > 0) { + virBufferAsprintf(buf, "%zu\n", + def->niothreadids); + } =20 - virBufferAsprintf(buf, "%zu\n", - def->niothreadids); + if (virDomainDefIothreadShouldFormat(def)) { + g_auto(virBuffer) childrenBuf =3D VIR_BUFFER_INIT_CHILD(buf); + size_t i; =20 - if (!virDomainDefIothreadShouldFormat(def)) - return; + for (i =3D 0; i < def->niothreadids; i++) { + virDomainIOThreadIDDef *iothread =3D def->iothreadids[i]; + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; =20 - for (i =3D 0; i < def->niothreadids; i++) { - virDomainIOThreadIDDef *iothread =3D def->iothreadids[i]; - g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + virBufferAsprintf(&attrBuf, " id=3D'%u'", + iothread->iothread_id); =20 - virBufferAsprintf(&attrBuf, " id=3D'%u'", - iothread->iothread_id); + if (iothread->thread_pool_min >=3D 0) { + virBufferAsprintf(&attrBuf, " thread_pool_min=3D'%d'", + iothread->thread_pool_min); + } =20 - if (iothread->thread_pool_min >=3D 0) { - virBufferAsprintf(&attrBuf, " thread_pool_min=3D'%d'", - iothread->thread_pool_min); - } + if (iothread->thread_pool_max >=3D 0) { + virBufferAsprintf(&attrBuf, " thread_pool_max=3D'%d'", + iothread->thread_pool_max); + } =20 - if (iothread->thread_pool_max >=3D 0) { - virBufferAsprintf(&attrBuf, " thread_pool_max=3D'%d'", - iothread->thread_pool_max); + virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); } =20 - virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); + virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); } =20 - virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); - virDomainDefaultIOThreadDefFormat(buf, def); } =20 --=20 2.35.1 From nobody Wed May 15 06:13:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1657266966; cv=none; d=zohomail.com; s=zohoarc; b=RmNM2RY5PZOZeWighl8keQ/iyf7ZxZnileFBkjbcDUxBRFDKnHyVkUrx9CBik8h8c1SImhfZtE71LcgZOq9o0PqdkyBcI4bR1U/GoTiXipsN0uAmh325r+pQHcaOJ4ocGnBPsVArdp40yoIPXjiJUOwTpgSGO9q1TNU3Lh+7hAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657266966; 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=iGxjSp313m7028h4I7+uVW28dzJfvc+yA3N92UkDCGc=; b=De1vGj2ZYmG0xyESRqiFiUy745f6rJ05Ab62depJwhcymPqYz2Z5QNpIVEumnsfrGjhrBJUHnZYbjRuwMnaf2PN3kmIq0wVIgDi2U3AoG3U+32iVvZ98l/JrneJam2op1KnVntc5AiUYQ3aBT+YpMpSTOVke7Lh/sqRX891/2LU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1657266966489732.4693052991765; Fri, 8 Jul 2022 00:56:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-549-gDpu5w4zOrmSoxtO2muEdg-1; Fri, 08 Jul 2022 03:55:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2613C8582A8; Fri, 8 Jul 2022 07:55:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 135931121315; Fri, 8 Jul 2022 07:55:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8117E1947B88; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 823FC194706B for ; Fri, 8 Jul 2022 07:55:17 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 59B731121320; Fri, 8 Jul 2022 07:55:17 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 032421121315 for ; Fri, 8 Jul 2022 07:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657266965; 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=iGxjSp313m7028h4I7+uVW28dzJfvc+yA3N92UkDCGc=; b=VJMXwmif7RhpCflmAZ6CJRZgYfbWH9zPtD/GUT4DzhBXZE/k+pgk8JUQYxs2vq3itIV6Wy p1QbF3j830ECZNFyc6tmrL2d6bLBMR+ttOed4nQTjPDrzEAiQMwnqcjB5JoqV6o7YJQuUp xuwse+a6218IZK+5R6NwEF0JdEMhi+A= X-MC-Unique: gDpu5w4zOrmSoxtO2muEdg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/5] domain_conf: Format iothread IDs more often Date: Fri, 8 Jul 2022 09:55:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 1657266968034100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When formatting IOThreads (in virDomainDefIOThreadsFormat()), we may only output the number of IOThreads, or the full list of IOThreads too: 4 Now, the deciding factor here is whether those individual IOThreads were so called 'autofill-ed' or user provided. Well, we need to take another factor in: if an IOThread has pool size limit set, then we ought to format the full list. But how can we get into a situation when a thread is autofilled (i.e. not provided by user in the XML) and yet it has pool size limit set? virDomainSetIOThreadParams() is the answer. Sure, we could also unset the autofill flag whenever a pool size limit is being set. But this approach allows us to not format anything if the limits are reset (we don't lose the autofill information). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 24f17a8b91..e80616fe7b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26314,7 +26314,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef= *def) size_t i; =20 for (i =3D 0; i < def->niothreadids; i++) { - if (!def->iothreadids[i]->autofill) + if (!def->iothreadids[i]->autofill || + def->iothreadids[i]->thread_pool_min >=3D 0 || + def->iothreadids[i]->thread_pool_max >=3D 0) return true; } =20 --=20 2.35.1 From nobody Wed May 15 06:13:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1657266929; cv=none; d=zohomail.com; s=zohoarc; b=JY0JbRukd3P+uUiZmDvCuC/t0FU+y3YpHp21JBxXjuNfs9PkzAkfhD4oShgUwxc6M6uCTKqgqrrl8Ebq1HpTqpj3pNsICuM8MYac/OOtRpkQBZdXpPkqRmgmAoU0fEB8msgG027lOuNwLPv2o6yqVTOQftKPzGYVl4SfOyEwhdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657266929; 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=J/caIkQbK22+xdP7tDEpO2K+jkuh6uB7xTNR2NlB8lc=; b=VO9fHKxDduB+oC8PV5gT+90xiXYeYuMsH7mSKxHta10G8tpzVSWQPUfXKHq9RJVNj2oXggwsyAkDj7Mva/cxC3l52Yg+Nwgj9X3WXzsMtYu3LP5POyzbhjXr0k/9ZwCvuwp7JPrKpahOc7Kr/AEJMQkmvE7moi01bV/FZnyreMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1657266929794702.0426820347897; Fri, 8 Jul 2022 00:55:29 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-499-GM7diqa8M7eUPhmoOIm-IA-1; Fri, 08 Jul 2022 03:55:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDFEE29324BA; Fri, 8 Jul 2022 07:55:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8FE3407EE6A; Fri, 8 Jul 2022 07:55:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0A58F1947B9B; Fri, 8 Jul 2022 07:55:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 12FBF194707E for ; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E923D1121320; Fri, 8 Jul 2022 07:55:17 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9234A1121315 for ; Fri, 8 Jul 2022 07:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657266928; 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=J/caIkQbK22+xdP7tDEpO2K+jkuh6uB7xTNR2NlB8lc=; b=E6n+HV983slqCejqdHOKob9OcBOwb9w+FAGkN2Mzn75+DcdqsflDpdrrFYmGWIkDxcAgYN hTECgDxorNre7mG5464NxaXaxYyBgPRzMuskwuzxp1O1S4qEJ5NTdp676mve/Nmv7Y66l0 ojf4MEzyZVw+vlmL5VQ9sj4nLlpkpbY= X-MC-Unique: GM7diqa8M7eUPhmoOIm-IA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/5] qemu: Make IOThread changing more robust Date: Fri, 8 Jul 2022 09:55:12 +0200 Message-Id: <7ca872227edbce57c7f9dfbfa3b8296dcb0a40a2.1657266850.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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: 1657266931872100002 Content-Type: text/plain; charset="utf-8"; x-default="true" There are three APIs that allow changing IOThreads: virDomainAddIOThread() virDomainDelIOThread() virDomainSetIOThreadParams() In case of QEMU driver these are handled by qemuDomainChgIOThread() which attempts to be versatile enough to work on both inactive and live domain definitions at the same time. However, it's a bit clumsy - when a change to live definition succeeds but fails in inactive definition then there's no rollback. And somewhat rightfully so - changes to live definition are in general harder to roll back. Therefore, do what we do elsewhere (qemuDomainAttachDeviceLiveAndConfig(), qemuDomainDetachDeviceAliasLiveAndConfig(), ...): 1) do the change to inactive XML first, 2) in fact, do the change to a copy of inactive XML, 3) swap inactive XML and its copy only after everything succeeded. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 98 ++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c4418df1ed..e30b1b8d84 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5595,6 +5595,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, { g_autoptr(virQEMUDriverConfig) cfg =3D NULL; qemuDomainObjPrivate *priv; + g_autoptr(virDomainDef) defcopy =3D NULL; virDomainDef *def; virDomainDef *persistentDef; virDomainIOThreadIDDef *iothreaddef =3D NULL; @@ -5610,6 +5611,55 @@ qemuDomainChgIOThread(virQEMUDriver *driver, if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) goto endjob; =20 + if (persistentDef) { + /* Make a copy of persistent definition and do all the changes the= re. + * Swap the definitions only after changes to live definition + * succeeded. */ + if (!(defcopy =3D virDomainObjCopyPersistentDef(vm, driver->xmlopt, + priv->qemuCaps))) + return -1; + + switch (action) { + case VIR_DOMAIN_IOTHREAD_ACTION_ADD: + if (virDomainDriverAddIOThreadCheck(defcopy, iothread.iothread= _id) < 0) + goto endjob; + + if (!virDomainIOThreadIDAdd(defcopy, iothread.iothread_id)) + goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_DEL: + if (virDomainDriverDelIOThreadCheck(defcopy, iothread.iothread= _id) < 0) + goto endjob; + + virDomainIOThreadIDDel(defcopy, iothread.iothread_id); + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_MOD: + iothreaddef =3D virDomainIOThreadIDFind(defcopy, iothread.ioth= read_id); + + if (!iothreaddef) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot find IOThread '%u' in iothreadids= "), + iothread.iothread_id); + goto endjob; + } + + if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) <= 0) + goto endjob; + + if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) <= 0) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("configuring persistent polling values is= not supported")); + goto endjob; + } + + break; + } + } + if (def) { if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -5660,50 +5710,12 @@ qemuDomainChgIOThread(virQEMUDriver *driver, qemuDomainSaveStatus(vm); } =20 - if (persistentDef) { - switch (action) { - case VIR_DOMAIN_IOTHREAD_ACTION_ADD: - if (virDomainDriverAddIOThreadCheck(persistentDef, iothread.io= thread_id) < 0) - goto endjob; - - if (!virDomainIOThreadIDAdd(persistentDef, iothread.iothread_i= d)) - goto endjob; - - break; - - case VIR_DOMAIN_IOTHREAD_ACTION_DEL: - if (virDomainDriverDelIOThreadCheck(persistentDef, iothread.io= thread_id) < 0) - goto endjob; - - virDomainIOThreadIDDel(persistentDef, iothread.iothread_id); - - break; - - case VIR_DOMAIN_IOTHREAD_ACTION_MOD: - iothreaddef =3D virDomainIOThreadIDFind(persistentDef, iothrea= d.iothread_id); - - if (!iothreaddef) { - virReportError(VIR_ERR_INVALID_ARG, - _("cannot find IOThread '%u' in iothreadids= "), - iothread.iothread_id); - goto endjob; - } - - if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) <= 0) - goto endjob; - - if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) <= 0) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("configuring persistent polling values is= not supported")); - goto endjob; - } - - break; - } - - if (virDomainDefSave(persistentDef, driver->xmlopt, - cfg->configDir) < 0) + /* Finally, if no error until here, we can save config. */ + if (defcopy) { + if (virDomainDefSave(defcopy, driver->xmlopt, cfg->configDir) < 0) goto endjob; + + virDomainObjAssignDef(vm, &defcopy, false, NULL); } =20 ret =3D 0; --=20 2.35.1 From nobody Wed May 15 06:13:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1657266972; cv=none; d=zohomail.com; s=zohoarc; b=PupO8CZXL1lebATk7xuElRWaEz8R1j1XQnf6ZYjpEXo+6ALefsn+xi3te59EVzOQ8CIhBzLLw108/lbKm6fHDwgHFd193hM3Kji+S8PF2sBzrzkK5RjXVOfwepGkIAa3JTSp2l97WeT/4IRXvt5TJ8jib34z5PJG1ijH5M/gmoE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657266972; 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=uP70P4h+qVPkQiH/n5JPG1PoLv37x59IXtCf8+IiJw0=; b=dyBsKo2Bte8rgNk73LmSwuThCr9PDzYxTWHjBo/bv5SgnDZhkFPauC+z95vhaA+oC3TkaJxjbJqM+iR9aiGDfwmAPvS4EFBNxbvsvqF1NDIdVQ+k3Jx7xbB8HVle8EZafCZRZ7Uc/qR5IE7BfLoy/wjX9hkBc1SCoW8QIJVIx+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1657266972374988.0271027636713; Fri, 8 Jul 2022 00:56:12 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-k6FBLY2ZODeqrpryQEUtBA-1; Fri, 08 Jul 2022 03:55:27 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 355681032966; Fri, 8 Jul 2022 07:55:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1EE2A140240F; Fri, 8 Jul 2022 07:55:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 59ADC194706E; Fri, 8 Jul 2022 07:55:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A44AB1947B8F for ; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8461F1121320; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D47D1121315 for ; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657266971; 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=uP70P4h+qVPkQiH/n5JPG1PoLv37x59IXtCf8+IiJw0=; b=KB466Hh3yGSQpaOsMAUE5MTrGqW85K3kw5HWkPZ/4azGxuNJO0C/lR+JMOdYi11Umjjxkg dI/+UM0cXv/zga48ntpYMHRegXzlQNfoRor7jDje0oV5rfuqLrtZ9ZRjxVzVoqcs9vC6OY b5TSQFfewdsW8k4nJFtR8i6Sj4UUR7Y= X-MC-Unique: k6FBLY2ZODeqrpryQEUtBA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/5] qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag Date: Fri, 8 Jul 2022 09:55:13 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: 1657266974288100001 Content-Type: text/plain; charset="utf-8"; x-default="true" It was always possible to modify the inactive XML, because VIR_DOMAIN_AFFECT_CURRENT (=3D 0) is accepted implicitly. But now that the logic when changing both config and live XMLs is more robust we can accept VIR_DOMAIN_AFFECT_CONFIG flag too. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e30b1b8d84..da95f947e7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5819,7 +5819,8 @@ qemuDomainSetIOThreadParams(virDomainPtr dom, qemuMonitorIOThreadInfo iothread =3D {0}; int ret =3D -1; =20 - virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1); + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG, -1); =20 if (iothread_id =3D=3D 0) { virReportError(VIR_ERR_INVALID_ARG, "%s", --=20 2.35.1 From nobody Wed May 15 06:13:19 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=1657266930; cv=none; d=zohomail.com; s=zohoarc; b=apcypH7AJNQ+5f1uMBQm7ja2Of80rWs+Q6wwZylDJ0a3uhjvHo2J6LeCpbXjQKP7hfHClOGGKkpqDLxrFzpE8yMIV1kX5Qvc1ei86EHyZ9aMSTkrtwtF2soGBEfXX/O6rPGFdlUrKcz67IhHYR+lMVIc/arLhDfB8g4hGPUHVr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657266930; 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=a/owlsfHayOtwOEvPDh5M8TGKKeyAZulA4qoN3gbabs=; b=fnmYpoqJOcAGaZYqqG2bhyK5jJiIfzdGIczQWe/qvy4ditNZVaVMwvjQohXqdbv5aF4SZgc3vCmQTGkefEWvb61vZKi25ANWJN2oUv8inKZgACU0mpXdQ/tUO6BF5aot1L9J5SanPdL+5DR3rrIEzD7MYKbGK2i29jvpf8Veg3o= 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 1657266930928870.8984449292158; Fri, 8 Jul 2022 00:55:30 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-338-K0Dpf3CkP2WKoKTgGI8e5g-1; Fri, 08 Jul 2022 03:55:23 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AABB81C00510; Fri, 8 Jul 2022 07:55:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C820492C3B; Fri, 8 Jul 2022 07:55:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B58FB19451F1; Fri, 8 Jul 2022 07:55:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3FCDE1947BA2 for ; Fri, 8 Jul 2022 07:55:19 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 23B2B1121320; Fri, 8 Jul 2022 07:55:19 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0E001121315 for ; Fri, 8 Jul 2022 07:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657266929; 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=a/owlsfHayOtwOEvPDh5M8TGKKeyAZulA4qoN3gbabs=; b=iMh1n6dcHC3O9Y0+U4rpGdmSCvIhAqVKSKa56lFTPbZPuGVqpWhNWbehmGP/bM8R9yvQBv khsrEZFPgvA529142PprOPb1WA+nBpVK3KslD9DeQ9NjmG/2x5hWjTJa/rT7QitH/SJe86 uQ7674AtkjfW9EJ1IGS6BkspYWizRNg= X-MC-Unique: K0Dpf3CkP2WKoKTgGI8e5g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/5] virsh: Implement --config for iothreadset Date: Fri, 8 Jul 2022 09:55:14 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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: 1657266931877100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Our man page already documents that iothreadset has --config argument. Well, it doesn't really. Normally, I'd just fix the man page, but with recent work on the API it's possible to tweak values for inactive XML too. Therefore, implement the --config argument for the command. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 43034f2f81..da63cc95ff 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7831,6 +7831,7 @@ static const vshCmdOptDef opts_iothreadset[] =3D { .type =3D VSH_OT_INT, .help =3D N_("upper boundary for worker thread pool") }, + VIRSH_COMMON_OPT_DOMAIN_CONFIG, VIRSH_COMMON_OPT_DOMAIN_LIVE, VIRSH_COMMON_OPT_DOMAIN_CURRENT, {.name =3D NULL} @@ -7842,6 +7843,8 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) g_autoptr(virshDomain) dom =3D NULL; int id =3D 0; bool ret =3D false; + bool current =3D vshCommandOptBool(cmd, "current"); + bool config =3D vshCommandOptBool(cmd, "config"); bool live =3D vshCommandOptBool(cmd, "live"); unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; virTypedParameterPtr params =3D NULL; @@ -7852,8 +7855,13 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd) int thread_val; int rc; =20 + VSH_EXCLUSIVE_OPTIONS_VAR(current, live); + VSH_EXCLUSIVE_OPTIONS_VAR(current, config); + if (live) flags |=3D VIR_DOMAIN_AFFECT_LIVE; + if (config) + flags |=3D VIR_DOMAIN_AFFECT_CONFIG; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; --=20 2.35.1