From nobody Thu Apr 25 08:21:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1584467451; cv=none; d=zohomail.com; s=zohoarc; b=Mrs9JTccK5ZuBqLrDKtko9yoUtbnRGPophxmUx8tDKU4pJlSmp6ghqaJjgeQGq20XGDLdo9XAWcUHDBM6fTkh4sry22CW6d0eyOuyHTM6YwIokccdKAn+9BPcpGRXzN1ZQfFDdxxsM+jU+G9aXN97oIxMTyvZr/+UD5lrfAu9WQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584467451; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=41zxTpTJ3wCJ4zuu+GGZ9R/CyCV9vxcv1bxwYy6a41c=; b=OUshbpvgRiBnES3jo42Eyz1CCLsq+M///dgaLJfA4UBJLgkRSCCLQKBTuwccIN90miZCRX6ymPa3PWNbcTL/VLFWAUVhy20S8bBCEP/4KOgTjnjZ1AZUT5OiOUjYteXiKzDdtaxekIAWTpjrMG3PGqi83fWMvzmzYVdQPcLQbC0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584467451338343.77545612447034; Tue, 17 Mar 2020 10:50:51 -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-274-_-xe0vxJO5eaaVtu_FJcvg-1; Tue, 17 Mar 2020 13:50:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 404B0107ACC9; Tue, 17 Mar 2020 17:50:42 +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 C10B890808; Tue, 17 Mar 2020 17:50:40 +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 8108C86FF4; Tue, 17 Mar 2020 17:50:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02HHocmm012466 for ; Tue, 17 Mar 2020 13:50:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id B356E19C70; Tue, 17 Mar 2020 17:50:38 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37F7119C4F for ; Tue, 17 Mar 2020 17:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584467450; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=41zxTpTJ3wCJ4zuu+GGZ9R/CyCV9vxcv1bxwYy6a41c=; b=GsFXDS0dcsm8oitfWf6ZFOKZ3Qm76aIH/xu5HeDYOTeCQInUTU9X7zoAvWCDjVDhafHKcS q2+307Bs+2bdh9q6gX0Fgll0pZARduv00AQxPIWhVY6EwMl+b8OJclAXXauqNynURjyjUQ rQvgCzSinet0WPrjU6D2qfYYr8hqKPg= X-MC-Unique: _-xe0vxJO5eaaVtu_FJcvg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemuDomainVcpuValidateConfig: Properly initialize 'firstcpu' variable Date: Tue, 17 Mar 2020 18:50:34 +0100 Message-Id: <5239933759f7411fc3fb98ede12c00af9b23902a.1584467434.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The loop which checks whether the vcpus are in proper configuration for the requested hot(un)plug skips the first modified vcpu. This means that 'firstvcpu' which is used to print the error message in case the configuration is not suitable would never point to the first modified vcpu. In cases such as: 8 # virsh setvcpu --config --disable upstream 1 error: invalid argument: vcpu '-1' can't be modified as it is followed by = non-hotpluggable online vcpus After this fix the proper vcpu is reported in the error message: # virsh setvcpu --config --disable upstream 1 error: invalid argument: vcpu '1' can't be modified as it is followed by n= on-hotpluggable online vcpu https://bugzilla.redhat.com/show_bug.cgi?id=3D1611061 Signed-off-by: Peter Krempa Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 47069be900..a76df64a7b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6478,18 +6478,16 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def, return -1; } + firstvcpu =3D virBitmapNextSetBit(map, -1); + /* non-hotpluggable vcpus need to stay clustered starting from vcpu 0 = */ - for (next =3D virBitmapNextSetBit(map, -1) + 1; next < maxvcpus; next+= +) { + for (next =3D firstvcpu + 1; next < maxvcpus; next++) { if (!(vcpu =3D virDomainDefGetVcpu(def, next))) continue; /* skip vcpus being modified */ - if (virBitmapIsBitSet(map, next)) { - if (firstvcpu < 0) - firstvcpu =3D next; - + if (virBitmapIsBitSet(map, next)) continue; - } if (vcpu->online && vcpu->hotpluggable =3D=3D VIR_TRISTATE_BOOL_NO= ) { virReportError(VIR_ERR_INVALID_ARG, --=20 2.24.1