From nobody Mon Feb 9 06:02:20 2026 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=1680183724; cv=none; d=zohomail.com; s=zohoarc; b=WdHsIt3Do3+Kh2BgKGb2935BEnvcIaFoUGUWzdwwdh8MvLgw60onDqZLqkAzyWsvKBNPTkgUrRjKIMTVP40iML58LB5WSitdHK5oXhirO6DgrwnQgdMSueJhFI2kxg5ZGQ6tqvi5zdGMEoExuEoDEs4mWBxa/kO67UWACwjJPyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680183724; 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=wuZzGmEYo3PMJuALSZanQUPeGSIjHHqKsZrOZTeSzIc=; b=QqfVk8lp1PVvo/+QMjJgJ/4DVmXoQQDNNJv+0fC/gX3iE2hDDguHVNFZzS0E9sCoMvAd9tolD+SuG5MhgIhFM5/meRo7U66J61ZBytlD78Nnnn/dyC+IL85RTxQOeY1+ozsr3peZWpxP2iVA1RroccPYgKvQrx4FMnwKabupwBg= 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 16801837241171016.9688461603093; Thu, 30 Mar 2023 06:42:04 -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-591-Yn_WLhIvMAeYnyO5P3DMNw-1; Thu, 30 Mar 2023 09:41:20 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBF7E3C0F192; Thu, 30 Mar 2023 13:41:17 +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 A9FF2492B00; Thu, 30 Mar 2023 13:41:17 +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 D89F9193F510; Thu, 30 Mar 2023 13:39:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 298D71946A6A for ; Thu, 30 Mar 2023 13:38:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1F9452166B34; Thu, 30 Mar 2023 13:38:54 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C1C62166B33 for ; Thu, 30 Mar 2023 13:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680183723; 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=wuZzGmEYo3PMJuALSZanQUPeGSIjHHqKsZrOZTeSzIc=; b=DDn9lwXtDQXzrf3BgAWqms2AeOfG3OKcB1hSdnVySOC3JQg1Sh7/pZXMQLhEcdUUxhcBwq WGUUMQtTnqSlE4Bf/RlUvE1qGQvaCQo8i6paUW1AX7OA6DdqPHMtZTKV9Zo+BY36WAvHvr J/rmWm0nt5AjWPOXhlz19DvPE3S+8QE= X-MC-Unique: Yn_WLhIvMAeYnyO5P3DMNw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 28/31] qemuValidateDomainDefPSeriesFeature: Simplify machine validation logic Date: Thu, 30 Mar 2023 15:38:22 +0200 Message-Id: <9f58ffded6956963cfc747d8034b24d0d1f9be33.1680182808.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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 3.1 on 10.11.54.9 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: 1680184021968100001 Content-Type: text/plain; charset="utf-8" Return early and reformat the error message. Signed-off-by: Peter Krempa --- src/qemu/qemu_validate.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 83e4ca757e..793990c4ca 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -41,20 +41,18 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef = *def, { const char *str; - if (def->features[feature] !=3D VIR_TRISTATE_SWITCH_ABSENT && - !qemuDomainIsPSeries(def)) { + if (def->features[feature] =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + return 0; + + if (!qemuDomainIsPSeries(def)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The '%s' feature is not supported for " - "architecture '%s' or machine type '%s'"), + _("The '%s' feature is not supported for architectu= re '%s' or machine type '%s'"), virDomainFeatureTypeToString(feature), virArchToString(def->os.arch), def->os.machine); return -1; } - if (def->features[feature] =3D=3D VIR_TRISTATE_SWITCH_ABSENT) - return 0; - switch (feature) { case VIR_DOMAIN_FEATURE_HPT: if (def->features[feature] !=3D VIR_TRISTATE_SWITCH_ON) --=20 2.39.2